From d45209060fe4c03c37a3d0e3211e4d30a4beae14 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sat, 28 Jul 2018 02:19:48 +0200 Subject: Fixed window.stop() called in empty suframes. --- src/bg/RequestGuard.js | 5 +++-- src/content/content.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js index d13bf4b..e17d997 100644 --- a/src/bg/RequestGuard.js +++ b/src/bg/RequestGuard.js @@ -266,12 +266,13 @@ var RequestGuard = (() => { return true; } case "canScript": { - let {frameId, url, tab} = sender; + let {frameId, tab} = sender; + let {url} = message; let tabId = tab.id; 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) || !url.startsWith("http") || 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 aea705e..b5905c8 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -104,7 +104,7 @@ async function init(oldPage = false) { document.URL, document.contentType, document.readyState, window.frameElement && frameElement.data); try { - let {canScript, shouldScript} = await browser.runtime.sendMessage({type: "canScript"}); + let {canScript, shouldScript} = await browser.runtime.sendMessage({type: "canScript", url: document.URL}); debug(`document %s, canScript=%s, shouldScript=%s, readyState %s`, document.URL, canScript, shouldScript, document.readyState); if (canScript) { if (oldPage) { -- cgit v1.2.3