mozilla / addon-compatibility-reporter

Add-on Compatibility Reporter (Redux)
https://wiki.mozilla.org/AMO:Projects/ACR
16 stars 12 forks source link

Support SVG icons #80

Open NiklasGollenstede opened 7 years ago

NiklasGollenstede commented 7 years ago

The add-on icons in the pop-up-panel are linked as data:image/png;base64,....

That doesn't work for SVG-icons (which are otherwise supported by Firefox). Changing the mime-type fixes that. To determine a better mimetype than just assuming image/png, I'd suggest something like:

const mimeType = ({
    bmp: 'image/bmp',
    gif: 'image/gif',
    ico: 'image/x-icon',
    jpeg: 'image/jpeg',
    jpg: 'image/jpeg',
    png: 'image/png',
    svg: 'image/svg+xml',
})[iconPath.split('.').pop()] || 'image/png';
wagnerand commented 7 years ago

Nice! Would you mind submitting a PR?

NiklasGollenstede commented 7 years ago

Not at all. Is there a reason why this isn't using blob: URLs? I think if garbage collected on unload, they only have advantages. If that's fine with you, I'd use those instead.

wagnerand commented 7 years ago

I don't know what the reason for that is, or if there is even a reason.

NiklasGollenstede commented 7 years ago

So, should I try it, or is this a "don't fix it if it ain't broke" thing?

wagnerand commented 7 years ago

Feel free to give it a try, but please test it extensively, too. The add-on has a lot of users, and we need to make sure it doesn't break :)

NiklasGollenstede commented 7 years ago

Ok. I'll do that