Add initial test for basic workspace change and refactor empty tab initialization

This commit is contained in:
mr. M
2025-03-12 23:16:27 +01:00
parent 3df1973ac9
commit 7b5a778bd8
5 changed files with 61 additions and 42 deletions

View File

@@ -36,6 +36,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._resolveInitialized = resolve;
});
promiseEmptyTabInitialized = new Promise((resolve) => {
this._resolveEmptyTabInitialized = resolve;
});
workspaceIndicatorXUL = `
<hbox class="zen-current-workspace-indicator-icon"></hbox>
<hbox class="zen-current-workspace-indicator-name"></hbox>
@@ -603,16 +607,19 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
} catch (e) {
console.error('ZenWorkspaces: Error initializing theme picker', e);
}
this._selectStartPage();
await this._selectStartPage();
this._fixTabPositions();
this._resolveInitialized();
this._clearAnyZombieTabs(); // Dont call with await
}
}
_selectStartPage() {
async _selectStartPage() {
const currentTab = gBrowser.selectedTab;
let showed = false;
await this.promiseEmptyTabInitialized;
this._resolveEmptyTabInitialized = null;
this.promiseEmptyTabInitialized = null;
if (currentTab.pinned) {
this.selectEmptyTab();
try {