test_data_csp_merge.html (1203B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <title>Bug 1386183 - Meta CSP on data: URI iframe should be merged with toplevel CSP</title> 5 <!-- Including SimpleTest.js so we can use waitForExplicitFinish !--> 6 <script src="/tests/SimpleTest/SimpleTest.js"></script> 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 8 </head> 9 <body> 10 <iframe style="width:100%;" id="testframe"></iframe> 11 12 <script class="testbody" type="text/javascript"> 13 14 SimpleTest.waitForExplicitFinish(); 15 16 /* Description of the test: 17 * We load an iframe using a meta CSP which includes another iframe 18 * using a data: URI which also defines a meta CSP. We make sure the 19 * CSP from the including document gets merged with the data: URI 20 * CSP and applies to the data: URI iframe. 21 */ 22 23 window.addEventListener("message", receiveMessage); 24 function receiveMessage(event) { 25 window.removeEventListener("message", receiveMessage); 26 // toplevel CSP + data: URI iframe meta CSP => 2 CSP policies 27 is(event.data.result, 2, 28 "CSP on data: URI iframe gets merged with CSP from including context"); 29 SimpleTest.finish(); 30 } 31 32 document.getElementById("testframe").src = "file_data_csp_merge.html"; 33 34 </script> 35 </body> 36 </html>