Index: ext/background.js |
=================================================================== |
--- a/ext/background.js |
+++ b/ext/background.js |
@@ -322,43 +322,52 @@ |
this._tabId = tabId; |
this._changes = null; |
}; |
BrowserAction.prototype = { |
_applyChanges() |
{ |
if ("iconPath" in this._changes) |
{ |
- chrome.browserAction.setIcon({ |
- tabId: this._tabId, |
- path: { |
- 16: this._changes.iconPath.replace("$size", "16"), |
- 19: this._changes.iconPath.replace("$size", "19"), |
- 20: this._changes.iconPath.replace("$size", "20"), |
- 32: this._changes.iconPath.replace("$size", "32"), |
- 38: this._changes.iconPath.replace("$size", "38"), |
- 40: this._changes.iconPath.replace("$size", "40") |
- } |
- }); |
+ if ("setIcon" in chrome.browserAction) |
Wladimir Palant
2017/08/16 10:52:07
Here and below, maybe add a comment explaining whi
Manish Jethani
2017/08/16 11:45:42
Done.
|
+ { |
+ chrome.browserAction.setIcon({ |
+ tabId: this._tabId, |
+ path: { |
+ 16: this._changes.iconPath.replace("$size", "16"), |
+ 19: this._changes.iconPath.replace("$size", "19"), |
+ 20: this._changes.iconPath.replace("$size", "20"), |
+ 32: this._changes.iconPath.replace("$size", "32"), |
+ 38: this._changes.iconPath.replace("$size", "38"), |
+ 40: this._changes.iconPath.replace("$size", "40") |
+ } |
+ }); |
+ } |
} |
if ("badgeText" in this._changes) |
{ |
- chrome.browserAction.setBadgeText({ |
- tabId: this._tabId, |
- text: this._changes.badgeText |
- }); |
+ if ("setBadgeText" in chrome.browserAction) |
+ { |
+ chrome.browserAction.setBadgeText({ |
+ tabId: this._tabId, |
+ text: this._changes.badgeText |
+ }); |
+ } |
} |
if ("badgeColor" in this._changes) |
{ |
- chrome.browserAction.setBadgeBackgroundColor({ |
- tabId: this._tabId, |
- color: this._changes.badgeColor |
- }); |
+ if ("setBadgeBackgroundColor" in chrome.browserAction) |
+ { |
+ chrome.browserAction.setBadgeBackgroundColor({ |
+ tabId: this._tabId, |
+ color: this._changes.badgeColor |
+ }); |
+ } |
} |
this._changes = null; |
}, |
_queueChanges() |
{ |
chrome.tabs.get(this._tabId, () => |
{ |