embed-and-object-are-not-intercepted-worker.js (552B)
1 // This worker intercepts a request for EMBED/OBJECT and responds with a 2 // response that indicates that interception occurred. The tests expect 3 // that interception does not occur. 4 self.addEventListener('fetch', e => { 5 if (e.request.url.indexOf('embedded-content-from-server.html') != -1) { 6 e.respondWith(fetch('embedded-content-from-service-worker.html')); 7 return; 8 } 9 10 if (e.request.url.indexOf('green.png') != -1) { 11 e.respondWith(Promise.reject('network error to show interception occurred')); 12 return; 13 } 14 });