inside-service-worker.https.html (921B)
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 navigator.serviceWorker.register("./support/inside-worker.sub.js", { scope: "./support/" }) 13 .then(r => { 14 var sw = r.active || r.installing || r.waiting; 15 add_completion_callback(_ => r.unregister()); 16 17 // Forward 'securitypolicyviolation' events from the document into the 18 // worker (we shouldn't actually see any, so the worker will assert that 19 // none are fired. 20 document.addEventListener('securitypolicyviolation', _ => { 21 sw.postMessage("SecurityPolicyViolation from Document"); 22 }); 23 24 fetch_tests_from_worker(sw); 25 }); 26 </script>