From 39cac612c23321845c0a3c48f539faf23abd21a7 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 15 Mar 2023 21:13:28 -0400 Subject: [PATCH] Use the warning toolbar icon only if unprocessed requests Related discussion: - https://github.com/uBlockOrigin/uAssets/discussions/16939 Related commit: - https://github.com/gorhill/uBlock/commit/0c9576d3e609d3bc43ed5468ec4a8eb017642ad8 --- platform/common/vapi-background.js | 6 ++++++ src/js/start.js | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index 05a2251af..899abc752 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -1231,10 +1231,16 @@ vAPI.Net = class { if ( this.suspendableListener !== undefined ) { return this.suspendableListener(details); } + if ( this.unprocessedRequestCount === 0 ) { + vAPI.setDefaultIcon('-loading'); + } this.unprocessedRequestCount += 1; } setSuspendableListener(listener) { this.suspendableListener = listener; + if ( this.unprocessedRequestCount !== 0 ) { + vAPI.setDefaultIcon(''); + } } removeListener(which, clientListener) { const actualListener = this.listenerMap.get(clientListener); diff --git a/src/js/start.js b/src/js/start.js index 52ab743e8..86fab7383 100644 --- a/src/js/start.js +++ b/src/js/start.js @@ -29,8 +29,6 @@ import './vapi-common.js'; import './vapi-background.js'; import './vapi-background-ext.js'; -vAPI.setDefaultIcon('-loading'); // Do this as soon as possible - /******************************************************************************/ // The following modules are loaded here until their content is better organized @@ -462,8 +460,6 @@ if ( selfieIsValid !== true ) { // This can be used to defer filtering decision-making. µb.readyToFilter = true; -vAPI.setDefaultIcon(''); - // Start network observers. webRequest.start();