Merge branch 'master' of https://github.com/hackademix/noscript
Merge pull request #17 from Lekensteyn/fix-serviceworker-check
This commit is contained in:
commit
87d3401c0b
|
@ -85,13 +85,13 @@ ns.on("capabilities", () => {
|
|||
|
||||
if (!ns.canScript) {
|
||||
|
||||
if (!!navigator.serviceWorker.controller) {
|
||||
if ("serviceWorker" in navigator && navigator.serviceWorker.controller) {
|
||||
addEventListener("beforescriptexecute", e => e.preventDefault());
|
||||
(async () => {
|
||||
for (let r of await navigator.serviceWorker.getRegistrations()) {
|
||||
await r.unregister();
|
||||
}
|
||||
})();
|
||||
(async () => {
|
||||
for (let r of await navigator.serviceWorker.getRegistrations()) {
|
||||
await r.unregister();
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
if (document.readyState !== "loading") onScriptDisabled();
|
||||
|
|
Loading…
Reference in New Issue