diff options
author | hackademix | 2018-08-21 23:54:04 +0200 |
---|---|---|
committer | hackademix | 2018-08-21 23:54:04 +0200 |
commit | 1de1db3c29d11f49e130d44db359d1187f6c24a0 (patch) | |
tree | a59d10d32eeb0dcf9a6dfbac893b68af6fcc16d3 /src/content | |
parent | 91334fe94477fdbcb85fcf93d87e3c73294da106 (diff) | |
download | noscript-1de1db3c29d11f49e130d44db359d1187f6c24a0.tar.gz noscript-1de1db3c29d11f49e130d44db359d1187f6c24a0.tar.xz noscript-1de1db3c29d11f49e130d44db359d1187f6c24a0.zip |
Fixed possible surprises in background script message handling.
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/PlaceHolder.js | 2 | ||||
-rw-r--r-- | src/content/content.js | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/content/PlaceHolder.js b/src/content/PlaceHolder.js index d8c422b..764b7bc 100644 --- a/src/content/PlaceHolder.js +++ b/src/content/PlaceHolder.js @@ -117,7 +117,7 @@ var PlaceHolder = (() => { async enable(replacement) { debug("Enabling %o", this.request, this.policyType); let ok = await browser.runtime.sendMessage({ - type: "enable", + action: "enable", url: this.request.url, policyType: this.policyType, documentUrl: document.URL diff --git a/src/content/content.js b/src/content/content.js index 8f772b1..d5adc94 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -88,7 +88,7 @@ function probe() { try { debug("Probing execution..."); let s = document.createElement("script"); - s.textContent=";"; + s.textContent = ";"; document.documentElement.appendChild(s); s.remove(); } catch(e) { @@ -157,7 +157,7 @@ let notifyPage = async () => { debug("Page %s shown, %s", document.URL, document.readyState); if (document.readyState === "complete") { try { - await browser.runtime.sendMessage({type: "pageshow", seen: seen.list, canScript}); + await browser.runtime.sendMessage({action: "pageshow", seen: seen.list, canScript}); return true; } catch (e) { debug(e); @@ -184,7 +184,7 @@ async function init(oldPage = false) { document.URL, document.contentType, document.readyState, window.frameElement && frameElement.data); try { - ({canScript, shouldScript} = await browser.runtime.sendMessage({type: "docStatus", url: document.URL})); + ({canScript, shouldScript} = await browser.runtime.sendMessage({action: "docStatus", url: document.URL})); debug(`document %s, canScript=%s, shouldScript=%s, readyState %s`, document.URL, canScript, shouldScript, document.readyState); if (canScript) { if (oldPage) { |