Closed Bug 1687894 Opened 3 years ago Closed 3 years ago

Icon (favicon) does not get displayed in bookmark when it is in SVG format

Categories

(Firefox :: Bookmarks & History, defect)

Firefox 84
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: alien426, Unassigned)

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0

Steps to reproduce:

I add a basic favicon to a HTML document:
<link type="image/x-icon" rel="shortcut icon" href="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzMjAgMzIwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyZWN0IGZpbGw9InJlZCIgeD0iMTAiIHk9IjEwIiB3aWR0aD0iMzAwIiBoZWlnaHQ9IjMwMCIgLz48L3N2Zz4=" />

Actual results:

The favicon is displayed correctly in the tab when viewing the page. But when a bookmark is created, it does not have the icon.

The problem also exists when the icon is not a data URL, but a file. I also tested removing the "type" attribute and changing "rel" attribute to just "icon".

When the favicon is in bitmap format (GIF, PNG, ...), it works as expected.

Expected results:

Icon should be displayed.

Attached image Favicon.png

I can't manage to reproduce this issue, I tried on both Firefox 84.0.2 and on Firefox Nightly 86.0a1. Favicon is displayed in bookmark.

Am I checking in the right place?

Thanks.

Flags: needinfo?(alien426)

Curious. I can confirm that the bookmark of the page has an icon ... when accessed with file:// protocol.
However when I bookmark the page when viewed on localhost with https:// protocol, the icon is missing.

Can you test on a web server? I'm on Apache 2.4.46.

Flags: needinfo?(alien426)

I have found a website with SVG icon that can be used for testing the behavior:
https://chaykelly.com/blog/svg-website-favicon/

The Bugbug bot thinks this bug should belong to the 'Firefox::Bookmarks & History' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Bookmarks & History

I have found out some stuff.
The problem seems to be that bitmap favicons are converted to PNG before being saved to the favicons.sqlite database.
The only SVGs I found in there have the "chrome://" protocol. The table is "moz_icons", relevant fields are "icon_url" and "data".

This is backed up by code in the _writeFaviconAttribute() function in https://searchfox.org/mozilla-central/source/toolkit/components/places/BookmarkHTMLUtils.jsm:

    if (!favicon.uri.schemeIs("chrome") && favicon.dataLen > 0) {
      let faviconContents =
        "data:image/png;base64," +
        base64EncodeString(String.fromCharCode.apply(String, favicon.data));
      this._writeAttribute("ICON", faviconContents);
    }

I still think that SVG icons should be supported for bookmarks. But it now seems like a conscious decision, not a bug.

The example page in comment 3 works for us, is it not working for you?

SVGs are supported by favicons.sqlite, only other non-vector formats are converted

Flags: needinfo?(mak)

I tried to reproduce with the snippet in comment 0, with file:, http: and https:, it always worked for me. So this is not actionable.
To continue investigation here we'd need an online or offline test-case we can use to reproduce the bug. If you can provide that on some server you manager, that'd be useful and then you should feel free to reopen this.

Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Flags: needinfo?(mak)
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: