diff options
author | hackademix | 2018-07-26 23:23:11 +0200 |
---|---|---|
committer | hackademix | 2018-07-26 23:48:20 +0200 |
commit | 21810063d0851fb88623d0458fa4fc2cd054b0db (patch) | |
tree | 1fb30dd82c8c82e4cd9e9dd717efcc2b3131b224 /src/bg/RequestUtil.js | |
parent | 4e62643b33e0f3a7653ae94cda34c7d6ace52097 (diff) | |
download | noscript-21810063d0851fb88623d0458fa4fc2cd054b0db.tar.gz noscript-21810063d0851fb88623d0458fa4fc2cd054b0db.tar.xz noscript-21810063d0851fb88623d0458fa4fc2cd054b0db.zip |
Disable scripting in HTML-embedding objects where webglHook cannot run, if webgl not allowed.
Diffstat (limited to 'src/bg/RequestUtil.js')
-rw-r--r-- | src/bg/RequestUtil.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/bg/RequestUtil.js b/src/bg/RequestUtil.js index 690d7ba..a5af09e 100644 --- a/src/bg/RequestUtil.js +++ b/src/bg/RequestUtil.js @@ -24,14 +24,13 @@ let scripts = pendingScripts.get(requestId); if (!scripts) return -1; pendingScripts.delete(requestId); - - let where = type === "object" ? {allFrames: true} : {frameId}; let count = 0; let run = async details => { details = Object.assign({ runAt: "document_start", matchAboutBlank: true, - }, details, where); + frameId + }, details); try { let res; for (let attempts = 10; attempts-- > 0;) { @@ -49,17 +48,14 @@ error(e, "Execute on start failed", url, details); } }; - - await run({code: `void(window.correctFrame = () => "${url}" === document.URL && document.readyState === "loading")`}); await Promise.all([...scripts.values()].map(run)); - await run({code: `void(window.correctFrame = () => false)`}); return count; }; { let filter = { urls: ["<all_urls>"], - types: ["main_frame", "sub_frame", "object"] + types: ["main_frame", "sub_frame"] }; let wr = browser.webRequest; for (let event of ["onCompleted", "onErrorOccurred"]) { @@ -81,7 +77,7 @@ executeOnStart(request, details) { let {requestId, url, tabId, frameId, statusCode, type} = request; - if (statusCode >= 300 && statusCode < 400) return; + if (statusCode >= 300 && statusCode < 400 || type === "object") return; if (frameId === 0) { let key = tabKey(tabId, url); debug("Checking whether %s is a reloading tab...", key); |