summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bg/RequestGuard.js2
-rw-r--r--src/content/content.js18
-rw-r--r--src/manifest.json2
3 files changed, 14 insertions, 8 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js
index 8191f3e..688bcc0 100644
--- a/src/bg/RequestGuard.js
+++ b/src/bg/RequestGuard.js
@@ -269,7 +269,7 @@ var RequestGuard = (() => {
let records = TabStatus.map.get(tabId);
let noscriptFrames = records && records.noscriptFrames;
let canScript = !(noscriptFrames && noscriptFrames[sender.frameId]);
- let shouldScript = ns.isEnforced(tabId) && ns.policy.can(url, "script");
+ let shouldScript = !ns.isEnforced(tabId) || ns.policy.can(url, "script");
debug("Frame %s %s of %o, canScript: %s, shouldScript: %s", frameId, url, noscriptFrames, canScript, shouldScript);
return {canScript, shouldScript};
}
diff --git a/src/content/content.js b/src/content/content.js
index a2bb4d9..dd847f0 100644
--- a/src/content/content.js
+++ b/src/content/content.js
@@ -87,11 +87,15 @@ let notifyPage = () => {
}
var queryingCanScript = false;
-var caps = {};
+
+function reload(noCache = false) {
+ init = () => {};
+ location.reload(noCache);
+}
async function init(oldPage = false) {
if (queryingCanScript) return;
- if (document.URL === "about:blank") {
+ if (!document.URL.startsWith("http")) {
return;
}
queryingCanScript = true;
@@ -105,12 +109,13 @@ async function init(oldPage = false) {
if (canScript) {
if (oldPage) {
probe();
- setTimeout(() => init(), 100);
+ setTimeout(() => init(), 200);
return;
}
if (!shouldScript) {
// Something wrong: scripts can run, permissions say they shouldn't.
// Was webRequest bypassed by caching/session restore/service workers?
+ window.stop();
let noCache = !!navigator.serviceWorker.controller;
if (noCache) {
for (let r of await navigator.serviceWorker.getRegistrations()) {
@@ -118,7 +123,7 @@ async function init(oldPage = false) {
}
}
debug("Reloading %s (%s)", document.URL, noCache ? "no cache" : "cached");
- location.reload(noCache);
+ reload(noCache);
return;
}
}
@@ -129,7 +134,8 @@ async function init(oldPage = false) {
if (!oldPage &&
/Receiving end does not exist/.test(e.message)) {
// probably startup and bg page not ready yet, hence no CSP: reload!
- location.reload(false);
+ debug("Reloading", document.URL);
+ reload();
} else {
setTimeout(() => init(oldPage), 100);
}
@@ -162,4 +168,4 @@ async function init(oldPage = false) {
// document.write("<plaintext>");
}
notifyPage() || addEventListener("pageshow", notifyPage);
-};
+}
diff --git a/src/manifest.json b/src/manifest.json
index 76a8040..c395bba 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -8,7 +8,7 @@
"strict_min_version": "59.0"
}
},
- "version": "10.1.8.9rc4",
+ "version": "10.1.8.9rc5",
"description": "__MSG_Description__",
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'none'",