jsmnbom / back2close

Firefox web extension. Use the back button to close newly opened tabs.
https://addons.mozilla.org/en-US/firefox/addon/back-to-close-we/
MIT License
16 stars 4 forks source link

An extra Close Tab entry gets added to the history on restored tabs #2

Closed jameslikeslinux closed 6 years ago

jameslikeslinux commented 6 years ago

Thanks for this WebExtension.

Suppose I open a new tab and navigate to three pages, my history would look like:

Close Tab -> Site 1 -> Site 2 -> Site 3

If I close the tab, then restore the closed tab (Ctrl+Shift+T or from the History menu), an extra "Close Tab" entry gets injected into the history:

Close Tab -> Site 1 -> Site 2 -> Close Tab -> Site 3

My expectation is that I should be able to navigate back to Site 2 and Site 1 from a restored tab without it closing.

Without knowing anything about the internals of this extension, it seems like this could be avoided by checking the length of the history before deciding whether to add another Close Tab entry.

jsmnbom commented 6 years ago

Thank you for this report, i litterally just noticed the error myself xD I should indeed be able to check the length of the history before injecting the new history state (Close Tab entry). However, i fear it might be a bit more complicated, since when you open a new tab I don't have access to add it, and therefore it gets added afterwards - at a length of 2, but when you opened the tab via right click -> open in new tab it is at a length of 1. I'll see if there is something I can do :)

jsmnbom commented 6 years ago

@iamjamestl This should be fixed in version 0.5.0 on AMO :) Thanks again for reporting.