test_data_doc_ignore_meta_csp.html (1271B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug 1382869: data document should ignore meta csp</title> 5 <script src="/tests/SimpleTest/SimpleTest.js"></script> 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 7 </head> 8 <body> 9 <iframe style="width:100%;" id="testframe"></iframe> 10 11 <script class="testbody" type="text/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 15 /* Description of the test: 16 * We load an iframe creating a new data document which defines 17 * a meta csp. We make sure the meta CSP is ignored and does not 18 * apply to the actual iframe document. 19 */ 20 21 window.addEventListener("message", receiveMessage); 22 function receiveMessage(event) { 23 window.removeEventListener("message", receiveMessage); 24 is(event.data.result, "dataDocCreated", "sanity: received msg from loaded frame"); 25 26 var frame = document.getElementById("testframe"); 27 var contentDoc = SpecialPowers.wrap(frame).contentDocument; 28 var cspOBJ = JSON.parse(contentDoc.cspJSON); 29 // make sure we got no policy attached 30 var policies = cspOBJ["csp-policies"]; 31 is(policies.length, 0, "there should be no CSP attached to the iframe"); 32 SimpleTest.finish(); 33 } 34 35 document.getElementById("testframe").src = "file_data_doc_ignore_meta_csp.html"; 36 37 </script> 38 </body> 39 </html>