fix: Fixed tabs becoming empty tabs when switching between windows, b=bug #12421, c=no-component

This commit is contained in:
mr. m
2026-02-18 12:52:26 +01:00
parent 1d2a14f9e4
commit dd26ec1171
2 changed files with 12 additions and 14 deletions

View File

@@ -30,10 +30,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
3
);
const SHOULD_LOG_TAB_ENTRIES = Services.prefs.getBoolPref(
"zen.session-store.log-tab-entries",
false
);
const SHOULD_BACKUP_FILE = Services.prefs.getBoolPref("zen.session-store.backup-file", true);
const FILE_NAME = "zen-sessions.jsonlz4";
@@ -236,7 +232,7 @@ export class nsZenSessionManager {
this._shouldRunMigration = true;
await this.#getDataFromDBForMigration();
}
if (SHOULD_LOG_TAB_ENTRIES) {
if (Services.prefs.getBoolPref("zen.session-store.log-tab-entries", false)) {
for (const tab of this.#sidebar.tabs || []) {
this.log("Tab entry in session file:", tab);
}

View File

@@ -715,7 +715,7 @@ class nsZenWindowSync {
return;
}
lazy.TabStateCache.update(aOurTab.linkedBrowser.permanentKey, {
history: tabStateEntries,
history: Cu.cloneInto(tabStateEntries, {}),
});
};
// Running `swapBrowsersAndCloseOther` doesn't expect us to use the tab after
@@ -815,17 +815,19 @@ class nsZenWindowSync {
});
let promise = this.#createPseudoImageForBrowser(otherBrowser, mySrc);
await Promise.all([promiseToWait, promise]);
callback();
otherBrowser.setAttribute("zen-pseudo-hidden", "true");
ourBrowser.removeAttribute("zen-pseudo-hidden");
this.#maybeRemovePseudoImageForBrowser(ourBrowser);
} else {
ourBrowser.removeAttribute("zen-pseudo-hidden");
this.#maybeRemovePseudoImageForBrowser(ourBrowser);
lazy.setTimeout(() => {
otherBrowser.setAttribute("zen-pseudo-hidden", "true");
ourBrowser.removeAttribute("zen-pseudo-hidden");
this.#maybeRemovePseudoImageForBrowser(ourBrowser);
ourBrowser.focus();
resolve();
});
return;
}
ourBrowser.removeAttribute("zen-pseudo-hidden");
this.#maybeRemovePseudoImageForBrowser(ourBrowser);
resolve();
});
}