tor-browser

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

executor-service-worker.js (588B)


      1 importScripts('./dispatcher.js');
      2 
      3 const params = new URLSearchParams(location.search);
      4 const uuid = params.get('uuid');
      5 
      6 // The fetch handler must be registered before parsing the main script response.
      7 // So do it here, for future use.
      8 fetchHandler = () => {}
      9 addEventListener('fetch', e => {
     10  fetchHandler(e);
     11 });
     12 
     13 // Force ServiceWorker to immediately activate itself.
     14 addEventListener('install', event => {
     15  skipWaiting();
     16 });
     17 
     18 let executeOrders = async function() {
     19  while(true) {
     20    let task = await receive(uuid);
     21    eval(`(async () => {${task}})()`);
     22  }
     23 };
     24 executeOrders();