tor-browser

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

doc_network-observer-missing-service-worker.html (1086B)


      1 <!-- Any copyright is dedicated to the Public Domain.
      2     http://creativecommons.org/publicdomain/zero/1.0/ -->
      3 <!doctype html>
      4 <html>
      5  <head>
      6    <meta charset="utf-8" />
      7    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
      8    <meta http-equiv="Pragma" content="no-cache" />
      9    <meta http-equiv="Expires" content="0" />
     10    <title>Network Observer missing service worker test page</title>
     11  </head>
     12 
     13  <body>
     14    <p>Network Observer test page</p>
     15    <script type="text/javascript">
     16      /* exported registerServiceWorker */
     17      "use strict";
     18 
     19      function registerServiceWorker() {
     20        const sw = navigator.serviceWorker;
     21        // NOTE: This service worker file does not exist which enables testing
     22        // that a 404 requests is received.
     23        return sw.register("serviceworker-missing.js")
     24          .then(() => {
     25            throw new Error("The Service Worker file should not exist");
     26          }).catch(() => {
     27            console.log("Registration failed as expected");
     28          });
     29      }
     30    </script>
     31  </body>
     32 </html>