fetch-destination-worker-frame.js (752B)
1 self.addEventListener('fetch', function(event) { 2 if (event.request.url.includes('dummy')) { 3 event.waitUntil(async function() { 4 let destination = new URL(event.request.url).searchParams.get("dest"); 5 let clients = await self.clients.matchAll({"includeUncontrolled": true}); 6 clients.forEach(function(client) { 7 if (client.url.includes("fetch-destination-frame")) { 8 if (event.request.destination == destination) { 9 client.postMessage("PASS"); 10 } else { 11 client.postMessage("FAIL"); 12 } 13 } 14 }) 15 }()); 16 } 17 event.respondWith(fetch(event.request)); 18 });