summaryrefslogtreecommitdiff
path: root/src/bg/RequestGuard.js
diff options
context:
space:
mode:
authorhackademix2018-08-23 22:55:26 +0200
committerhackademix2018-08-23 22:55:26 +0200
commit483fad9b8a2f8e5c6df6453dc66794922b311fc1 (patch)
tree2848ab25a554b49397ff1202bf9ee5b41e800764 /src/bg/RequestGuard.js
parentc2067c050918db33615bc81a092d634da16d79a0 (diff)
downloadnoscript-483fad9b8a2f8e5c6df6453dc66794922b311fc1.tar.gz
noscript-483fad9b8a2f8e5c6df6453dc66794922b311fc1.tar.xz
noscript-483fad9b8a2f8e5c6df6453dc66794922b311fc1.zip
Do not fail when onHeadersProcessed is called with no stored pending request.
Diffstat (limited to 'src/bg/RequestGuard.js')
-rw-r--r--src/bg/RequestGuard.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js
index 3cbc8e6..afadcda 100644
--- a/src/bg/RequestGuard.js
+++ b/src/bg/RequestGuard.js
@@ -369,12 +369,19 @@ var RequestGuard = (() => {
// check for duplicate calls
let pending = pendingRequests.get(request.requestId);
- if (pending && pending.headersProcessed) {
- debug("[WARNING] already processed ", request);
+ if (pending) {
+ if (pending.headersProcessed) {
+ debug("[WARNING] already processed ", request);
+ } else {
+ debug("onHeadersReceived", request);
+ }
+ } else {
+ debug("[WARNING] no pending information for ", request);
+ initPendingRequest(request);
+ pending = pendingRequests.get(request.requestId);
}
pending.headersProcessed = true;
- debug("onHeadersReceived", request);
let {url, documentUrl, statusCode, tabId, responseHeaders} = request;
try {