How to create a discarded tab with favicon loaded?

Creating a tab via

await browser.tabs.create({ url: 'https://www.example.com/', discarded: true });

yields a discarded tab that’s missing its title (not an issue) and its favicon (my issue).

I’ve thought of one way to solve this: create a regular non-discarded, non-active tab, and then have tabs.onUpdated listen for a non-null favIconUrl property change to trigger a tabs.discard() on it (and then remove the listener). I’ve yet to try it.

Are there better ways to do this? Something from the webRequest API? Guidance appreciated.

Creating brand new tabs, possibly many at once. I’m concerned whether your method, which adds an onUpdated listener per tab, is efficient. Given a list of tabs to create, would it be better to have one listener for them all?

Firefox has also an issue where API discarded tabs don’t get “discarded-look” for their favicons:

Although I can’t say if that’s actually desirable for you, right?

If you think there is a good potential for a new WebExtension API, you suggest it here:

Now that I think about it, we already have tabs.update() API, so this would require only adding new field support:

I commented on it 7 years ago with the same ask. :slight_smile: