tor-browser

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

file_iframe_sandbox_d_if14.html (1469B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Tests for Bug 838692</title>
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 
     10 <script type="text/javascript">
     11  var test20Context = "Test 20: Navigate another window (not opened by us): ";
     12 
     13  function doTest() {
     14    // Try to navigate auxiliary browsing context (window) not opened by us.
     15    // We should not be able to do this as we are sandboxed.
     16    sendMouseEvent({type:'click'}, 'navigate_window');
     17    window.parent.postMessage({type: "attempted"}, "*");
     18 
     19    // Try to navigate auxiliary browsing context (window) not opened by us, using window.open().
     20    // We should not be able to do this as we are sandboxed.
     21    try {
     22      window.open("file_iframe_sandbox_window_navigation_fail.html?" + escape(test20Context), "window_to_navigate2");
     23      window.parent.postMessage({type: "attempted"}, "*");
     24    } catch(error) {
     25      window.parent.postMessage({ok: true, desc: test20Context + "as expected, error thrown during window.open(..., \"window_to_navigate2\")"}, "*");
     26    }
     27  }
     28 </script>
     29 
     30 <body onload="doTest()">
     31  I am sandboxed but with "allow-scripts allow-same-origin allow-top-navigation".
     32 
     33  <a href="file_iframe_sandbox_window_navigation_fail.html?Test 14: Navigate another window (not opened by us):%20" target="window_to_navigate" id="navigate_window">navigate window</a>
     34 </body>
     35 </html>