tor-browser

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

service-worker-update.html (1099B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/speculation-rules/prerender/resources/utils.js"></script>
      5 <script src="/speculation-rules/prerender/resources/deferred-promise-utils.js"></script>
      6 <body>
      7 <script type="module">
      8 
      9 const params = new URLSearchParams(location.search);
     10 const uid = params.get('uid');
     11 
     12 // The main test page (restriction-service-worker-update.https.html) loads the
     13 // initiator page, then the initiator page will prerender itself with the
     14 // `prerendering` parameter.
     15 const isPrerendering = params.has('prerendering');
     16 
     17 if (!isPrerendering) {
     18  loadInitiatorPage();
     19 } else {
     20  const registration =
     21      await navigator.serviceWorker.getRegistration(location.href);
     22 
     23  const prerenderEventCollector = new PrerenderEventCollector();
     24  const promise = registration.update()
     25      .then(registration => {
     26        prerenderEventCollector.addEvent('service worker updated');
     27      });
     28  prerenderEventCollector.start(
     29      promise, 'ServiceWorkerRegistration.update');
     30 }
     31 
     32 </script>
     33 </body>