Skip to content

Commit

Permalink
Bug 1264182: Hide URL.createObjectURL from ServiceWorker r=mrbkap,asuth
Browse files Browse the repository at this point in the history
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. (w3c/ServiceWorker#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
w3c/media-source#168 (comment)).

Differential Revision: https://phabricator.services.mozilla.com/D2728

--HG--
extra : moz-landing-system : lando
  • Loading branch information
ytausky committed Aug 7, 2018
1 parent 40e5e32 commit 1a485b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions dom/webidl/URL.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ interface URL {
USVString toJSON();
};

[Exposed=(Window,DedicatedWorker,SharedWorker)]
partial interface URL {
[Throws]
static DOMString createObjectURL(Blob blob);
[Throws]
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
[Throws]
static DOMString createObjectURL(MediaSource source);
};
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,7 @@ test(function() {
test(() => {
assert_false('XMLHttpRequest' in self);
}, 'xhr is not exposed');

test(() => {
assert_false('createObjectURL' in self.URL);
}, 'URL.createObjectURL is not exposed')

0 comments on commit 1a485b8

Please sign in to comment.