From 483fad9b8a2f8e5c6df6453dc66794922b311fc1 Mon Sep 17 00:00:00 2001 From: hackademix Date: Thu, 23 Aug 2018 22:55:26 +0200 Subject: Do not fail when onHeadersProcessed is called with no stored pending request. --- src/bg/RequestGuard.js | 13 ++++++++++--- 1 file 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 { -- cgit v1.2.3