inside-shared-worker.html (733B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 5 <!-- 6 Set a policy in the document to ensure that the block is triggering 7 in the worker and not in the document. 8 --> 9 <meta http-equiv="content-security-policy" content="connect-src 'self'"> 10 11 <script> 12 var w = new SharedWorker("./support/inside-worker.sub.js"); 13 14 // Forward 'securitypolicyviolation' events from the document into the 15 // worker (we shouldn't actually see any, so the worker will assert that 16 // none are fired. 17 document.addEventListener('securitypolicyviolation', _ => { 18 w.port.postMessage("SecurityPolicyViolation from Document"); 19 }); 20 21 fetch_tests_from_worker(w); 22 </script>