Open Bug 898052 Opened 11 years ago Updated 2 years ago

Dispatch a "TabClosed" event after the tab has really been removed

Categories

(Firefox :: Tabbed Browser, defect)

x86_64
Windows 7
defect

Tracking

()

People

(Reporter: mossop, Unassigned)

Details

Currently tabbrowser sends a TabClose event to say that a tab is getting closed. Confusingly though that tab sticks around and you can still see it in tabContainer until after the UI transition has finished. This has caused a few slip-ups in Jetpack tests were we move on to the next test after TabClose but the next test randomly sees the old tab there. I'd like to add a TabClosed event that fires when the tab has finally gone away.
This has never been a problem for browser chrome tests where we use executeSoon to start the next test. Can you just do the same?
(In reply to Dão Gottwald [:dao] from comment #1) > This has never been a problem for browser chrome tests where we use > executeSoon to start the next test. Can you just do the same? We could, but it isn't just tests that can be affected like this, just the most obvious case. executeSoon is something of a hack when we can just do the right thing here
(In reply to Dave Townsend (:Mossop) from comment #2) > We could, but it isn't just tests that can be affected like this, just the > most obvious case. Do you have some specific cases in mind? I'm skeptical because the tabbrowser API is relatively old and as far as I remember this has never been a problem.
(In reply to Dão Gottwald [:dao] from comment #3) > (In reply to Dave Townsend (:Mossop) from comment #2) > > We could, but it isn't just tests that can be affected like this, just the > > most obvious case. > > Do you have some specific cases in mind? I'm skeptical because the > tabbrowser API is relatively old and as far as I remember this has never > been a problem. The tabbrowser API changes all the time, I don't know how long this has been a problem but I'd guess since we added animations to closing tabs. After a tab has closed I want to iterate all the remaining tabs to collect some information from each. But I end up accidentally including the closed tab because it is still in tabContainer unless do checking to ignore it. After a tab has closed I want to count the remaining non-pinned tabs and close the browser window if it is 0. I actually have to close when there is 1 tab left. There's a few I made up on the fly. I don't think there is any case that can't be worked around, but then I don't see why we shouldn't just make this easy and add a simple event to the API.
(In reply to Dave Townsend (:Mossop) from comment #4) > The tabbrowser API changes all the time, I don't know how long this has been > a problem but I'd guess since we added animations to closing tabs. Animations didn't change this, the event was always dispatched before the tab actually got removed.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.