summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-worker-script-revalidation.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-worker-script-revalidation.html')
-rw-r--r--testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-worker-script-revalidation.html25
1 files changed, 25 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-worker-script-revalidation.html b/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-worker-script-revalidation.html
new file mode 100644
index 0000000000..74794967fb
--- /dev/null
+++ b/testing/web-platform/tests/html/cross-origin-embedder-policy/require-corp-worker-script-revalidation.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<title>COEP and dedicated worker</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src="/common/get-host-info.sub.js"></script>
+<script src="resources/worker-support.js"></script>
+<body>
+<script>
+
+promise_test(async (t) => {
+ const worker1 = new Worker("/html/cross-origin-embedder-policy/resources/dedicated-worker-supporting-revalidation.py");
+ worker1.onerror = t.unreached_func('Worker.onerror should not be called for first worker');
+ worker1.postMessage("foo");
+ const result1 = await waitForMessage(worker1);
+ assert_equals(result1.data, 'LOADED');
+
+ // Load the worker a second time, which should trigger revalidation of the cached resource.
+ const worker2 = new Worker("/html/cross-origin-embedder-policy/resources/dedicated-worker-supporting-revalidation.py");
+ worker2.onerror = t.unreached_func('Worker.onerror should not be called worker second worker');
+ worker2.postMessage("foo");
+ const result2 = await waitForMessage(worker2);
+ assert_equals(result2.data, 'LOADED');
+}, 'COEP: require-corp with revalidated worker script');
+</script>
+</body>