tor-browser

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

xsl-base-url-worker.js (494B)


      1 self.addEventListener('fetch', event => {
      2  const url = new URL(event.request.url);
      3 
      4  // For the import-relative.xsl file, respond in a way that changes the
      5  // response URL. This is expected to change the base URL and allow the import
      6  // from the file to succeed.
      7  const path = 'request-url-path/import-relative.xsl';
      8  if (url.pathname.indexOf(path) != -1) {
      9    // Respond with a different URL, deleting "request-url-path/".
     10    event.respondWith(fetch('import-relative.xsl'));
     11  }
     12 });