Index: chrome/ext/background.js |
=================================================================== |
--- a/chrome/ext/background.js |
+++ b/chrome/ext/background.js |
@@ -149,17 +149,17 @@ |
chrome.tabs.onRemoved.addListener(forgetTab); |
/* Browser actions */ |
var BrowserAction = function(tabId) |
{ |
this._tabId = tabId; |
- this._changes = null; |
+ this._changes = {}; |
}; |
BrowserAction.prototype = { |
_applyChanges: function() |
{ |
if ("iconPath" in this._changes) |
{ |
chrome.browserAction.setIcon({ |
tabId: this._tabId, |
@@ -181,17 +181,17 @@ |
if ("badgeColor" in this._changes) |
{ |
chrome.browserAction.setBadgeBackgroundColor({ |
tabId: this._tabId, |
color: this._changes.badgeColor |
}); |
} |
- this._changes = null; |
+ this._changes = {}; |
}, |
_queueChanges: function() |
{ |
chrome.tabs.get(this._tabId, function() |
{ |
// If the tab is prerendered, chrome.tabs.get() sets |
// chrome.runtime.lastError and we have to delay our changes |
// until the currently visible tab is replaced with the |
@@ -211,23 +211,18 @@ |
else |
{ |
this._applyChanges(); |
} |
}.bind(this)); |
}, |
_addChange: function(name, value) |
{ |
- if (!this._changes) |
- { |
- this._changes = {}; |
- this._queueChanges(); |
- } |
- |
this._changes[name] = value; |
+ this._queueChanges(); |
Sebastian Noack
2015/06/23 09:46:36
This will call chrome.tabs.get() redundantly if mu
|
}, |
setIcon: function(path) |
{ |
this._addChange("iconPath", path); |
}, |
setBadge: function(badge) |
{ |
if (!badge) |