Closed Bug 1264182 Opened 5 years ago Closed 2 years ago

remove URL.createObjectURL from ServiceWorker

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: bkelly, Assigned: ytausky)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, site-compat, Whiteboard: btpp-fixlater[wptsync upstream])

Attachments

(1 file)

We decided to remove createObjectURL from ServiceWorker context since blob URLs have lifecycle problems on service workers and Response objects have better semantics.

  https://github.com/slightlyoff/ServiceWorker/issues/688
Whiteboard: btpp-fixlater
Keywords: site-compat
Priority: -- → P2
Assignee: nobody → ytausky
Status: NEW → ASSIGNED
The appropriate lifetime for URLs created with URL.createObjectURL turned
out to be tricky to define, so it was decided to hide it from service
workers altogether. (https://github.com/slightlyoff/ServiceWorker/issues/688)

This commit implements this change and adds a web platform test to verify it.
It also exposes the MediaSource variant of URL.createObjectURL in DedicatedWorker
and SharedWorker contexts in order to comply with the WebIDL spec (see
https://github.com/w3c/media-source/issues/168#issuecomment-410269436).
Comment on attachment 8997470 [details]
Bug 1264182: Hide URL.createObjectURL from ServiceWorker

Blake Kaplan (:mrbkap) has approved the revision.

https://phabricator.services.mozilla.com/D2728
Attachment #8997470 - Flags: review+
Comment on attachment 8997470 [details]
Bug 1264182: Hide URL.createObjectURL from ServiceWorker

Andrew Sutherland [:asuth] has approved the revision.

https://phabricator.services.mozilla.com/D2728
Attachment #8997470 - Flags: review+
Pushed by bugmail@asutherland.org:
https://hg.mozilla.org/integration/autoland/rev/40d4999db319
Hide URL.createObjectURL from ServiceWorker r=mrbkap,asuth
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/12339 for changes under testing/web-platform/tests
Whiteboard: btpp-fixlater → btpp-fixlater[wptsync upstream]
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
https://hg.mozilla.org/mozilla-central/rev/40d4999db319
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Doc updates:

The createObjectURL() page already had this information; updated revokeObjectURL() and added a note to Firefox 63 for developers.

I've also submitted PR #2707 on BCD to note these changes in the compatibility database.
Aha, I’ve just found URL.createObjectURL in my own service worker. Fortunately this particular app is no longer maintained, but I’m wondering if this change may break similar code. Will monitor reports.

https://github.com/bzdeck/bzdeck/blob/master/webroot/static/scripts/workers/service-worker.js
You need to log in before you can comment on or make changes to this bug.