From 5c3d5354f2aa3d9cc4ab7fcdf15c3350122851cb Mon Sep 17 00:00:00 2001 From: hackademix Date: Tue, 28 Aug 2018 23:28:06 +0200 Subject: Reload-less service worker busting. --- src/content/content.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/content/content.js') diff --git a/src/content/content.js b/src/content/content.js index c7fc045..eb4fcdd 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -84,6 +84,16 @@ ns.on("capabilities", () => { }); if (!ns.canScript) { + + if (!!navigator.serviceWorker.controller) { + addEventListener("beforescriptexecute", e => e.preventDefault()); + (async () => { + for (let r of await navigator.serviceWorker.getRegistrations()) { + await r.unregister(); + } + })(); + } + if (document.readyState !== "loading") onScriptDisabled(); window.addEventListener("DOMContentLoaded", onScriptDisabled); } -- cgit v1.2.3