tor-browser

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

test_https_fetch.html (2282B)


      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 1133763 - test fetch event in HTTPS origins</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" style="display: none">
     15 <iframe></iframe>
     16 </div>
     17 <pre id="test"></pre>
     18 <script class="testbody" type="text/javascript">
     19 
     20  var iframe;
     21  function runTest() {
     22    iframe = document.querySelector("iframe");
     23    iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/register.html";
     24    var ios;
     25    window.onmessage = function(e) {
     26      if (e.data.status == "ok") {
     27        ok(e.data.result, e.data.message);
     28      } else if (e.data.status == "registrationdone") {
     29        ios = SpecialPowers.Cc["@mozilla.org/network/io-service;1"]
     30                           .getService(SpecialPowers.Ci.nsIIOService);
     31        ios.offline = true;
     32        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/index.html";
     33      } else if (e.data.status == "done") {
     34        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth-sw.html";
     35      } else if (e.data.status == "done-synth-sw") {
     36        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth-window.html";
     37      } else if (e.data.status == "done-synth-window") {
     38        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/synth.html";
     39      } else if (e.data.status == "done-synth") {
     40        ios.offline = false;
     41        iframe.src = "https://example.com/tests/dom/serviceworkers/test/fetch/https/unregister.html";
     42      } else if (e.data.status == "unregistrationdone") {
     43        window.onmessage = null;
     44        ok(true, "Test finished successfully");
     45        SimpleTest.finish();
     46      }
     47    };
     48  }
     49 
     50  SimpleTest.waitForExplicitFinish();
     51  onload = function() {
     52    SpecialPowers.pushPrefEnv({"set": [
     53      ["dom.serviceWorkers.exemptFromPerDomainMax", true],
     54      ["dom.serviceWorkers.enabled", true],
     55      ["dom.serviceWorkers.testing.enabled", true],
     56    ]}, runTest);
     57  };
     58 </script>
     59 </pre>
     60 </body>
     61 </html>