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?

Edit: Context for future readers: I was replying to a user that replied to me, which I suspected was AI and has been removed (as well as all its posts) likely because it was AI. It never did reply to my follow-up question.

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:

Thanks for the link!
I’ve just poked it, maybe it will yield some results… :slight_smile: .

But I think this would be better discussed here: Issues · w3c/webextensions · GitHub
Maybe some experts would come up with some better solution.
And if everyone agrees there, it puts more pressure on the vendors to actually implement it :smiley: .