From 35cb0eb3775ad1c8583b5486d1e8773c3b5a4615 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 7 Oct 2019 08:13:37 -0400 Subject: [PATCH] Do not bypass network listener in suspended mode Tabless network requests were bypassing uBO's onBeforeRequest's listener when in suspended mode. Suspend mode occurs during the time the filter lists are all reloaded. Regression from: - https://github.com/gorhill/uBlock/commit/1dfdc40e09fec95524331bfc4490f6f26c418182#diff-d04c15ee6bff6a6269c6aee25a7c7522R1122 --- platform/chromium/vapi-background.js | 3 +-- platform/firefox/vapi-webrequest.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 247d5c3cd..01dbb2b84 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -1157,11 +1157,10 @@ vAPI.Net = class { browser.webRequest.onBeforeRequest.addListener( details => { this.normalizeDetails(details); - if ( this.suspendDepth === 0 ) { + if ( this.suspendDepth === 0 || details.tabId < 0 ) { if ( this.suspendableListener === undefined ) { return; } return this.suspendableListener(details); } - if ( details.tabId < 0 ) { return; } return this.suspendOneRequest(details); }, this.denormalizeFilters({ urls: [ 'http://*/*', 'https://*/*' ] }), diff --git a/platform/firefox/vapi-webrequest.js b/platform/firefox/vapi-webrequest.js index 9bc4def66..b3c379a3e 100644 --- a/platform/firefox/vapi-webrequest.js +++ b/platform/firefox/vapi-webrequest.js @@ -115,7 +115,7 @@ resolve: undefined, promise: undefined }; - pending.promise = new Promise(function(resolve) { + pending.promise = new Promise(resolve => { pending.resolve = resolve; }); this.pendingRequests.push(pending);