tor-browser

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

add-routes.js (810B)


      1 let globalAddRoutes;
      2 let addRoutesError = {};
      3 
      4 self.addEventListener('install', event => {
      5  globalAddRoutes = event.addRoutes.bind(event);
      6  globalAddRoutes([
      7    {
      8      condition: { urlPattern: '/', runningStatus: 'not-running' },
      9      source: 'network',
     10    },
     11  ])
     12    .then(() => {
     13      addRoutesError.install = null;
     14  })
     15    .catch(error => {
     16      addRoutesError.install = error;
     17    });
     18 });
     19 
     20 self.addEventListener('activate', event => {
     21  globalAddRoutes([
     22    {
     23      condition: { urlPattern: '/', runningStatus: 'not-running' },
     24      source: 'network',
     25    },
     26  ])
     27    .then(() => {
     28      addRoutesError.activate = null;
     29    })
     30    .catch(error => {
     31      addRoutesError.activate = error;
     32    });
     33 });
     34 
     35 self.addEventListener('message', event => {
     36  event.ports[0].postMessage(addRoutesError);
     37 });