tor-browser

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

sw-abort.js (503B)


      1 importScripts('sw-helpers.js');
      2 
      3 async function getFetchResult(record) {
      4  try {
      5    await record.responseReady;
      6  } catch (e) {
      7    return {
      8      response: false,
      9      name: e.name,
     10    };
     11  }
     12 
     13  return {
     14    response: true,
     15  };
     16 }
     17 self.addEventListener('backgroundfetchabort', event => {
     18  event.waitUntil(
     19    event.registration.matchAll()
     20      .then(records =>
     21            Promise.all(records.map(record => getFetchResult(record))))
     22      .then(results => sendMessageToDocument({results})));
     23 });