Skip to content

Commit

Permalink
[WPT] importScripts() + data: URL in ServiceWorker
Browse files Browse the repository at this point in the history
As there are no conditions forbidding data: URLs in the service
worker spec
https://w3c.github.io/ServiceWorker/#importscripts-method
importScripts() for data: URLs should be successful
just like other workers.

Current status:
- Chrome/Safari: pass
- Firefox: fail

Bug: 1334249
Change-Id: I8ff55100d55f39323dd7706c1d8294edbfd01e45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4144339
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115602}
  • Loading branch information
hiroshige-g authored and Chromium LUCI CQ committed Mar 10, 2023
1 parent 1cfcda2 commit 82933d0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Tests for importScripts: data: URL</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
<body>
<script>
promise_test(async t => {
const scope = 'resources/import-scripts-data-url';
await service_worker_unregister(t, scope);
let reg = await navigator.serviceWorker.register(
'resources/import-scripts-data-url-worker.js', { scope: scope });
t.add_cleanup(_ => reg.unregister());
assert_not_equals(reg.installing, null, 'worker is installing');
}, 'importScripts() supports data URLs');
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
importScripts('data:text/javascript,');

0 comments on commit 82933d0

Please sign in to comment.