I can't get browser.browserAction.setIcon
to work in Microsoft Edge when manifest.json
is specifying a default icon in multiple sizes:
manifest.json
{
"manifest_version": 2,
"name": "test",
"version": "0.0.1",
"author": "John Doe",
"background": {
"scripts": ["background.js"],
"persistent": false
},
"browser_action": {
"default_icon": {
"19": "icon.png",
"38": "icon2.png"
}
}
}
background.js
setInterval(function() {
browser.browserAction.setIcon({
path: "testimage.png"
});
}, 2000);
No error logged, the code is executed but the icon doesn't change. The same code works fine in Chrome.
Changing the manifest.json to
"browser_action": {
"default_icon": "icon.png"
}
Fixes the issue, but what if I need to use multiple default icons?
EDIT:
Unfortunately not even "default_icon": "icon.png"
is usable, even though Edge happily loads the extension, when submitting it to the store, the validation fails with
Validation failed: Invalid type: string (expected object) Schema location: /properties/browser_action/allOf/0/properties/default_icon/type Manifest location: /browser_action/default_icon Validation failed for extension manifest: Extension\manifest.json
Which is indeed what MDN says: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/browser_action#Browser_compatibility
'default_icon' must be an object, with explicit sizes.