diff options
author | gorhill <rhill@raymondhill.net> | 2015-05-02 00:13:19 -0400 |
---|---|---|
committer | gorhill <rhill@raymondhill.net> | 2015-05-02 00:13:19 -0400 |
commit | 5f4d97596698b32763b54d50d5c75cc989148fb5 (patch) | |
tree | 1531515650de564510a6bcf431ee3e58f193b2f0 | |
parent | b5db231ef97126abeff9b3f3840e2800af6f2fdc (diff) | |
download | uBlock-5f4d97596698b32763b54d50d5c75cc989148fb5.zip uBlock-5f4d97596698b32763b54d50d5c75cc989148fb5.tar.gz uBlock-5f4d97596698b32763b54d50d5c75cc989148fb5.tar.bz2 |
code review
-rw-r--r-- | platform/chromium/manifest.json | 4 | ||||
-rw-r--r-- | platform/chromium/vapi-background.js | 3 | ||||
-rw-r--r-- | src/js/async.js | 28 |
3 files changed, 17 insertions, 18 deletions
diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index 1ae78f5..ab646d2 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -13,8 +13,8 @@ "browser_action": { "default_icon": { - "19": "img/browsericons/icon19-off.png", - "38": "img/browsericons/icon38-off.png" + "19": "img/browsericons/icon19.png", + "38": "img/browsericons/icon38.png" }, "default_title": "uBlock Origin", "default_popup": "popup.html" diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 98ee10f..decab19 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -747,8 +747,7 @@ vAPI.onLoadAllCompleted = function() { } }; - chrome.tabs.query({ url: 'http://*/*' }, bindToTabs); - chrome.tabs.query({ url: 'https://*/*' }, bindToTabs); + chrome.tabs.query({ url: '<all_urls>' }, bindToTabs); }; /******************************************************************************/ diff --git a/src/js/async.js b/src/js/async.js index c86fc8c..b30678c 100644 --- a/src/js/async.js +++ b/src/js/async.js @@ -172,32 +172,32 @@ return asyncJobManager; // Update visual of extension icon. µBlock.updateBadgeAsync = (function() { - var µb = µBlock; - var tabIdToTimer = {}; + var tabIdToTimer = Object.create(null); var updateBadge = function(tabId) { delete tabIdToTimer[tabId]; - var pageStore = µb.pageStoreFromTabId(tabId); - if ( pageStore === null ) { - return; - } - - var netFiltering = pageStore.getNetFilteringSwitch(); + var state = false; var badge = ''; - if ( µb.userSettings.showIconBadge && netFiltering && pageStore.perLoadBlockedRequestCount ) { - badge = µb.utils.formatCount(pageStore.perLoadBlockedRequestCount); + + var pageStore = this.pageStoreFromTabId(tabId); + if ( pageStore !== null ) { + state = pageStore.getNetFilteringSwitch(); + if ( state && this.userSettings.showIconBadge && pageStore.perLoadBlockedRequestCount ) { + badge = this.utils.formatCount(pageStore.perLoadBlockedRequestCount); + } } - vAPI.setIcon(tabId, netFiltering ? 'on' : 'off', badge); + + vAPI.setIcon(tabId, state ? 'on' : 'off', badge); }; return function(tabId) { - if ( vAPI.isBehindTheSceneTabId(tabId) ) { + if ( tabIdToTimer[tabId] ) { return; } - if ( tabIdToTimer.hasOwnProperty(tabId) ) { + if ( vAPI.isBehindTheSceneTabId(tabId) ) { return; } - tabIdToTimer[tabId] = setTimeout(updateBadge.bind(null, tabId), 500); + tabIdToTimer[tabId] = setTimeout(updateBadge.bind(this, tabId), 500); }; })(); |