Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/browser/components/sessionstore/fix-library-session.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/browser/components/sessionstore/SessionStore.sys.mjs b/browser/components/sessionstore/SessionStore.sys.mjs
--- a/browser/components/sessionstore/SessionStore.sys.mjs
+++ b/browser/components/sessionstore/SessionStore.sys.mjs
@@ -2139,6 +2139,12 @@ var SessionStoreInternal = {
let closedWindowState = this._collectWindowData(aWindow);

if (closedWindowState) {
+ // Only save session state for actual browser windows (windowtype="navigator:browser")
+ // This prevents non-browser windows like Library (Places:Organizer) from affecting the session
+ if (aWindow.document.documentElement.getAttribute("windowtype") !== "navigator:browser") {
+ return;
+ }
+
let newWindowState;
if (
!lazy.SessionStartup.willRestore()
30 changes: 30 additions & 0 deletions src/zen/tests/sessionstore/browser_library_window_session.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

"use strict";

add_task(async function test_library_window_session() {
// Open a new window with some tabs
let win = await BrowserTestUtils.openNewBrowserWindow();
let tab1 = await BrowserTestUtils.addTab(win.gBrowser, "about:mozilla");
let tab2 = await BrowserTestUtils.addTab(win.gBrowser, "about:config");

// Open the library window
let libraryWin = await BrowserTestUtils.promiseLibraryWindow();

// Close the main browser window
await BrowserTestUtils.closeWindow(win);

// Wait a bit to ensure session is saved
await TestUtils.waitForTick();

// Close library window
await BrowserTestUtils.closeWindow(libraryWin);

// Get the state file directly to verify it has content
let state = SessionFile.read();
ok(state, "Session file should exist");
ok(state.windows?.length > 0, "Session should have windows");
ok(state.windows[0].tabs?.length >= 2, "Session should have our test tabs");
});