From bc834a034e20f6426cc8f7bd2f29109108e6179e Mon Sep 17 00:00:00 2001 From: hackademix Date: Sat, 28 Jul 2018 23:55:27 +0200 Subject: Fixed updating NoScript reloads tabs with revoked temporary permissions. --- src/content/content.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/content/content.js b/src/content/content.js index 9f89a65..222cc05 100644 --- a/src/content/content.js +++ b/src/content/content.js @@ -3,7 +3,9 @@ // debug = () => {}; // XPI_ONLY var canScript = true, shouldScript = false; - + +let now = () => performance.now() + performance.timeOrigin; + function createHTMLElement(name) { return document.createElementNS("http://www.w3.org/1999/xhtml", name); } @@ -117,7 +119,9 @@ async function init(oldPage = false) { setTimeout(() => init(), 200); return; } - if (!shouldScript) { + if (!shouldScript && + (document.readyState !== "complete" || + now() - performance.timing.domContentLoadedEvenStart < 5000)) { // Something wrong: scripts can run, permissions say they shouldn't. // Was webRequest bypassed by caching/session restore/service workers? window.stop(); -- cgit v1.2.3