summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/speculation-rules/prerender/resources/fetch-intercept-worker.js
blob: f6e056a8eb32a2af178e4503fec127328e648c7a (plain)
1
2
3
4
5
6
7
8
9
self.addEventListener('fetch', e => {
  if (e.request.url.includes('should-intercept')) {
    if (e.request.destination === 'document') {
      e.respondWith(fetch('./prerendered-page.html'));
    } else {
      e.respondWith(new Response('intercepted by service worker'));
    }
  }
});