From bc54179edd7895d3d41b1ab4de22d9ca3bd7031a Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 12 Apr 2023 10:55:00 -0400 Subject: [PATCH] More aggressively clear the unprocessed-request status Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2589 --- platform/common/vapi-background.js | 7 +++++-- src/js/messaging.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index cdfebfefd..2af01c204 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -1371,8 +1371,11 @@ vAPI.Net = class { return this.unprocessedTabs.size !== 0 && this.unprocessedTabs.has(tabId); } - removeUnprocessedRequest(tabId) { - this.unprocessedTabs.delete(tabId); + // https://github.com/uBlockOrigin/uBlock-issues/issues/2589 + // - Aggressively clear the unprocessed-request status of all tabs as + // soon as there is a call to clear for one tab. + removeUnprocessedRequest() { + this.unprocessedTabs.clear(); if ( this.unprocessedTabs.size !== 0 ) { return false; } this.suspendableListener = this.deferredSuspendableListener; this.deferredSuspendableListener = undefined; diff --git a/src/js/messaging.js b/src/js/messaging.js index 8565d24ce..779495141 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -499,7 +499,7 @@ const popupDataFromTabId = function(tabId, tabTitle) { tabId, tabTitle, tooltipsDisabled: µbus.tooltipsDisabled, - hasUnprocessedRequest: vAPI && vAPI.net.hasUnprocessedRequest(tabId), + hasUnprocessedRequest: vAPI.net && vAPI.net.hasUnprocessedRequest(tabId), }; if ( µbhs.uiPopupConfig !== 'unset' ) {