From b9b8f739a0775b7d700d845601fe3f918027e051 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 May 2015 03:22:23 -0600 Subject: [PATCH] Remove icon update coleascing --- src/js/async.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/js/async.js b/src/js/async.js index 8faf5886b..3147d5f4a 100644 --- a/src/js/async.js +++ b/src/js/async.js @@ -170,27 +170,27 @@ return asyncJobManager; /******************************************************************************/ // Update visual of extension icon. -// A time out is used to coalesce adjacent requests to update badge. -µBlock.updateBadgeAsync = (function(){ - var µb = µBlock; +µBlock.updateBadgeAsync = (function() { + var µb = µBlock, tabIdToUpdate; // Cache callback definition, it was a bad idea to define this one inside // updateBadgeAsync - var updateBadge = function(tabId) { - var pageStore = µb.pageStoreFromTabId(tabId); + var updateBadge = function() { + var pageStore = µb.pageStoreFromTabId(tabIdToUpdate); if ( pageStore ) { pageStore.updateBadge(); return; } - vAPI.setIcon(tabId, 'off', ''); + vAPI.setIcon(tabIdToUpdate, 'off', ''); }; var updateBadgeAsync = function(tabId) { if ( vAPI.isBehindTheSceneTabId(tabId) ) { return; } - µb.asyncJobs.add('updateBadge-' + tabId, tabId, updateBadge, 0); + tabIdToUpdate = tabId; + setTimeout(updateBadge, 0); }; return updateBadgeAsync;