Browse Source

code review

pull/2/head
gorhill 10 years ago
parent
commit
dbe14694c8
  1. 2
      platform/chromium/manifest.json
  2. 9
      src/js/async.js

2
platform/chromium/manifest.json

@ -10,7 +10,7 @@
}, },
"browser_action": { "browser_action": {
"default_icon": { "default_icon": {
"19": "img/browsericons/icon19-off.png"
"19": "img/browsericons/icon19-19.png"
}, },
"default_title": "µMatrix", "default_title": "µMatrix",
"default_popup": "popup.html" "default_popup": "popup.html"

9
src/js/async.js

@ -142,13 +142,11 @@ return asyncJobManager;
var updateBadge = function(tabId) { var updateBadge = function(tabId) {
delete tabIdToTimer[tabId]; delete tabIdToTimer[tabId];
var pageStore = this.pageStoreFromTabId(tabId);
if ( pageStore === null ) {
return;
}
var iconId = null; var iconId = null;
var badgeStr = ''; var badgeStr = '';
var pageStore = this.pageStoreFromTabId(tabId);
if ( pageStore !== null ) {
var total = pageStore.perLoadAllowedRequestCount + var total = pageStore.perLoadAllowedRequestCount +
pageStore.perLoadBlockedRequestCount; pageStore.perLoadBlockedRequestCount;
if ( total ) { if ( total ) {
@ -157,6 +155,7 @@ return asyncJobManager;
iconId = greenSize < squareSize/2 ? Math.ceil(greenSize) : Math.floor(greenSize); iconId = greenSize < squareSize/2 ? Math.ceil(greenSize) : Math.floor(greenSize);
badgeStr = this.formatCount(pageStore.distinctRequestCount); badgeStr = this.formatCount(pageStore.distinctRequestCount);
} }
}
vAPI.setIcon(tabId, iconId, badgeStr); vAPI.setIcon(tabId, iconId, badgeStr);
}; };

Loading…
Cancel
Save