tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_data_csp_inheritance.html (1150B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Bug 1381761 - Treating 'data:' documents as unique, opaque origins should still inherit the 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. We make sure the CSP gets inherited into
     19 * the data: URI iframe.
     20 */
     21 
     22 window.addEventListener("message", receiveMessage);
     23 function receiveMessage(event) {
     24  window.removeEventListener("message", receiveMessage);
     25  // toplevel CSP should apply to data: URI iframe hence resulting
     26  // in 1 applied policy.
     27  is(event.data.result, 1,
     28     "data: URI iframe inherits CSP from including context");
     29  SimpleTest.finish();
     30 }
     31 
     32 document.getElementById("testframe").src = "file_data_csp_inheritance.html";
     33 
     34 </script>
     35 </body>
     36 </html>