I just helped someone diagnose a bug in their node server where they could not register a service worker. It turns out they were not setting the mime-type for the script. This could have been resolved a lot faster if we simply logged a message for this failure.
Created attachment 8768268 [details] [diff] [review] MIME type error message and test v1, layers on top of bug 1267473 fix. Build on bug 1267473 patch adding logging for the missing/bad MIME type case. If I've got any major idiomatic issues, feel free to just comment on that one and I'll propagate through. Error looks like: """ Failed to register/update a ServiceWorker: Non-JS Content-Type of ‘text/plain’ received for script ‘http://mochi.test:8888/tests/dom/workers/test/serviceworkers/sw_bad_mime_type.js’. """
(In reply to Ben Kelly [:bkelly] from comment #3) > Is this usage of temporary return values valid? Since they are not declared > as variables on the stack, do they live long enough to pass into > FormatLocalizedString()? Yeah, the temporaries are almost certainly invalid by the time of use... possibly doubly so. I was lining up the types and stopped waaay too early. I'll see if I can make the SWM logging helper function reduce the boilerplate string management required without getting into a template nightmare.
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/b8ca65757e7c report to console when service worker register fails due to mime-type issues. r=bkelly
try job for this was: https://treeherder.mozilla.org/#/jobs?repo=try&revision=86fbfe09ca7b