Tab favicon not dimming when unloaded via browser.tabs.discard
Categories
(WebExtensions :: Frontend, enhancement, P3)
Tracking
(firefox160 wontfix, firefox161 fixed)
People
(Reporter: jtmiller, Assigned: kernp25)
References
Details
Attachments
(1 file, 1 external file)
|
4.76 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0
Steps to reproduce:
- Manually unload a tab by right clicking and selecting "Unload Tab"
- Observe the tab's favicon changing its opacity, dimming
- Load tab again and this time "discard" it via
browser.tabs.discard(tabId | [tabId]) - Notice the favicon does not dim
Actual results:
In both cases the tabs unload correctly, but only using built-in "Unload Tab" do you see the favicon dim.
Expected results:
I expect the favicon dimming to occur when using the the browser.tabs.discard method.
https://hacks.mozilla.org/2021/10/tab-unloading-in-firefox-93/
"Some browser extensions already offer users the ability to unload tabs. We expect these extensions to interoperate with automatic tab unloading as they use the same underlying tabs.discard() API."
I only point that out, because if using the same underlying API, maybe that suggests we can correct the dimming inconsistency.
Comment 1•1 year ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•1 year ago
|
||
To me this is more like an enhancement, marking it accordingly. Please update if not correct. Thank you.
(In reply to Monica Chiorean from comment #2)
To me this is more like an enhancement, marking it accordingly. Please update if not correct. Thank you.
It certainly is an enhancement, only marked as a bug because of inconsistency between the native method (right click tab, "Unload Tab"), and the programmer's method: browser.tabs.discard()
I'm developing an extension that does the latter, but for many tabs at one, and I'm hoping to visually distinguish them.
If there is more reason to call this behavior a bug than an enhancement, I'm in favor to label it back as bug. I worry as an enhancement this inconsistency in behavior will persist for years. I am of course interested in solving myself, but FF contributions are very complicated compared to other OSS.
(In reply to BugBot [:suhaib / :marco/ :calixte] from comment #1)
The Bugbug bot thinks this bug should belong to the 'Firefox::Tabbed Browser' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
still wanting to nkow how I correct it, because I do think the bot is wrong. the code change wouldn't be adding an enhancement, it would be fixing a bug
Is this a WebExtension bug? Because tabs.discard does not set aForceDiscard when calling discardBrowser. This will then set the discarded attribute on the tab and so the style kicks in.
Was there a reason why not setting aForceDiscard?
Comment 7•7 months ago
|
||
(In reply to kernp25 from comment #6)
Is this a WebExtension bug? Because tabs.discard does not set aForceDiscard when calling discardBrowser. This will then set the discarded attribute on the tab and so the style kicks in.
Was there a reason why not setting aForceDiscard?
The aForceDiscard flag predates the style. The flag was used to skip the beforeunload prompt for example.
The style was added relatively recently in bug 1926973, but then limited to when the force flag was set, in bug 1962641, to explicitly exclude discards from low memory conditions.
I personally would not be opposed to visually fading the icon when browser.tabs.discard() is called. The original comment in bug 1926973 explicitly calls out to an extension as a motivating use case. I also recall that I have personally contributed a patch to the Discard Tab extension to alter the title of a tab to visually mark a faded tab; fading the icon would be a superior experience in my opinion.
Right now there is only one flag, aForceDiscard. Perhaps it makes sense to introduce an additional flag. And set that flag when called from https://searchfox.org/firefox-main/rev/b1c5a092fe1916975580c6ed95c51cbe78728a62/browser/components/extensions/parent/ext-tabs.js#954 (defaulting to whether aForceDiscard is set).
Comment 9•7 months ago
|
||
(In reply to shmup from comment #4)
If there is more reason to call this behavior a bug than an enhancement, I'm in favor to label it back as bug. I worry as an enhancement this inconsistency in behavior will persist for years. I am of course interested in solving myself, but FF contributions are very complicated compared to other OSS.
Getting started with Firefox is surprisingly easy. After downloading the git repository, you can run ./mach bootstrap that installs the relevant dependencies, and then run ./mach build to actually build Firefox. This build completes within minutes by default when you don't need to change compiled code, which is the case for front end-only changes.
If you are interested in contributing a patch, I am willing to provide mentorship of the bug. Do you want to work on a patch? See comment 7 for some pointers.
Here is the typical getting started page I share with new contributors in the extensions realm: https://wiki.mozilla.org/WebExtensions/Contribution_Onramp
| Assignee | ||
Comment 10•7 months ago
|
||
(In reply to Rob Wu [:robwu] from comment #7)
Right now there is only one flag,
aForceDiscard. Perhaps it makes sense to introduce an additional flag. And set that flag when called from https://searchfox.org/firefox-main/rev/b1c5a092fe1916975580c6ed95c51cbe78728a62/browser/components/extensions/parent/ext-tabs.js#954 (defaulting to whetheraForceDiscardis set).
Or just set the discarded attribute directly in tabs.discard? How would be the name of the new flag that is only used for setting the discarded attribute?
Comment 11•7 months ago
|
||
(In reply to kernp25 from comment #10)
(In reply to Rob Wu [:robwu] from comment #7)
Right now there is only one flag,
aForceDiscard. Perhaps it makes sense to introduce an additional flag. And set that flag when called from https://searchfox.org/firefox-main/rev/b1c5a092fe1916975580c6ed95c51cbe78728a62/browser/components/extensions/parent/ext-tabs.js#954 (defaulting to whetheraForceDiscardis set).Or just set the discarded attribute directly in tabs.discard?
I wouldn't set it in ext-tabs.js because the "discarded" attribute is an implementation detail owned by discardBrowser in tabbrowser.js. As you see there, the discardBrowser method is non-trivial and has logic before and after setting the attribute. The file is also responsible for clearing the attribute as needed.
How would be the name of the new flag that is only used for setting the discarded attribute?
Maybe aRenderDiscarded? To signal that the flag controls whether the discarded state is rendered. Other names are welcome.
The current signature is:
discardBrowser(aTab, aForceDiscard) {
discardBrowser(aTab, aForceDiscard, aRenderDiscarded = aForceDiscard) {
or to avoid difficult positional parameters, something like this:
discardBrowser(aTab, {
forceDiscard = false,
renderDiscarded = forceDiscard,
} = {}) {
Comment 12•4 months ago
|
||
Clear a needinfo that is pending on an inactive user.
Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE.
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 13•1 month ago
|
||
Updated•1 month ago
|
Comment 16•1 month ago
|
||
Comment 17•1 month ago
|
||
Comment 18•1 month ago
|
||
| bugherder | ||
Comment 19•19 days ago
|
||
Description
•