chore: Added more checks for restoring previous sessions, b=(no-bug), c=workspaces, tests

This commit is contained in:
Mr. M
2025-05-10 15:50:29 +02:00
parent d788ac4ad6
commit 5c30c83341
4 changed files with 685 additions and 4 deletions

View File

@@ -815,7 +815,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._removedByStartupPage = true;
gBrowser.removeTab(this._initialTab, {
skipSessionStore: true,
animate: false,
});
} else {
this.moveTabToWorkspace(this._initialTab, this.activeWorkspace);
@@ -826,14 +825,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}
if (this._tabToRemoveForEmpty) {
const tabs = gBrowser.tabs.filter((tab) => !tab.collapsed && !tab.hasAttribute('zen-empty-tab'));
if (typeof this._tabToSelect === 'number' && this._tabToSelect >= 0 && tabs[this._tabToSelect]) {
if (
typeof this._tabToSelect === 'number' &&
this._tabToSelect >= 0 &&
tabs[this._tabToSelect] &&
this._shouldShowTab(tabs[this._tabToSelect]) &&
tabs[this._tabToSelect] !== this._tabToRemoveForEmpty
) {
setTimeout(() => {
this.log(`Found tab to select: ${this._tabToSelect}, ${tabs.length}`);
gBrowser.selectedTab = tabs[this._tabToSelect];
this._removedByStartupPage = true;
gBrowser.removeTab(this._tabToRemoveForEmpty, {
skipSessionStore: true,
animate: false,
});
cleanup();
}, 0);
@@ -843,7 +847,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._removedByStartupPage = true;
gBrowser.removeTab(this._tabToRemoveForEmpty, {
skipSessionStore: true,
animate: false,
});
cleanup();
}