tor-browser

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

test_bug1660452_http.html (1385B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4 <title>Bug 1660452: NullPrincipals need to know whether they were spun off of a Secure Context</title>
      5 <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7 </head>
      8 
      9 <body>
     10 <script class="testbody" type="text/javascript">
     11 
     12 SimpleTest.waitForExplicitFinish();
     13 ok(!window.isSecureContext, "top level should not be a secure context");
     14 
     15 // eslint-disable-next-line
     16 let newWin = window.open("data:text/html,<script><"+"/script>");
     17 ok(!newWin.isSecureContext, "data uri window should not be a secure context");
     18 newWin.close();
     19 
     20 window.addEventListener("message", (event) => {
     21    ok(!event.data.isSecureContext, "data uri frames should not be a secure context");
     22    if(event.data.finish) {
     23        SimpleTest.finish();
     24        return;
     25    }
     26    let f2 = document.createElement("iframe");
     27    // eslint-disable-next-line
     28    f2.src = "data:text/html,<iframe src=\"data:text/html,<script>parent.parent.postMessage({isSecureContext: window.isSecureContext, finish: true}, '*');<"+"/script>\"></iframe>";
     29    document.body.appendChild(f2);
     30 });
     31 
     32 let f = document.createElement("iframe");
     33 // eslint-disable-next-line
     34 f.src = "data:text/html,<script>parent.postMessage({isSecureContext: window.isSecureContext}, '*');<"+"/script>";
     35 document.body.appendChild(f);
     36 
     37 </script>
     38 </body>
     39 </html>