tor-browser

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

file_iframe_sandbox_document_write.html (640B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head> <meta charset="utf-8"> </head>
      4 <script type="text/javascript">
      5  function ok(result, desc) {
      6    window.parent.postMessage({ok: result, desc}, "*");
      7  }
      8  function doStuff() {
      9    var beforePrincipal = SpecialPowers.wrap(document).nodePrincipal;
     10    document.open();
     11    document.write("rewritten sandboxed document");
     12    document.close();
     13    var afterPrincipal = SpecialPowers.wrap(document).nodePrincipal;
     14    ok(beforePrincipal.equals(afterPrincipal),
     15       "document.write() does not change underlying principal");
     16  }
     17 </script>
     18 <body onLoad='doStuff();'>
     19  sandboxed with allow-scripts
     20 </body>
     21 </html>