mirror of
https://github.com/zen-browser/desktop.git
synced 2026-01-06 21:37:50 +00:00
feat: Properly handle new profiles without a previous session, b=no-bug, c=common, workspaces
This commit is contained in:
@@ -45,8 +45,6 @@
|
||||
# Scripts used all over the browser
|
||||
<script type="module" src="chrome://browser/content/zen-components/ZenFolder.mjs"></script>
|
||||
|
||||
<script type="module" src="chrome://browser/content/zen-components/ZenWorkspacesStorage.mjs"></script>
|
||||
|
||||
<script type="module" src="chrome://browser/content/zen-components/ZenMediaController.mjs"></script>
|
||||
<script type="module" src="chrome://browser/content/zen-components/ZenWorkspaceCreation.mjs"></script>
|
||||
<script type="module" src="chrome://browser/content/zen-components/ZenGlanceManager.mjs"></script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/places/content/bookmarkProperties.xhtml b/browser/components/places/content/bookmarkProperties.xhtml
|
||||
index 4aad4e4fb4139aa3d81e00eefa82e26b697df973..a2bfac11322f3679af9b51ebc7478323aa8e4adb 100644
|
||||
index 4aad4e4fb4139aa3d81e00eefa82e26b697df973..831e42a4a55e277b5b8e81e4317a2007c5306996 100644
|
||||
--- a/browser/components/places/content/bookmarkProperties.xhtml
|
||||
+++ b/browser/components/places/content/bookmarkProperties.xhtml
|
||||
@@ -38,6 +38,8 @@
|
||||
@@ -15,7 +15,7 @@ index 4aad4e4fb4139aa3d81e00eefa82e26b697df973..a2bfac11322f3679af9b51ebc7478323
|
||||
src="chrome://browser/locale/places/bookmarkProperties.properties"/>
|
||||
</stringbundleset>
|
||||
|
||||
+ <script src="chrome://browser/content/zen-components/ZenWorkspacesStorage.mjs" />
|
||||
+ <script src="chrome://browser/content/zen-components/ZenWorkspaceBookmarksStorage.js" />
|
||||
+ <script src="chrome://browser/content/zenThemeModifier.js"></script>
|
||||
<script src="chrome://browser/content/places/editBookmark.js"/>
|
||||
<script src="chrome://browser/content/places/bookmarkProperties.js"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/browser/components/sessionstore/SessionStartup.sys.mjs b/browser/components/sessionstore/SessionStartup.sys.mjs
|
||||
index be23213ae9ec7e59358a17276c6c3764d38d9996..c7bb413d7e2d8ce3f9bc38a925d57e59d882111d 100644
|
||||
index be23213ae9ec7e59358a17276c6c3764d38d9996..229bb1346f9349892acb1e9e05109b28f5a5b45f 100644
|
||||
--- a/browser/components/sessionstore/SessionStartup.sys.mjs
|
||||
+++ b/browser/components/sessionstore/SessionStartup.sys.mjs
|
||||
@@ -40,6 +40,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
@@ -19,17 +19,16 @@ index be23213ae9ec7e59358a17276c6c3764d38d9996..c7bb413d7e2d8ce3f9bc38a925d57e59
|
||||
this._initialized = true;
|
||||
gOnceInitializedDeferred.resolve();
|
||||
return;
|
||||
@@ -179,6 +180,9 @@ export var SessionStartup = {
|
||||
@@ -179,6 +180,8 @@ export var SessionStartup = {
|
||||
this._initialState = parsed;
|
||||
}
|
||||
|
||||
+ this._initialState ||= {};
|
||||
+ lazy.ZenSessionStore.onFileRead(this._initialState);
|
||||
+
|
||||
if (this._initialState == null) {
|
||||
// No valid session found.
|
||||
this._sessionType = this.NO_SESSION;
|
||||
@@ -335,12 +339,7 @@ export var SessionStartup = {
|
||||
@@ -335,12 +338,7 @@ export var SessionStartup = {
|
||||
isAutomaticRestoreEnabled() {
|
||||
if (this._resumeSessionEnabled === null) {
|
||||
this._resumeSessionEnabled =
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
// prettier-ignore
|
||||
|
||||
{
|
||||
Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenWorkspaceBookmarksStorage.js", this);
|
||||
|
||||
ChromeUtils.importESModule("chrome://browser/content/ZenStartup.mjs", { global: "current" });
|
||||
ChromeUtils.importESModule("chrome://browser/content/zen-components/ZenCompactMode.mjs", { global: "current" });
|
||||
ChromeUtils.importESModule("chrome://browser/content/ZenUIManager.mjs", { global: "current" });
|
||||
|
||||
@@ -160,8 +160,8 @@ export class nsZenSessionManager {
|
||||
// initial state, for example if the user had 'restore previous
|
||||
// session' disabled before migration. In that case, we try
|
||||
// to restore the last closed normal window.
|
||||
if (!initialState.windows?.length) {
|
||||
let normalClosedWindow = initialState._closedWindows?.find(
|
||||
if (!initialState?.windows?.length) {
|
||||
let normalClosedWindow = initialState?._closedWindows?.find(
|
||||
(win) => !win.isPopup && !win.isTaskbarTab && !win.isPrivate
|
||||
);
|
||||
if (normalClosedWindow) {
|
||||
@@ -169,7 +169,7 @@ export class nsZenSessionManager {
|
||||
this.log('Restoring tabs from last closed normal window');
|
||||
}
|
||||
}
|
||||
for (const winData of initialState.windows || []) {
|
||||
for (const winData of initialState?.windows || []) {
|
||||
winData.spaces = this._migrationData?.spaces || [];
|
||||
}
|
||||
// Save the state to the sidebar object so that it gets written
|
||||
@@ -224,8 +224,7 @@ export class nsZenSessionManager {
|
||||
/**
|
||||
* Saves the current session state. Collects data and writes to disk.
|
||||
*
|
||||
* @param state
|
||||
* The current session state.
|
||||
* @param state The current session state.
|
||||
*/
|
||||
saveState(state) {
|
||||
if (!state?.windows?.length) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
content/browser/zen-components/ZenWorkspace.mjs (../../zen/workspaces/ZenWorkspace.mjs)
|
||||
content/browser/zen-components/ZenWorkspaces.mjs (../../zen/workspaces/ZenWorkspaces.mjs)
|
||||
content/browser/zen-components/ZenWorkspaceCreation.mjs (../../zen/workspaces/ZenWorkspaceCreation.mjs)
|
||||
content/browser/zen-components/ZenWorkspacesStorage.mjs (../../zen/workspaces/ZenWorkspacesStorage.mjs)
|
||||
content/browser/zen-components/ZenWorkspaceBookmarksStorage.js (../../zen/workspaces/ZenWorkspaceBookmarksStorage.js)
|
||||
content/browser/zen-components/ZenGradientGenerator.mjs (../../zen/workspaces/ZenGradientGenerator.mjs)
|
||||
* content/browser/zen-styles/zen-workspaces.css (../../zen/workspaces/zen-workspaces.css)
|
||||
content/browser/zen-styles/zen-gradient-generator.css (../../zen/workspaces/zen-gradient-generator.css)
|
||||
Reference in New Issue
Block a user