image-document-applies-csp.html (1047B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <head> 4 <title>CSP header applied to image document</title> 5 <link rel="help" href="https://github.com/servo/servo/issues/38180"> 6 <script src='/resources/testharness.js'></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 <body> 10 <iframe id="iframe" src="../support/pass.png?pipe=header(Content-Security-Policy,default-src 'none')"></iframe> 11 <script> 12 let iframe = document.getElementById("iframe"); 13 promise_test(async t => { 14 await t.step_wait(() => { 15 return iframe.contentDocument.querySelector("img") !== null; 16 }, "Wait for image document to be loaded", 5000, 100); 17 return new Promise((resolve, reject) => { 18 let newImg = iframe.contentDocument.createElement("img"); 19 newImg.onload = reject; 20 newImg.onerror = resolve; 21 newImg.src = "../support/fail.png"; 22 iframe.contentDocument.body.appendChild(newImg); 23 }); 24 }, "Image document correctly applies CSP to other subresources."); 25 </script> 26 </body>