summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/embed-and-object-are-not-intercepted-worker.js
blob: ffcdb7512888ffdb106e04ffa37f1b7b84b800e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// This worker intercepts a request for EMBED/OBJECT and responds with a
// response that indicates that interception occurred. The tests expect
// that interception does not occur.
self.addEventListener('fetch', e => {
    if (e.request.url.indexOf('embedded-content-from-server.html') != -1) {
      e.respondWith(fetch('embedded-content-from-service-worker.html'));
      return;
    }

    if (e.request.url.indexOf('green.png') != -1) {
      e.respondWith(Promise.reject('network error to show interception occurred'));
      return;
    }
  });