Closed SinBirb closed 6 years ago
Thank you for the edit, I was able to reproduce
Let's say we have 2 tabs present, tab A and tab B.
Following @SinBirb instructions, in quick succession we delete a tab C then create a tab D.
What happens when we handle browser.tabs.onCreated
[0] is that we call setPos
with the position where we want to insert our tab view in the tablist view [1]. That position is supplied by tabInfo.index
(argument of our handler). [2]
What I observed is that tabInfo.index
is 3 instead of 2 (maybe because Firefox considers tab C, which index is 2, to be not yet unloaded?).
We could say "this is fine, let's just call setPos with this.tabs.length
instead of tabInfo.index
, which will insert our new tab at the end of the list, and call it a day".
But what would happen if we did the same operation in the middle of a big list of tabs? I'm pretty sure the tabs would not be in the correct order anymore.
It's pretty late so there might an obvious solution I'm missing here :)
I think this would be a decent work-around.
As far as I understand this is a firefox bug, since onCreated
passes the tab index as if the tab removal hadn't finished yet. I commented on an open bug about it: https://bugzilla.mozilla.org/show_bug.cgi?id=1291830
This bug is not reproduced in Tree Style Tab WebExtension (2.0.7) so maybe this bug can be fixed using the same approach TST dev used?
Looks like https://github.com/eoger/tabcenter-redux/commit/41128b108c0b7d4a45748009ac5abd28bd289cf2 fixed the problem, feel free to re-open if you experience that bug again.
Steps how it happened:
What happened:
Browser console log:
Edit: I found out a reliable way to reproduce: Quickly press
Ctrl+W
and instantly afterCtrl+T
. The new tab and every following tab isn't visible in tabcenter, only in firefox tab bar. When you close this tab (and every following), tabcenter will behave normal again.