Fixed essentials and pinned tabs not being correctly restored and race conditions when starting multiple zen windows

This commit is contained in:
mr. M
2025-01-17 19:01:32 +01:00
parent e6313c4d5f
commit 8e783f948f
7 changed files with 30 additions and 16 deletions

View File

@@ -35,7 +35,6 @@
<script src="chrome://browser/content/ZenUIManager.mjs" />
<script src="chrome://browser/content/zen-components/ZenSidebarManager.mjs"/>
<script src="chrome://browser/content/zen-components/ZenTabUnloader.mjs" />
<script src="chrome://browser/content/zen-components/ZenWorkspaces.mjs" />
<script src="chrome://browser/content/zen-components/ZenPinnedTabsStorage.mjs" />
<script src="chrome://browser/content/zen-components/ZenPinnedTabManager.mjs" />
<script src="chrome://browser/content/zen-components/ZenGradientGenerator.mjs" />

View File

@@ -4,6 +4,7 @@
<script type="text/javascript">
Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenCommonUtils.mjs", this);
Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenKeyboardShortcuts.mjs", this);
Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenWorkspaces.mjs", this);
Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenWorkspacesSync.mjs", this);
Services.scriptloader.loadSubScript("chrome://browser/content/zen-components/ZenWorkspacesStorage.mjs", this);
</script>

View File

@@ -47,7 +47,7 @@
}
class ZenPinnedTabManager extends ZenDOMOperatedFeature {
init() {
async init() {
if (!this.enabled) {
return;
}
@@ -58,6 +58,9 @@
this._zenClickEventListener = this._onTabClick.bind(this);
ZenWorkspaces.addChangeListeners(this.onWorkspaceChange.bind(this));
await ZenPinnedTabsStorage.promiseInitialized;
ZenWorkspaces._resolvePinnedInitialized();
}
async onWorkspaceChange(newWorkspace, onInit) {

View File

@@ -1,5 +1,6 @@
var ZenPinnedTabsStorage = {
async init() {
await SessionStore.promiseInitialized;
await this._ensureTable();
},
@@ -45,6 +46,8 @@ var ZenPinnedTabsStorage = {
await db.execute(`
CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
`);
this._resolveInitialized();
});
},
@@ -357,4 +360,7 @@ var ZenPinnedTabsStorage = {
},
};
ZenPinnedTabsStorage.init();
ZenPinnedTabsStorage.promiseInitialized = new Promise((resolve) => {
ZenPinnedTabsStorage._resolveInitialized = resolve;
ZenPinnedTabsStorage.init();
})

View File

@@ -21,6 +21,20 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
'BMB_mobileBookmarks',
];
promiseDBInitialized = new Promise((resolve) => {
this._resolveDBInitialized = resolve;
});
promisePinnedInitialized = new Promise((resolve) => {
this._resolvePinnedInitialized = resolve;
});
async waitForPromises() {
await SessionStore.promiseInitialized;
await this.promiseDBInitialized;
await this.promisePinnedInitialized;
}
async init() {
if (!this.shouldHaveWorkspaces) {
document.getElementById('zen-current-workspace-indicator').setAttribute('hidden', 'true');
@@ -376,7 +390,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._initializeWorkspaceTabContextMenus();
await this.workspaceBookmarks();
window.addEventListener('TabBrowserInserted', this.onTabBrowserInserted.bind(this));
await SessionStore.promiseInitialized;
await this.waitForPromises();
let workspaces = await this._workspaces();
let activeWorkspace = null;
if (workspaces.workspaces.length === 0) {

View File

@@ -70,6 +70,8 @@ var ZenWorkspacesStorage = {
this.lazy.Weave.Service.engineManager.register(ZenWorkspacesEngine);
await ZenWorkspacesStorage.migrateWorkspacesFromJSON();
}
ZenWorkspaces._resolveDBInitialized();
});
},

View File

@@ -1,5 +1,5 @@
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 9c3bb513537f1efc44788fc3efb9f7561eca9c0e..b1dd5bd9c28c95c69486b9803c76279af01459bd 100644
index 9c3bb513537f1efc44788fc3efb9f7561eca9c0e..dcada8742c5ea147d2378357c86c9a8b7dc639db 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -81,10 +81,13 @@ option(
@@ -39,14 +39,3 @@ index 9c3bb513537f1efc44788fc3efb9f7561eca9c0e..b1dd5bd9c28c95c69486b9803c76279a
option(
@@ -3535,8 +3538,8 @@ with only_when(compile_environment):
@depends(target)
def default_user_appdir(target):
if target.kernel in ("WINNT", "Darwin"):
- return "Mozilla"
- return ".mozilla"
+ return "Zen"
+ return ".zen"
option(
"--with-user-appdir",