tor-browser

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

test_bug965082.html (1361B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=965082
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 965082</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript">
     12 
     13  /** Test for Bug 965082 **/
     14  SimpleTest.waitForExplicitFinish();
     15 
     16  function checkThrows(f, msg) {
     17    try { f(); ok(false, "Should have thrown: " + msg); }
     18    catch (e) { ok(/denied|insecure|can't set prototype/.test(e), "Should throw security exception: " + e + " (" + msg + ")"); }
     19  }
     20 
     21  function go() {
     22    var protoSetter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
     23    checkThrows(function() { protoSetter.call(window[0], new Object()); }, "Setting cross-origin Window prototype");
     24    checkThrows(function() { protoSetter.call(window[0].location, new Object()); }, "Setting cross-origin Location prototype");
     25    SimpleTest.finish();
     26  }
     27 
     28  </script>
     29 </head>
     30 <body>
     31 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=965082">Mozilla Bug 965082</a>
     32 <p id="display"></p>
     33 <div id="content" style="display: none">
     34 </div>
     35 <iframe id="ifr" onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
     36 <pre id="test">
     37 </pre>
     38 </body>
     39 </html>