Closed Bug 1464674 Opened 3 years ago Closed 3 years ago

WebExtension API for getting cached favicons (from tabs)

Categories

(WebExtensions :: General, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1315616

People

(Reporter: c4609174, Unassigned)

Details

(Whiteboard: enhancement)

User story:
As a WebExtension developer I want to be able to get cached favicons of sites/tabs, because these are more reliable and have other advantages. (see below)

Background:
Many add-ons are about tabs and thus display a list of tabs or so in their pane. To make it visually appealing, I think it is a common requirement of WebExtensions to display a favicon next to the URL/title/… of the site/tab.

Current behaviour:
Currently we have the Tabs API[1], which can return a "favIconUrl". The first issue here is "can", because sometimes the tab is still loading as the docs note, or other things.
To use the icon, we have to embed it into the HTML of the extension and thus it triggers a new network request when shown in the popup.

Issues with the current behaviour:
* The network request is just not necessary, if the icon is e.g. from a currently shown tab, it is already loaded in Firefox.
* The network request may be blocked by Firefox' tracking blocker, e.g. Twitter's favicon is blocked.
* Generally, websites may track user's by this unnecessary request. When a web extension requests/needs many favicons, it may have a very specific pattern.
* It introduces latency respectively the user may not see it instantly when the popup of the add-on is e.g. shown.
* If the add-on has a locked down CSP, it does not work. Instead it needs to whitelist img-src, at least.
* It is generally not reliable, I sometimes just did not got an icon although the tab is loaded.

Of course, the more favicons it requests, the worse are the effects.

Examples:
* Add-ons may implement something like Bug 467828.
* My add-on: https://addons.mozilla.org/firefox/addon/how-did-i-get-here/

What I propose:
* There should be a way to get the cached favicon of a tab, at least. Firefox should maybe just return a base64 string for the 16x16 favicon. Or, of course, it may return the 32x32 version for HiDPI screens.
* It would be even more useful, if there is a way to get the favicon for any site – not only for tabs. This would likely cover more use cases and allows a fallback in case the method for the tab (respectively the current "favIconUrl") fails.

[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/Tab#Type
As for the reliable thing: I think this happened, because the tab was "discarded". It does not seem to return an icon then.
Component: Untriaged → Tabbed Browser
Whiteboard: enhancement
Status: UNCONFIRMED → NEW
Ever confirmed: true
Component: Tabbed Browser → WebExtensions: General
Product: Firefox → Toolkit
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1315616
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.