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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Yaron Tausky 2018-08-07 11:48:51 +00:00
Родитель 40e5e32240
Коммит 1a485b81c7
2 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -40,6 +40,7 @@ interface URL {
USVString toJSON();
};
[Exposed=(Window,DedicatedWorker,SharedWorker)]
partial interface URL {
[Throws]
static DOMString createObjectURL(Blob blob);
@ -47,10 +48,8 @@ partial interface URL {
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);
};

Просмотреть файл

@ -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')