shared-worker-sandbox.html (730B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <body> 6 <script> 7 // Currently, sandbox directives for workers are not specified 8 // https://github.com/w3c/webappsec-csp/issues/279 9 // and thus this test asserts that the origin of SharedWorker is not sandboxed. 10 async_test(t => { 11 const worker = new SharedWorker("support/sandboxed-shared-worker.js?" + Math.random()); 12 worker.onerror = t.unreached_func("SharedWorker construction failed"); 13 worker.port.onmessage = t.step_func_done(e => { 14 assert_equals(e.data, location.origin, "Origin should not be sandboxed"); 15 }); 16 }, "sandbox directive for SharedWorker"); 17 </script> 18 </body>