Update web-platform-tests to revision 0ed072539aa45d3a5a67c9164b243d27873f257c

This commit is contained in:
WPT Sync Bot 2019-12-13 08:23:34 +00:00
parent 0954871992
commit e613cfd108
76 changed files with 1109 additions and 703 deletions

View file

@ -0,0 +1,29 @@
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async (test) => {
const reg = await navigator.serviceWorker.register('./serviceworker.js', { type: 'module' });
test.add_cleanup(() => reg.unregister());
assert_not_equals(reg.installing, undefined);
}, "Javascript importing JSON Module should load within the context of a service worker");
promise_test(async (test) => {
const reg = await navigator.serviceWorker.register('./module.json', { type: 'module' });
test.add_cleanup(() => reg.unregister());
assert_not_equals(reg.installing, undefined);
}, "JSON Modules should load within the context of a service worker");
promise_test(async (test) => {
const reg = await navigator.serviceWorker.register('./serviceworker-dynamic-import.js', { type: 'module' });
test.add_cleanup(() => reg.unregister());
assert_not_equals(reg.installing, undefined);
reg.installing.postMessage("PING");
const msgEvent = await new Promise(resolve => {
navigator.serviceWorker.onmessage = resolve;
});
assert_equals(msgEvent.data, "FAILED");
}, "JSON Module dynamic import should not load within the context of a service worker");
</script>

View file

@ -0,0 +1,5 @@
onmessage = e => {
e.waitUntil(import("./module.json")
.then(module => e.source.postMessage("LOADED"))
.catch(error => e.source.postMessage("FAILED")));
};