summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-07-28 23:55:27 +0200
committerhackademix2018-08-01 17:32:16 +0200
commitbc834a034e20f6426cc8f7bd2f29109108e6179e (patch)
tree7825a8327c5123f93c74bf705a71d1e7085cc655
parenta283ea1575f62337ccf6293e2e9121773c22556e (diff)
downloadnoscript-bc834a034e20f6426cc8f7bd2f29109108e6179e.tar.gz
noscript-bc834a034e20f6426cc8f7bd2f29109108e6179e.tar.xz
noscript-bc834a034e20f6426cc8f7bd2f29109108e6179e.zip
Fixed updating NoScript reloads tabs with revoked temporary permissions.
-rw-r--r--src/content/content.js8
1 files changed, 6 insertions, 2 deletions
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();