Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: ext/background.js

Issue 29557724: Issue 4699 - Edge does not support 16px and 32px icons (Closed)
Patch Set: Remove the code duplication Created Sept. 27, 2017, 9:58 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ext/background.js
===================================================================
--- a/ext/background.js
+++ b/ext/background.js
@@ -343,17 +343,25 @@
// 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")
- }
- });
+ let 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});
+ }
+ catch (e)
+ {
+ // Edge throws if passed icon sizes different than 19,20,38,40px.
+ delete path[16];
+ delete path[32];
+ chrome.browserAction.setIcon({tabId: this._tabId, path});
+ }
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld