1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-29 06:07:11 +02:00

Chrome: browserAction-related code-review

This commit is contained in:
Chris 2015-05-01 04:43:43 -06:00
parent 84aad79ad7
commit c2741e07f0

View File

@ -86,6 +86,9 @@ vAPI.noTabId = '-1';
/******************************************************************************/ /******************************************************************************/
// https://github.com/gorhill/uBlock/issues/101
// chrome API expects tab id to be a number, not a string.
var toChromiumTabId = function(tabId) { var toChromiumTabId = function(tabId) {
if ( typeof tabId === 'string' ) { if ( typeof tabId === 'string' ) {
tabId = parseInt(tabId, 10); tabId = parseInt(tabId, 10);
@ -797,8 +800,8 @@ vAPI.onLoadAllCompleted = function() {
chrome.browserAction.setIcon = function(x, callback) { chrome.browserAction.setIcon = function(x, callback) {
this._setIcon({path: x.path[19], tabId: x.tabId}, callback); this._setIcon({path: x.path[19], tabId: x.tabId}, callback);
}; };
// maybe this time... I'll win! // maybe this time... I'll win
chrome.browserAction.setIcon({ path: iconPaths }); chrome.browserAction.setIcon({ path: ICON_PATHS.off });
} }
chrome.tabs.query({ url: 'http://*/*' }, bindToTabs); chrome.tabs.query({ url: 'http://*/*' }, bindToTabs);