tor-browser

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

test_empty_serviceworker.html (1304B)


      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>Test that registering an empty service worker works</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 </div>
     16 <pre id="test"></pre>
     17 <script class="testbody" type="text/javascript">
     18 
     19  function runTest() {
     20    navigator.serviceWorker.ready.then(done);
     21    navigator.serviceWorker.register("empty.js", {scope: "."});
     22  }
     23 
     24  function done(registration) {
     25    ok(registration.waiting || registration.active, "registration worked");
     26    registration.unregister().then(function(success) {
     27      ok(success, "unregister worked");
     28      SimpleTest.finish();
     29    }, function(e) {
     30      dump("Unregistering the SW failed with " + e + "\n");
     31      SimpleTest.finish();
     32    });
     33  }
     34 
     35  SimpleTest.waitForExplicitFinish();
     36  onload = function() {
     37    SpecialPowers.pushPrefEnv({"set": [
     38      ["dom.serviceWorkers.exemptFromPerDomainMax", true],
     39      ["dom.serviceWorkers.enabled", true],
     40      ["dom.serviceWorkers.testing.enabled", true]
     41    ]}, runTest);
     42  };
     43 </script>
     44 </pre>
     45 </body>
     46 </html>