tor-browser

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

test_bug1408734.html (1614B)


      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 1408734</title>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     11  <script src="error_reporting_helpers.js"></script>
     12  <script src="utils.js"></script>
     13 </head>
     14 <body>
     15 <p id="display"></p>
     16 <div id="content" style="display: none"></div>
     17 <pre id="test"></pre>
     18 <script class="testbody" type="text/javascript">
     19 
     20 // setup prefs
     21 add_task(() => {
     22  return SpecialPowers.pushPrefEnv({"set": [
     23    ["dom.serviceWorkers.enabled", true],
     24    ["dom.serviceWorkers.testing.enabled", true],
     25  ]});
     26 });
     27 
     28 // test for bug 1408734
     29 add_task(async () => {
     30  // register a service worker
     31  let registration = await navigator.serviceWorker.register("fetch.js",
     32                                                            {scope: "./"});
     33  // wait for service worker be activated
     34  await waitForState(registration.installing, "activated");
     35 
     36  // get the ServiceWorkerRegistration we just register through GetRegistration
     37  registration = await navigator.serviceWorker.getRegistration("./");
     38  ok(registration, "should get the registration under scope './'");
     39 
     40  // call unregister()
     41  await registration.unregister();
     42 
     43  // access registration.updateViaCache to trigger the bug
     44  // we really care that we don't crash. In the future we will fix
     45  is(registration.updateViaCache, "imports",
     46     "registration.updateViaCache should work after unregister()");
     47 });
     48 
     49 </script>
     50 </pre>
     51 </body>
     52 </html>