Bug 1264182: Hide URL.createObjectURL from ServiceWorker r=mrbkap,asuth
authorYaron Tausky <ytausky@mozilla.com>
Tue, 07 Aug 2018 11:48:51 +0000
changeset 430351 40d4999db3191bca0aeb75a50b37537ad78102ed
parent 430350 b5ba45e6ac73574c9e6bee886929f684e39de2c8
child 430352 23889c258042e274783b442e2ed570e836978a9e
push id34402
push usercbrindusan@mozilla.com
push dateTue, 07 Aug 2018 21:49:24 +0000
treeherdermozilla-central@7d78ffbf4c4a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap, asuth
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264182: Hide URL.createObjectURL from ServiceWorker r=mrbkap,asuth 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). Differential Revision: https://phabricator.services.mozilla.com/D2728
--- a/dom/webidl/URL.webidl
+++ b/dom/webidl/URL.webidl
@@ -35,22 +35,21 @@ interface URL {
            attribute USVString search;
   readonly attribute URLSearchParams searchParams;
            attribute USVString hash;
   USVString toJSON();
 partial interface URL {
   static DOMString createObjectURL(Blob blob);
   static void revokeObjectURL(DOMString url);
   [ChromeOnly, Throws]
   static boolean isValidURL(DOMString url);
-// https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html
-partial interface URL {
+  // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html
   static DOMString createObjectURL(MediaSource source);
--- a/testing/web-platform/tests/service-workers/service-worker/resources/interfaces-worker.sub.js
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/interfaces-worker.sub.js
@@ -88,8 +88,12 @@ test(function() {
       'FetchEvent.isReload should not exist');
   }, 'Event constructors');
 test(() => {
     assert_false('XMLHttpRequest' in self);
   }, 'xhr is not exposed');
+test(() => {
+    assert_false('createObjectURL' in self.URL);
+  }, 'URL.createObjectURL is not exposed')