dedicatedworker-worker-src.html (763B)
1 <!DOCTYPE html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <!-- Test the 'worker-src' directive on nested dedicated workers --> 5 <script> 6 const w = new Worker( 7 `./support/worker-src-none.sub.js?` + 8 `pipe=sub|header(Content-Security-Policy,` + 9 `worker-src 'none')`); 10 // Forward 'securitypolicyviolation' events from the document into the 11 // worker (we shouldn't actually see any, so the worker will assert that 12 // none are fired). 13 document.addEventListener('securitypolicyviolation', _ => { 14 w.postMessage("SecurityPolicyViolation from Document"); 15 }); 16 // Nested workers are disallowed and don't send violations to document 17 fetch_tests_from_worker(w); 18 </script>