tor-browser

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

file_iframe_sandbox_c_if4.html (1158B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test for Bug 341604</title>
      6  <script src="/tests/SimpleTest/EventUtils.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8 </head>
      9 <script type="text/javascript">
     10  function ok(result, desc) {
     11    window.parent.ok_wrapper(result, desc);
     12  }
     13 
     14  function doStuff() {
     15    // try to open a new window via target="_blank", target="BC341604", and window.open()
     16    // the window we try to open closes itself once it opens
     17    sendMouseEvent({type:'click'}, 'target_blank');
     18    sendMouseEvent({type:'click'}, 'target_BC341604');
     19 
     20    var threw = false;
     21    try {
     22      window.open("about:blank");
     23    } catch (error) {
     24      threw = true;
     25    }
     26 
     27    ok(threw, "window.open threw a JS exception and was not allowed");
     28  }
     29 </script>
     30 <body onLoad="doStuff()">
     31  I am sandboxed but with "allow-scripts allow-same-origin"
     32 
     33  <a href="file_iframe_sandbox_open_window_fail.html" target="_blank" id="target_blank" rel="opener">open window</a>
     34  <a href="file_iframe_sandbox_open_window_fail.html" target="BC341604" id="target_BC341604">open window</a>
     35 </body>
     36 </html>