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
2 years ago
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
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
Pushed by firstname.lastname@example.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.
Status: ASSIGNED → RESOLVED
Last Resolved: 8 months ago
status-firefox63: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Upstream PR merged
Posted the site compatibility note: https://www.fxsitecompat.com/en-CA/docs/2018/url-createobjecturl-is-no-longer-available-in-service-workers/
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.
Keywords: dev-doc-needed → dev-doc-complete
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.