tor-browser

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

worker_update.js (709B)


      1 // For now this test only calls update to verify that our registration
      2 // job queueing works properly when called from the worker thread. We should
      3 // test actual update scenarios with a SJS test.
      4 onmessage = function (e) {
      5  self.registration
      6    .update()
      7    .then(function (v) {
      8      return v instanceof ServiceWorkerRegistration ? "FINISH" : "FAIL";
      9    })
     10    .catch(function (ex) {
     11      return "FAIL";
     12    })
     13    .then(function (result) {
     14      clients.matchAll().then(function (c) {
     15        if (!c.length) {
     16          dump(
     17            "!!!!!!!!!!! WORKER HAS NO CLIENTS TO FINISH TEST !!!!!!!!!!!!\n"
     18          );
     19          return;
     20        }
     21 
     22        c[0].postMessage(result);
     23      });
     24    });
     25 };