tor-browser

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

notificationclose.serviceworker.js (890B)


      1 // Any copyright is dedicated to the Public Domain.
      2 // http://creativecommons.org/publicdomain/zero/1.0/
      3 
      4 onnotificationclose = function (e) {
      5  e.waitUntil(
      6    (async function () {
      7      let windowOpened = true;
      8      await clients.openWindow("blank.html").catch(() => {
      9        windowOpened = false;
     10      });
     11 
     12      self.clients.matchAll().then(function (matchedClients) {
     13        if (matchedClients.length === 0) {
     14          dump("*** CLIENTS LIST EMPTY! Test will timeout! ***\n");
     15          return;
     16        }
     17 
     18        matchedClients.forEach(function (client) {
     19          client.postMessage({
     20            result:
     21              e.notification.data &&
     22              e.notification.data.complex &&
     23              e.notification.data.complex[0] == "jsval" &&
     24              e.notification.data.complex[1] == 5,
     25            windowOpened,
     26          });
     27        });
     28      });
     29    })()
     30  );
     31 };