mirror of
https://github.com/zen-browser/desktop.git
synced 2025-09-05 19:08:18 +00:00
Update waitForPromises to ensure all windows are restored before initialization
This commit is contained in:
@@ -30,7 +30,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
});
|
});
|
||||||
|
|
||||||
async waitForPromises() {
|
async waitForPromises() {
|
||||||
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized, SessionStore.promiseInitialized]);
|
await Promise.all([this.promiseDBInitialized, this.promisePinnedInitialized, SessionStore.promiseAllWindowsRestored]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
@@ -71,6 +71,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
);
|
);
|
||||||
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
|
||||||
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
|
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
|
||||||
|
await this.waitForPromises();
|
||||||
this._delayedStartup();
|
this._delayedStartup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +383,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initializeWorkspaces() {
|
async initializeWorkspaces() {
|
||||||
await this.waitForPromises();
|
|
||||||
await this.initializeWorkspacesButton();
|
await this.initializeWorkspacesButton();
|
||||||
if (this.workspaceEnabled) {
|
if (this.workspaceEnabled) {
|
||||||
this._initializeWorkspaceCreationIcons();
|
this._initializeWorkspaceCreationIcons();
|
||||||
@@ -403,11 +403,11 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||||||
activeWorkspace = workspaces.workspaces[0];
|
activeWorkspace = workspaces.workspaces[0];
|
||||||
this.activeWorkspace = activeWorkspace?.uuid;
|
this.activeWorkspace = activeWorkspace?.uuid;
|
||||||
}
|
}
|
||||||
await this.changeWorkspace(activeWorkspace, { onInit: true });
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (activeWorkspace) {
|
if (activeWorkspace) {
|
||||||
window.gZenThemePicker = new ZenThemePicker();
|
window.gZenThemePicker = new ZenThemePicker();
|
||||||
|
await this.changeWorkspace(activeWorkspace, { onInit: true });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('ZenWorkspaces: Error initializing theme picker', e);
|
console.error('ZenWorkspaces: Error initializing theme picker', e);
|
||||||
|
Reference in New Issue
Block a user