Open Bug 1450371 Opened 2 years ago Updated 1 day ago

browser.tabs.Tab with { discarded: true, state: 'loading', }

Categories

(Firefox :: Tabbed Browser, defect, P3)

60 Branch
defect

Tracking

()

People

(Reporter: n.gollenstede, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached file unloadtabs-0.8.0b2.zip
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0
Build ID: 20180322152034

Steps to reproduce:

When using the `browser.tabs.discard` WebExtension API, it is possible that tabs end up in a state `{ discarded: true, state: 'loading', }`.
Besides being semantically incorrect (discarded tabs aren't loading), this also causes the tab load indicator to keep rotating (or whatever movement it does now).
The tab stays in that state until it is undated in some way.

This only happens sporadically when closing tabs with the attached extension, which I am currently porting, installed.
The extension detects the tab close and activates a loaded tab to be focused next, to avoid loading discarede (or not restored) tabs.
Due to the asynchronicity of the `browser.tabs` API, this may sometimes/often happens too late and a discarded tab is loaded. The extension will then rapid-fire `tabs.discard` and `tabs.unpdate( , { active: true, })` calls to stop the loading.
I will attach a sequence of actions and log messages that ended up with a `{ discarded: true, state: 'loading', }` tab in the next comment.


Actual results:

`browser.tabs.discard` leaves the tab in a state `{ discarded: true, state: 'loading', }`.


Expected results:

I think the tabs `status` should be `'complete'` for `discarded` tabs.
Or `'discarded'`, but that would probably be backwards-incompatible.
Attached image console-output-1.png
The sequence of steps taken should be clear from the console output:
- tabs [1..6] were open (some not restored, some already unloaded)
- tab 7 was opened
- tab 5 was closed
- tab 7 was closed
Attached file console-output-1.txt
Component: Untriaged → WebExtensions: Frontend
OS: Unspecified → All
Product: Firefox → Toolkit
Hardware: Unspecified → All
Component: WebExtensions: Frontend → Tabbed Browser
Product: Toolkit → Firefox
Should probably be state: 'complete' as OP mentioned, but at the very least we should ensure that discarding tabs removes the tab throbber.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

A quick note: I've noticed this when I enabled automatic tab unloading and it's a bit distracting when it happens. We plan on re-enabling automatic tab unloading in Firefox 72 so it might be nice to have this fixed soon(ish).

See Also: → 1587762
See Also: → 1611878
You need to log in before you can comment on or make changes to this bug.