Refactor ZenViewSplitter to fix tab closing bug

This commit is contained in:
mauro-balades 2024-09-15 09:40:52 +02:00
parent 4101126d54
commit 7692662dd7

View file

@ -536,8 +536,9 @@ var gZenViewSplitter = new (class {
if (this.currentView < 0) return;
const currentTab = window.gBrowser.selectedTab;
const tabs = this._data[this.currentView].tabs;
for (const tab of tabs) {
this.handleTabClose({ target: tab, forUnsplit: true });
// note: This MUST be an index loop, as we are removing tabs from the array
for (let i = tabs.length - 1; i >= 0; i--) {
this.handleTabClose({ target: tabs[i], forUnsplit: true });
}
window.gBrowser.selectedTab = currentTab;
this.updateSplitViewButton(true);