tor-browser

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

intercept_media_sw.js (514B)


      1 'use strict';
      2 
      3 self.addEventListener('fetch', event => {
      4  if (event.request.url.indexOf('fetch_video.py') !== -1) {
      5    // A no-cors media range request /should not/ be intercepted.
      6    // Respond with some text to cause an error.
      7    event.respondWith(new Response('intercepted'));
      8  }
      9  else if (event.request.url.indexOf('blank.html') !== -1) {
     10    // A no-cors media non-range request /should/ be intercepted.
     11    // Respond with an image to avoid an error.
     12    event.respondWith(fetch('green.png'));
     13  }
     14 });