From 102be6cd90ab0578ba555dd2e1e58cafcccb26a4 Mon Sep 17 00:00:00 2001 From: "mr. m" Date: Sun, 8 Feb 2026 13:15:42 +0100 Subject: [PATCH] fix: Remove psueod hidden browser background on close, b=no-bug, c=no-component --- src/zen/sessionstore/ZenSessionManager.sys.mjs | 15 +++++++++++++-- src/zen/sessionstore/ZenWindowSync.sys.mjs | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/zen/sessionstore/ZenSessionManager.sys.mjs b/src/zen/sessionstore/ZenSessionManager.sys.mjs index b617f010a..e8fb15186 100644 --- a/src/zen/sessionstore/ZenSessionManager.sys.mjs +++ b/src/zen/sessionstore/ZenSessionManager.sys.mjs @@ -52,6 +52,9 @@ class nsZenSidebarObject { } set data(data) { + if (typeof data !== "object") { + throw new Error("Sidebar data must be an object"); + } this.#sidebar = data; } } @@ -410,10 +413,11 @@ export class nsZenSessionManager { this.#collectWindowData(windows); // This would save the data to disk asynchronously or when // quitting the app. - this.#file.data = this.#sidebar; + let sidebar = this.#sidebar; + this.#file.data = sidebar; this.#file.saveSoon(); this.#debounceRegeneration(); - this.log(`Saving Zen session data with ${this.#sidebar.tabs?.length || 0} tabs`); + this.log(`Saving Zen session data with ${sidebar.tabs?.length || 0} tabs`); } /** @@ -514,6 +518,13 @@ export class nsZenSessionManager { this.#sidebar = sidebarData; } + /** + * Filters out tabs that are not useful to restore, such as empty tabs with no group association. + * If removeUnpinnedTabs is true, it also filters out unpinned tabs. + * + * @param {Array} tabs - The array of tab data objects to filter. + * @returns {Array} The filtered array of tab data objects. + */ #filterUnusedTabs(tabs) { return tabs.filter((tab) => { // We need to ignore empty tabs with no group association diff --git a/src/zen/sessionstore/ZenWindowSync.sys.mjs b/src/zen/sessionstore/ZenWindowSync.sys.mjs index d7d73ced1..71f34abb8 100644 --- a/src/zen/sessionstore/ZenWindowSync.sys.mjs +++ b/src/zen/sessionstore/ZenWindowSync.sys.mjs @@ -820,6 +820,9 @@ class nsZenWindowSync { ourBrowser.removeAttribute("zen-pseudo-hidden"); otherBrowser.setAttribute("zen-pseudo-hidden", "true"); callback(); + } else { + this.#maybeRemovePseudoImageForBrowser(ourBrowser); + ourBrowser.removeAttribute("zen-pseudo-hidden"); } resolve();