diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index 63c31f38e..609750c47 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -890,7 +890,7 @@ if ( webext.browserAction instanceof Object ) { }); browserAction.setBadgeText({ text }); browserAction.setBadgeBackgroundColor({ - color: text === '!' ? '#FFCC00' : '#666' + color: text === '!' ? '#FC0' : '#666' }); }; } @@ -1252,7 +1252,6 @@ vAPI.Net = class { this.listenerMap = new WeakMap(); this.suspendDepth = 0; this.unprocessedTabs = new Map(); - this.processRequestStartTime = Number.MAX_SAFE_INTEGER; browser.webRequest.onBeforeRequest.addListener( details => { @@ -1335,7 +1334,6 @@ vAPI.Net = class { } return this.deferredSuspendableListener(details); }; - this.processRequestStartTime = Date.now(); } this.suspendableListener = listener; vAPI.setDefaultIcon('', ''); @@ -1371,9 +1369,7 @@ vAPI.Net = class { } hasUnprocessedRequest(tabId) { if ( this.unprocessedTabs.size === 0 ) { return false; } - if ( (Date.now() - this.processRequestStartTime) > 60000 ) { - this.removeUnprocessedRequest(); - } + if ( tabId === undefined ) { return true; } return this.unprocessedTabs.has(tabId); } removeUnprocessedRequest(tabId) { diff --git a/src/js/traffic.js b/src/js/traffic.js index 1ec48e780..a3ac407ab 100644 --- a/src/js/traffic.js +++ b/src/js/traffic.js @@ -982,7 +982,7 @@ const injectCSP = function(fctxt, pageStore, responseHeaders) { if ( cspSubsets.length === 0 ) { return; } - µb.updateToolbarIcon(fctxt.tabId, 0x02); + µb.updateToolbarIcon(fctxt.tabId, 0b0010); // Use comma to merge CSP directives. // Ref.: https://www.w3.org/TR/CSP2/#implementation-considerations @@ -1133,6 +1133,14 @@ const webRequest = { urls: [ 'http://*/*', 'https://*/*' ] } ); + vAPI.defer.once({ min: 1 }).then(( ) => { + if ( vAPI.net.hasUnprocessedRequest() === false ) { return; } + vAPI.net.removeUnprocessedRequest(); + vAPI.tabs.getCurrent().then(tab => { + if ( tab === null ) { return; } + µb.updateToolbarIcon(tab.id, 0b0110); + }); + }); vAPI.net.unsuspend({ all: true }); }; })(),