tor-browser

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

status-codes.html (1916B)


      1 <!-- Any copyright is dedicated to the Public Domain.
      2     http://creativecommons.org/publicdomain/zero/1.0/ -->
      3 
      4 <!doctype html>
      5 
      6 <html>
      7  <head>
      8    <meta charset="utf-8"/>
      9    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
     10    <meta http-equiv="Pragma" content="no-cache" />
     11    <meta http-equiv="Expires" content="0" />
     12    <title>Network Monitor test page</title>
     13  </head>
     14 
     15  <body>
     16    <p>Status codes test</p>
     17 
     18    <script type="text/javascript">
     19      /* exported registerServiceWorker, unregisterServiceWorker, performRequests */
     20      "use strict";
     21 
     22      let swRegistration;
     23 
     24      function registerServiceWorker() {
     25        const sw = navigator.serviceWorker;
     26        return sw.register("status-codes-service-worker.js")
     27          .then(registration => {
     28            swRegistration = registration;
     29            console.log("Registered, scope is:", registration.scope);
     30            return sw.ready;
     31          }).then(() => {
     32            // wait until the page is controlled
     33            return new Promise(resolve => {
     34              if (sw.controller) {
     35                resolve();
     36              } else {
     37                sw.addEventListener("controllerchange", function() {
     38                  resolve();
     39                }, {once: true});
     40              }
     41            });
     42          }).catch(() => {
     43            console.error("Registration failed");
     44          });
     45      }
     46 
     47      function unregisterServiceWorker() {
     48        return swRegistration.unregister();
     49      }
     50 
     51      function performRequests() {
     52        return Promise.all(
     53          [
     54            fetch("sjs_content-type-test-server.sjs?sts=304&fmt=html"),
     55            fetch("sjs_content-type-test-server.sjs?sts=304&fmt=css"),
     56            fetch("sjs_content-type-test-server.sjs?sts=304&fmt=js"),
     57            fetch("test-image.png?v=" + Math.random())
     58          ]
     59        );
     60      }
     61    </script>
     62  </body>
     63 
     64 </html>