Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Extension API: chrome.browserAction.setIcon assumes a relative path #8344

Closed
jonathansampson opened this issue Apr 15, 2017 · 1 comment
Closed
Labels
feature/extensions fixed-with-brave-core This issue will automatically resolved with the replacement of Muon with Brave Core. wontfix

Comments

@jonathansampson
Copy link
Collaborator

jonathansampson commented Apr 15, 2017

https://developer.chrome.com/extensions/browserAction#method-setIcon

Brave presently assumes that values coming in from chrome.browserAction.setIcon will have relative paths. (Also worth noting that Brave assumes the path is either a string, or an object with properties 19 and 38. If neither assumption is true, no icon is showed.)

extensionState.js:

if (path && basePath) {
  // Older extensions may provide a string path
  if (typeof path === 'string') {
    return `-webkit-image-set(
      url(${basePath}/${path}) 1x`
  }
  let basePath19 = path.get('19')
  let basePath38 = path.get('38')
  if (basePath19 && basePath38) {
    return `-webkit-image-set(
      url(${basePath}/${basePath19}) 1x,
      url(${basePath}/${basePath38}) 2x`
  }
}

This is not always the case. Evernote, for example, does the following:

a = "images/ext_icons/" + a;
      
var d = {
  19: chrome.extension.getURL(a + "-19x19.png"),
  20: chrome.extension.getURL(a + "-20x20.png"),
  38: chrome.extension.getURL(a + "-19x19@2x.png"),
  40: chrome.extension.getURL(a + "-40x40.png")
};

chrome.browserAction.setIcon({ path: d })

Related Issues: #8500

@jonathansampson
Copy link
Collaborator Author

Blocks #8327

@jonathansampson jonathansampson changed the title Extension APIs: chrome.browserAction.setIcon Extension APIs: chrome.browserAction.setIcon assumes a relative path Apr 26, 2017
@jonathansampson jonathansampson changed the title Extension APIs: chrome.browserAction.setIcon assumes a relative path Extension API: chrome.browserAction.setIcon assumes a relative path Sep 16, 2017
@bsclifton bsclifton added this to the Triage Backlog milestone Nov 27, 2017
@bsclifton bsclifton added fixed-with-brave-core This issue will automatically resolved with the replacement of Muon with Brave Core. wontfix labels Jul 25, 2018
@bsclifton bsclifton removed this from the Triage Backlog milestone Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature/extensions fixed-with-brave-core This issue will automatically resolved with the replacement of Muon with Brave Core. wontfix
Projects
None yet
Development

No branches or pull requests

2 participants