Closed Bug 1354577 Opened 4 years ago Closed 2 years ago

use new service worker mime type restrictions

Categories

(Core :: DOM: Service Workers, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: bkelly, Assigned: perry)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 3 obsolete files)

Spec change:

https://github.com/w3c/ServiceWorker/pull/1106

WPT change:

https://github.com/w3c/web-platform-tests/pull/5376

This widens the definition of what valid javascript mime types are.  Also, it tests that importScripts() mime types are enforced, which is something we don't currently do.
Priority: -- → P3
Assignee: nobody → perry
Status: NEW → ASSIGNED
Attachment #9010100 - Attachment is obsolete: true
Attachment #9010099 - Attachment is obsolete: true
Attachment #9010098 - Attachment is obsolete: true
- Change "ServiceWorkerRegisterMimeTypeError" to "ServiceWorkerRegisterMimeTypeError2"
to account for more acceptable MIME types
Attachment #9010714 - Attachment description: Bug 1354577 - require ServiceWorkerContainer.register() to only accept JavaScript MIME types r?asuth → Bug 1354577 - require ServiceWorkerContainer.register() and ServiceWorkerGlobalScope.importScripts() to only accept JavaScript MIME types r?asuth
Priority: P3 → P2
Attachment #9010714 - Attachment description: Bug 1354577 - require ServiceWorkerContainer.register() and ServiceWorkerGlobalScope.importScripts() to only accept JavaScript MIME types r?asuth → Bug 1354577 - require ServiceWorkerContainer.register() and ServiceWorkerGlobalScope.importScripts() to only accept JavaScript MIME types r?edenchuang
- Make ServiceWorkerGlobalScope.importScripts() throw a NetworkError when receiving a
bad (i.e. non-JavaScript) MIME type
- Correct registration-tests-mime-types.js to expect TypeError when registering
a service worker that calls importScripts() with a bad MIME type, per spec
- Add WPT import-scripts-mime-types.https.html to test importScripts success/failure,
depending on MIME type

Depends on D6416
(moz-phab submit unsquashed the two commits after updating for rebase)
Attachment #9010714 - Attachment description: Bug 1354577 - require ServiceWorkerContainer.register() and ServiceWorkerGlobalScope.importScripts() to only accept JavaScript MIME types r?edenchuang → Bug 1354577 - require ServiceWorkerContainer.register() to only accept JavaScript MIME types r?edenchuang
Removing checkin-needed tag, part 2 also needs review
Flags: needinfo?(echuang)
Keywords: checkin-needed
Clear the needinfo
Flags: needinfo?(echuang)
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/13765 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
Please re-open the relevant Phabricator requests so Lando can push this.
Flags: needinfo?(perry)
Keywords: checkin-needed
Nevermind, pulsebot was just down.
Flags: needinfo?(perry)
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/73b6c5885020
require ServiceWorkerContainer.register() to only accept JavaScript MIME types r=edenchuang
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/82c8a3aae99c
require ServiceWorkerGlobalScope.importScripts() to only accept JavaScript MIME types r=edenchuang
https://hg.mozilla.org/mozilla-central/rev/73b6c5885020
https://hg.mozilla.org/mozilla-central/rev/82c8a3aae99c
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
I've documented this:

Made sure this restriction is mentioned on both relevant ref pages:
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/register
https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts

Added a note about it to the Fx65 rel notes:
https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/65#APIs

Let me know if you think this needs anything else. Thanks!
You need to log in before you can comment on or make changes to this bug.