summaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorhackademix2018-08-30 17:26:13 +0200
committerhackademix2018-08-30 17:26:13 +0200
commit87d3401c0b9159fc88480cfbecf6959273de89bf (patch)
treea099ddce57ee59948a513e7ef63055f0e4ead0b0 /src/content
parent00444819fb9e6a3e417a2147bb66290740493b39 (diff)
parent379addaf3f3f20cfc9d3513c2ba4da099af1cade (diff)
downloadnoscript-87d3401c0b9159fc88480cfbecf6959273de89bf.tar.gz
noscript-87d3401c0b9159fc88480cfbecf6959273de89bf.tar.xz
noscript-87d3401c0b9159fc88480cfbecf6959273de89bf.zip
Merge branch 'master' of https://github.com/hackademix/noscript
Merge pull request #17 from Lekensteyn/fix-serviceworker-check
Diffstat (limited to 'src/content')
-rw-r--r--src/content/content.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/content/content.js b/src/content/content.js
index eb4fcdd..e73feb6 100644
--- a/src/content/content.js
+++ b/src/content/content.js
@@ -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();