Index: ext/background.js |
=================================================================== |
--- a/ext/background.js |
+++ b/ext/background.js |
@@ -343,17 +343,33 @@ |
// https://bugzilla.mozilla.org/show_bug.cgi?id=1331746 |
if ("setIcon" in chrome.browserAction) |
{ |
- 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") |
- } |
- }); |
+ try |
+ { |
+ 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") |
+ } |
+ }); |
+ } |
+ catch (e) |
+ { |
+ // Edge throws if passed icon sizes different than 19,20,38,40px. |
+ chrome.browserAction.setIcon({ |
+ tabId: this._tabId, |
+ path: { |
+ 19: this._changes.iconPath.replace("$size", "19"), |
+ 20: this._changes.iconPath.replace("$size", "20"), |
+ 38: this._changes.iconPath.replace("$size", "38"), |
+ 40: this._changes.iconPath.replace("$size", "40") |
+ } |
+ }); |
+ } |
Sebastian Noack
2017/09/27 21:00:40
We can avoid duplication here:
let path = {
|
} |
} |