// Tombstone for the old SW routing probe, which registered here with scope "/demo/". // Chrome gives a page to the registration with the longest matching scope, so that // probe controlled every page under /demo/ instead of the runtime's "/" worker, and // every /~/ module fetch 404ed. (slopbox, the local shell for these demo apps, used to // live under /demo/ and was affected too; it now runs as its own package, // examples/slopbox, on its own server, so this probe's old scope can never reach it.) // The probe now lives in /demo/sw-probe/. // A browser that still has the old registration fetches this script on its next // navigation under /demo/, installs it, and it removes itself and reloads its pages // so they fall back to the runtime's worker. self.addEventListener("install", () => self.skipWaiting()); self.addEventListener("activate", (event) => { event.waitUntil((async () => { await self.registration.unregister(); const pages = await self.clients.matchAll({ type: "window" }); for (const page of pages) page.navigate(page.url); })()); });