tor-browser

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

test_sandbox_intercept.html (1870B)


      1 <!--
      2  Any copyright is dedicated to the Public Domain.
      3  http://creativecommons.org/publicdomain/zero/1.0/
      4 -->
      5 <!DOCTYPE HTML>
      6 <html>
      7 <head>
      8  <title>Bug 1142727 - Test that sandboxed iframes are not intercepted</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     11 </head>
     12 <body>
     13 <p id="display"></p>
     14 <div id="content">
     15 <iframe id="normal-frame"></iframe>
     16 <iframe sandbox="allow-scripts" id="sandbox-frame"></iframe>
     17 </div>
     18 <pre id="test"></pre>
     19 <script class="testbody" type="text/javascript">
     20 
     21  var normalFrame;
     22  var sandboxFrame;
     23  function runTest() {
     24    normalFrame = document.getElementById("normal-frame");
     25    sandboxFrame = document.getElementById("sandbox-frame");
     26    normalFrame.src = "/tests/dom/serviceworkers/test/fetch/sandbox/register.html";
     27    window.onmessage = function(e) {
     28      if (e.data.status == "ok") {
     29        ok(e.data.result, e.data.message);
     30      } else if (e.data.status == "registrationdone") {
     31        normalFrame.src = "about:blank";
     32        sandboxFrame.src = "/tests/dom/serviceworkers/test/fetch/sandbox/index.html";
     33      } else if (e.data.status == "done") {
     34        sandboxFrame.src = "about:blank";
     35        normalFrame.src = "/tests/dom/serviceworkers/test/fetch/sandbox/unregister.html";
     36      } else if (e.data.status == "unregistrationdone") {
     37        normalFrame.src = "about:blank";
     38        window.onmessage = null;
     39        ok(true, "Test finished successfully");
     40        SimpleTest.finish();
     41      }
     42    };
     43  }
     44 
     45  SimpleTest.waitForExplicitFinish();
     46  onload = function() {
     47    SpecialPowers.pushPrefEnv({"set": [
     48      ["dom.serviceWorkers.exemptFromPerDomainMax", true],
     49      ["dom.serviceWorkers.enabled", true],
     50      ["dom.serviceWorkers.testing.enabled", true],
     51    ]}, runTest);
     52  };
     53 </script>
     54 </pre>
     55 </body>
     56 </html>