From 140d8759cfe4a4bbaedcf9e7d4429e8cb889a3c9 Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 1 Aug 2018 17:47:57 +0200 Subject: Fixed startup race condition with pending request tracking. --- src/bg/RequestGuard.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3