use new service worker mime type restrictions

RESOLVED FIXED in Firefox 65

Status

()

enhancement
P2
normal
RESOLVED FIXED
2 years ago
7 months ago

People

(Reporter: bkelly, Assigned: perry)

Tracking

(Blocks 1 bug, {dev-doc-complete})

unspecified
mozilla65
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox65 fixed)

Details

Attachments

(2 attachments, 3 obsolete attachments)

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
Comment hidden (obsolete)
Comment hidden (obsolete)
Comment hidden (obsolete)
Attachment #9010100 - Attachment is obsolete: true
Attachment #9010099 - Attachment is obsolete: true
Attachment #9010098 - Attachment is obsolete: true
Assignee

Comment 4

9 months ago
- 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

Updated

9 months ago
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
Assignee

Comment 5

8 months ago
- 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
Assignee

Comment 6

8 months ago
(moz-phab submit unsquashed the two commits after updating for rebase)
Assignee

Updated

8 months ago
Keywords: checkin-needed
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)
Assignee

Updated

8 months ago
Keywords: checkin-needed
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)

Comment 13

8 months ago
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/73b6c5885020
require ServiceWorkerContainer.register() to only accept JavaScript MIME types r=edenchuang

Comment 14

8 months ago
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/82c8a3aae99c
require ServiceWorkerGlobalScope.importScripts() to only accept JavaScript MIME types r=edenchuang

Comment 15

8 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/73b6c5885020
https://hg.mozilla.org/mozilla-central/rev/82c8a3aae99c
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Upstream PR merged
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!
Assignee

Comment 18

7 months ago
Thanks!
You need to log in before you can comment on or make changes to this bug.