eoger / tabcenter-redux

Vertical Tabs extension for Firefox
Mozilla Public License 2.0
380 stars 67 forks source link

Bug: Invisible tabs #124

Closed SinBirb closed 6 years ago

SinBirb commented 7 years ago

Steps how it happened:

What happened:

Browser console log:

11:28:47.251 elements[(pos - 1)] is undefined  index.js:576
11:28:47.256 this.view.parentNode is null  index.js:803
11:28:48.822 this.view.parentNode is null  index.js:803
11:28:51.127 TypeError: browser.contextMenus is undefined  background.js:3:1
12:08:22.379 elements[(pos - 1)] is undefined  index.js:576
12:08:22.386 this.view.parentNode is null  index.js:803
12:08:27.705 OpenGL compositor Initialized Succesfully.
Version: 3.0 Mesa 17.1.5
Vendor: Intel Open Source Technology Center
Renderer: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) 
FBO Texture Target: TEXTURE_2D
12:09:18.103 elements[(pos - 1)] is undefined  index.js:576
12:09:18.107 this.view.parentNode is null index.js:803

Edit: I found out a reliable way to reproduce: Quickly press Ctrl+W and instantly after Ctrl+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.

eoger commented 7 years ago

Thank you for the edit, I was able to reproduce

eoger commented 7 years ago

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 :)

SinBirb commented 7 years ago

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

SXZ1 commented 7 years ago

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?

eoger commented 6 years ago

Looks like https://github.com/eoger/tabcenter-redux/commit/41128b108c0b7d4a45748009ac5abd28bd289cf2 fixed the problem, feel free to re-open if you experience that bug again.