summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2018-08-01 17:47:57 +0200
committerhackademix2018-08-01 17:47:57 +0200
commit140d8759cfe4a4bbaedcf9e7d4429e8cb889a3c9 (patch)
tree95c34a82638c43ed44df2f8b12ac402878864668
parentbc834a034e20f6426cc8f7bd2f29109108e6179e (diff)
downloadnoscript-140d8759cfe4a4bbaedcf9e7d4429e8cb889a3c9.tar.gz
noscript-140d8759cfe4a4bbaedcf9e7d4429e8cb889a3c9.tar.xz
noscript-140d8759cfe4a4bbaedcf9e7d4429e8cb889a3c9.zip
Fixed startup race condition with pending request tracking.
-rw-r--r--src/bg/RequestGuard.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js
index 013f9b2..ca2038f 100644
--- a/src/bg/RequestGuard.js
+++ b/src/bg/RequestGuard.js
@@ -353,7 +353,7 @@ var RequestGuard = (() => {
!ns.isEnforced(request.tabId) ||
policy.can(url, policyType, originUrl);
Content.reportTo(request, allowed, policyType);
-
+
if (!allowed) {
debug(`Blocking ${policyType}`, request);
TabStatus.record(request, "blocked");
@@ -477,7 +477,8 @@ var RequestGuard = (() => {
);
debug("%s scriptBlocked=%s setting noscriptFrame on ", request.url, scriptBlocked, request.tabId, request.frameId);
TabStatus.record(request, "noscriptFrame", scriptBlocked);
- pendingRequests.get(request.requestId).scriptBlocked = scriptBlocked;
+ let pending = pendingRequests.get(request.requestId);
+ if (pending) pending.scriptBlocked = scriptBlocked;
},
onCompleted(request) {