tor-browser

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

file_bug789713.html (1135B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=789713
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8 </head>
      9 <body>
     10 
     11 <script type="application/javascript">
     12 
     13 /** Test for Bug 789713 **/
     14 
     15 function go() {
     16  var ifr = document.getElementById('ifr');
     17  var pass = true;
     18  var doc = ifr.contentDocument;
     19  var win = ifr.contentWindow;
     20 
     21  var walker = doc.createTreeWalker(doc.body);
     22  pass = pass && (walker.root === doc.body);
     23  walker.foo = "expando";
     24 
     25  win.bar = "another-expando";
     26 
     27  // First, do the document.domain operation. This shouldn't crash.
     28  document.domain = "example.org";
     29 
     30  // Now make sure we can still access properties on "walker".
     31  try {
     32    walker.root;
     33    pass = pass && walker.foo == "expando";
     34  } catch (e) {
     35    pass = false;
     36  }
     37 
     38  // And make sure we can't access properties on "win", because the
     39  // document.domain change revoked the access.
     40  try {
     41    win.bar;
     42    pass = false;
     43  } catch (e) { pass = pass && /Permission denied/.exec(e.message); }
     44  window.parent.postMessage(pass, '*');
     45 }
     46 
     47 </script>
     48 <iframe id="ifr" src="file_empty.html" onload="go()"></iframe>
     49 </pre>
     50 </body>
     51 </html>