Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to SVG icons with "context-fill" #2053

Closed
piroor opened this issue Oct 17, 2018 · 7 comments
Closed

Migrate to SVG icons with "context-fill" #2053

piroor opened this issue Oct 17, 2018 · 7 comments

Comments

@piroor
Copy link
Owner

piroor commented Oct 17, 2018

"context-fill" for icons is availble only on Firefox 62 and later, and doesn't work on ESR60. After ESR60 is outdated and new ESR (66 or 67?) is released, we need to switch icons to context-fill versions.

@piroor
Copy link
Owner Author

piroor commented Oct 17, 2018

@piroor
Copy link
Owner Author

piroor commented Oct 18, 2018

Theme color is applied only when svg.context-properties.content.enabled is true. I've tried to bypass this restriction by:

{
  const icons = browser.runtime.getManifest().variable_color_icons;
  Promise.all(
    [browser.runtime.getBrowserInfo()].concat(
      Object.keys(icons)
        .map(size => {
          return new Promise((resolve, _reject) => {
            const request = new XMLHttpRequest();
            request.open('GET', icons[size]);
            request.addEventListener('load', () => {
              resolve({ size, data: request.responseText });
            });
            request.send();
          });
        })
    )
  ).then(results => {
    const browserInfo = results.shift();
    if (parseInt(browserInfo.version.split('.')[0]) >= 62) {
      const icons = { path: {} };
      for (const icon of results) {
        icons.path[icon.size] = `data:image/svg+xml,${encodeURIComponent(icon.data)}`;
      }
      browser.browserAction.setIcon(icons);
      browser.sidebarAction.setIcon(icons);
    }
  });
}

but it doesn't solve the problem...

@irvinm
Copy link
Contributor

irvinm commented May 14, 2019

@piroor is this still on your radar? Looks like next ESR is FF68 and will come out July 9, 2019.

@irvinm
Copy link
Contributor

irvinm commented Jun 24, 2019

@piroor friendly reminder.

@piroor
Copy link
Owner Author

piroor commented Jun 25, 2019

Sadly svg.context-properties.content.enabled is still false by default on Firefox 68. As the comment https://bugzilla.mozilla.org/show_bug.cgi?id=1391980#c1 the pref no longer become true for this purpose, so I have to give up this idea. Instead I think I should remove dynamic codes for this workaround and close this issue, after https://bugzilla.mozilla.org/show_bug.cgi?id=1367042 become closed.

@irvinm
Copy link
Contributor

irvinm commented Jun 12, 2021

@piroor is it time to close this one?

@piroor
Copy link
Owner Author

piroor commented Jun 13, 2021

Thanks I forgot about this.

@piroor piroor closed this as completed Jun 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants