tor-browser

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

file_iframe_sandbox_k_if2.html (1692B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test for Bug 766282</title>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      7 </head>
      8 
      9 <script type="text/javascript">
     10  if (window.name == "") {
     11    window.name = "blank_if2";
     12  }
     13 
     14  function ok(result, message) {
     15    window.opener.parent.postMessage({type: "ok", ok: result, desc: message}, "*");
     16  }
     17 
     18  function doStuff() {
     19    // Check that sandboxed forms browsing context flag copied by attempting to submit a form.
     20    document.getElementById('a_form').submit();
     21    window.opener.parent.postMessage({type: "attempted"}, "*");
     22 
     23    // Check that sandboxed origin browsing context flag copied by attempting to access cookies.
     24    try {
     25      var foo = document.cookie;
     26      ok(false, "Sandboxed origin browsing context flag NOT copied to new auxiliary browsing context.");
     27    } catch(error) {
     28      ok(true, "Sandboxed origin browsing context flag copied to new auxiliary browsing context.");
     29    }
     30 
     31    // Check that sandboxed top-level navigation browsing context flag copied.
     32    // if_3 tries to navigate this document.
     33    var if_3 = document.getElementById('if_3');
     34    if_3.src = "file_iframe_sandbox_k_if3.html";
     35  }
     36 </script>
     37 
     38 <body onLoad="doStuff()">
     39  I am not sandboxed directly, but opened from a sandboxed document with 'allow-scripts allow-popups'
     40 
     41  <form method="get" action="file_iframe_sandbox_window_form_fail.html" id="a_form">
     42    First name: <input type="text" name="firstname">
     43    Last name: <input type="text" name="lastname">
     44    <input type="submit" id="a_button">
     45  </form>
     46 
     47  <iframe id="if_3" src="about:blank" height="10" width="10"></iframe>
     48 
     49 </body>
     50 </html>