chromium/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-img-element/resources/sw.js

addEventListener('install', (event) => {
  skipWaiting();
});

addEventListener('activate', (event) => {
  event.waitUntil(clients.claim());
});

async function broadcast(msg) {
  const allClients = await clients.matchAll();
  for (const client of allClients) {
    client.postMessage(msg);
  }
}

addEventListener('fetch', (event) => {
  event.waitUntil(
    broadcast({ url: event.request.url, mode: event.request.mode })
  )
});