diff options
author | hackademix | 2018-08-28 23:28:06 +0200 |
---|---|---|
committer | hackademix | 2018-08-28 23:28:06 +0200 |
commit | 5c3d5354f2aa3d9cc4ab7fcdf15c3350122851cb (patch) | |
tree | a44463a533753e84c04ec3c413f366b318932ad8 /src/content | |
parent | 9b32ee87946b4aff80114d4372a768ed1a9af887 (diff) | |
download | noscript-5c3d5354f2aa3d9cc4ab7fcdf15c3350122851cb.tar.gz noscript-5c3d5354f2aa3d9cc4ab7fcdf15c3350122851cb.tar.xz noscript-5c3d5354f2aa3d9cc4ab7fcdf15c3350122851cb.zip |
Reload-less service worker busting.
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/content.js | 10 |
1 files changed, 10 insertions, 0 deletions
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); } |