mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-13 02:05:18 +00:00
feat: Take into consideration win data may not have allocated spaces, b=no-bug, c=workspaces
This commit is contained in:
@@ -142,7 +142,11 @@ export class nsZenSessionManager {
|
||||
// gotten the opportunity to save the session yet.
|
||||
if (!Services.prefs.getBoolPref(MIGRATION_PREF, false)) {
|
||||
Services.prefs.setBoolPref(MIGRATION_PREF, true);
|
||||
for (const winData of initialState.windows || []) {
|
||||
this.#sidebar = {
|
||||
...this.#sidebar,
|
||||
spaces: this._migrationSpaceData || [],
|
||||
};
|
||||
for (const winData of initialState?.windows || []) {
|
||||
winData.spaces = this._migrationSpaceData || [];
|
||||
}
|
||||
delete this._migrationSpaceData;
|
||||
|
||||
@@ -850,10 +850,10 @@ class nsZenWorkspaces {
|
||||
return this._workspaceCache;
|
||||
}
|
||||
|
||||
async restoreWorkspacesFromSessionStore(aWinData) {
|
||||
this._workspaceCache = aWinData.spaces || [
|
||||
await this.createAndSaveWorkspace('Space', undefined, true),
|
||||
];
|
||||
async restoreWorkspacesFromSessionStore(aWinData = {}) {
|
||||
this._workspaceCache = aWinData.spaces?.length
|
||||
? aWinData.spaces
|
||||
: [await this.createAndSaveWorkspace('Space', undefined, true)];
|
||||
this.activeWorkspace = aWinData.activeZenSpace || this._workspaceCache[0].uuid;
|
||||
await this.initializeWorkspaces();
|
||||
this.#hasInitialized = true;
|
||||
|
||||
@@ -26,8 +26,7 @@ window.ZenWorkspaceBookmarksStorage = {
|
||||
workspace_uuid TEXT NOT NULL,
|
||||
created_at INTEGER NOT NULL,
|
||||
updated_at INTEGER NOT NULL,
|
||||
UNIQUE(bookmark_guid, workspace_uuid),
|
||||
FOREIGN KEY(workspace_uuid) REFERENCES zen_workspaces(uuid) ON DELETE CASCADE,
|
||||
UNIQUE(bookmark_guid),
|
||||
FOREIGN KEY(bookmark_guid) REFERENCES moz_bookmarks(guid) ON DELETE CASCADE
|
||||
)
|
||||
`);
|
||||
@@ -46,8 +45,7 @@ window.ZenWorkspaceBookmarksStorage = {
|
||||
workspace_uuid TEXT NOT NULL,
|
||||
change_type TEXT NOT NULL,
|
||||
timestamp INTEGER NOT NULL,
|
||||
UNIQUE(bookmark_guid, workspace_uuid),
|
||||
FOREIGN KEY(workspace_uuid) REFERENCES zen_workspaces(uuid) ON DELETE CASCADE,
|
||||
UNIQUE(bookmark_guid),
|
||||
FOREIGN KEY(bookmark_guid) REFERENCES moz_bookmarks(guid) ON DELETE CASCADE
|
||||
)
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user