josh-berry / tab-stash

Firefox extension to save and restore tabs as bookmarks. Clear your tabs, clear your mind.
https://josh-berry.github.io/tab-stash/
Mozilla Public License 2.0
808 stars 45 forks source link

[Crash] Index N is past the end of a fully-loaded parent #537

Closed KarboniteKream closed 1 month ago

KarboniteKream commented 2 months ago

Crash Details

Browser: Mozilla Firefox 130.0.1 20240913135723 (mac aarch64)
Extension: Tab Stash 3.1 (normal)

Index 141 is past the end of a fully-loaded parent
insertNode@moz-extension://eea4455b-9fb5-4da9-8fce-181ec9f5fdfe/assets/oops-notification.js:740:13
whenTabCreated@moz-extension://eea4455b-9fb5-4da9-8fce-181ec9f5fdfe/assets/oops-notification.js:2415:15
handler@moz-extension://eea4455b-9fb5-4da9-8fce-181ec9f5fdfe/assets/oops-notification.js:681:16

Installed Extensions

All other extensions are disabled.

Describe the Crash

This issue started appearing with Tab Stash 3.1. I can reproduce it when quickly switching or opening, then closing tabs.

It can reliably be reproduced by holding Cmd and quickly pressing T and W.

Expected Behavior

No response

Impact

No response

Additional Details

No response

Vote for This Issue

josh-berry commented 1 month ago

Thanks for the crash report! I've looked into this and the root of it seems to be a Firefox issue—Firefox will send a "tab-removed" event followed by a "tab-created" event, but the "tab-created" event will not have taken into account the fact that a tab was just closed, and the position of the newly-created tab will be off by one.

So for example, if I have three tabs at positions 0, 1, and 2, and I quickly close the tab at position 2 and then open a new tab, the "tab-created" event Firefox sends will say the new tab should be at index 3, which is wrong (it should be at position 2).

I can work around this fairly easily, I think, by assuming a tab with an index that's too large is simply at the end of the window (since that's where new tabs usually wind up anyway). But this might still cause there to be tabs shown in incorrect positions in the Tab Stash UI if a new tab gets opened somewhere in the middle of the window for some reason. Hopefully that is less of an issue though.