Skip to content

Fix prevent session loss when library is closed after main window (#11073)#11129

Closed
Radless0 wants to merge 4 commits intozen-browser:devfrom
Radless0:fix-prevent-session-loss-when-library-is-closed-after-main-window
Closed

Fix prevent session loss when library is closed after main window (#11073)#11129
Radless0 wants to merge 4 commits intozen-browser:devfrom
Radless0:fix-prevent-session-loss-when-library-is-closed-after-main-window

Conversation

@Radless0
Copy link
Copy Markdown

@Radless0 Radless0 commented Nov 2, 2025

Closing the Library window after the main window used to clear the session state completely; this patch ensures session save is skipped for non-browser windows and adds a test to cover this scenario.

Fix: #11073

- Added check to skip session save from non-browser windows
- Added test to verify Library window doesn't clear session
- Fixes issue where closing Library window last loses tabs
@Radless0 Radless0 requested a review from mr-cheffy as a code owner November 2, 2025 22:02
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug labels Nov 2, 2025
@Radless0 Radless0 changed the title Fix prevent session loss when library is closed after main window Fix prevent session loss when library is closed after main window (Fix: #11073) Nov 2, 2025
@Radless0 Radless0 changed the title Fix prevent session loss when library is closed after main window (Fix: #11073) Fix prevent session loss when library is closed after main window (#11073) Nov 2, 2025
Comment thread src/zen/patches/fix-library-session.patch Outdated
Signed-off-by: Radless0 <54997703+Radless0@users.noreply.github.com>
@mr-cheffy
Copy link
Copy Markdown
Member

Would it also be interesting to also ignore private windows?

@Radless0
Copy link
Copy Markdown
Author

Radless0 commented Nov 4, 2025

Would it also be interesting to also ignore private windows?

As far as I know, private windows are already excluded from session restore by design, so I think it’s unnecessary to handle them here as well.

@mr-cheffy
Copy link
Copy Markdown
Member

I dont understand the patch then, because this check for "navigator:browser", isn't it done before by checking if __Ssi exists on the window's attributes?

@Radless0
Copy link
Copy Markdown
Author

Radless0 commented Nov 4, 2025

I dont understand the patch then, because this check for "navigator:browser", isn't it done before by checking if __Ssi exists on the window's attributes?

In Zen, private windows are handled as a completely separate process (Zen Private Browsing), so they don’t interact with the main session store at all, that’s why I didn’t include them in this patch.

As for the navigator:browser check in Zen, secondary windows like the Library still run inside the main process and may still expose session-related attributes such as __Ssi. That’s why the extra navigator:browser check is needed: it ensures only real browser windows affect the session state when closing.

@Radless0 Radless0 requested a review from mr-cheffy November 10, 2025 12:54
@mr-cheffy
Copy link
Copy Markdown
Member

Wouldn't it be more interesting to submit this patch to upstream firefox?

@mr-cheffy
Copy link
Copy Markdown
Member

This should've been fixed with window sync, but thanks for showing interest!

@mr-cheffy mr-cheffy closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs lost when closing main window before Library window

2 participants