summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-07-28 09:10:31 +0200
committerhackademix2018-07-28 09:10:31 +0200
commitfdf4ff3a39ae1bfd4fdc9f009db612a2bec549d4 (patch)
treea5d17909d0c464cf5de6efbfc942b87f874d9d66
parentd39f68cb88b35d1b457ca0dcb5ce993ec5303c2a (diff)
downloadnoscript-fdf4ff3a39ae1bfd4fdc9f009db612a2bec549d4.tar.gz
noscript-fdf4ff3a39ae1bfd4fdc9f009db612a2bec549d4.tar.xz
noscript-fdf4ff3a39ae1bfd4fdc9f009db612a2bec549d4.zip
Fixed regression in NOSCRIPT elements emulation.
-rw-r--r--src/bg/RequestGuard.js2
-rw-r--r--src/content/content.js15
2 files changed, 8 insertions, 9 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js
index e17d997..013f9b2 100644
--- a/src/bg/RequestGuard.js
+++ b/src/bg/RequestGuard.js
@@ -265,7 +265,7 @@ var RequestGuard = (() => {
}
return true;
}
- case "canScript": {
+ case "docStatus": {
let {frameId, tab} = sender;
let {url} = message;
let tabId = tab.id;
diff --git a/src/content/content.js b/src/content/content.js
index dec067d..3560e57 100644
--- a/src/content/content.js
+++ b/src/content/content.js
@@ -2,7 +2,7 @@
// debug = () => {}; // XPI_ONLY
-var canScript = true;
+var canScript = true, shouldScript = false;
function createHTMLElement(name) {
return document.createElementNS("http://www.w3.org/1999/xhtml", name);
@@ -86,7 +86,7 @@ let notifyPage = () => {
return false;
}
-var queryingCanScript = false;
+var queryingStatus = false;
function reload(noCache = false) {
init = () => {};
@@ -94,17 +94,17 @@ function reload(noCache = false) {
}
async function init(oldPage = false) {
- if (queryingCanScript) return;
+ if (queryingStatus) return;
if (!document.URL.startsWith("http")) {
return;
}
- queryingCanScript = true;
+ queryingStatus = true;
debug(`init() called in document %s, contentType %s readyState %s, frameElement %o`,
document.URL, document.contentType, document.readyState, window.frameElement && frameElement.data);
try {
- let {canScript, shouldScript} = await browser.runtime.sendMessage({type: "canScript", url: document.URL});
+ ({canScript, shouldScript} = await browser.runtime.sendMessage({type: "docStatus", url: document.URL}));
debug(`document %s, canScript=%s, shouldScript=%s, readyState %s`, document.URL, canScript, shouldScript, document.readyState);
if (canScript) {
if (oldPage) {
@@ -127,10 +127,9 @@ async function init(oldPage = false) {
return;
}
}
- window.canScript = canScript;
init = () => {};
} catch (e) {
- debug("Error querying canScript", e);
+ debug("Error querying docStatus", e);
if (!oldPage &&
/Receiving end does not exist/.test(e.message)) {
// probably startup and bg page not ready yet, hence no CSP: reload!
@@ -141,7 +140,7 @@ async function init(oldPage = false) {
}
return;
} finally {
- queryingCanScript = false;
+ queryingStatus = false;
}
if (!canScript) onScriptDisabled();