Repository navigation
gh-12140: Avoid reopening individually closed fully synced windows - #15904
briankeefe wants to merge 4 commits into
Conversation
|
|
||
| Before you set up your local development environment, **read our [Building Guidelines](https://docs.zen-browser.app/guides/building)**. Skipping them can lead to avoidable build errors. | ||
|
|
||
| For changes to window session restoration, cover both full window sync and |
| return; | ||
| } | ||
| if (!isLastWindow) { | ||
| if (lazy.gWindowSyncEnabled && !lazy.gSyncOnlyPinnedTabs) { |
There was a problem hiding this comment.
Why ignore !gSyncOnlyPinnedTabs?
There was a problem hiding this comment.
Kept the pinned-only check because those windows can still have their own unpinned tabs. Without it, those tabs wouldn’t come back on restart unless you used undo-close-window. Added a comment explaining that and removed the docs change.
There was a problem hiding this comment.
Can you reproduce the issue tho? Why do we need to do this and firefox doesnt have the same issue? Pretty sure the issue also happens when syncing normal tabs as well
|
I dont think this quite handles the issue nicely unfortunately, I did my own solution here that I think works best: #16047 Because this would only fix the issue if "restore pinned tabs" is false. Thanks tho! |
Refs #12140
Firefox marks windows closed in succession with
_shouldRestore, and SessionSaver puts them back into the saved open-window list unless a tab action clears the flag. With full Zen window sync, closing two windows individually and reopening Zen brings back two copies of the same tabs.The existing
maybeSaveClosedWindowhook now clears that flag for non-last normal windows only when all tabs are synced. The window stays in undo history, and the last normal window is still saved. Pinned-only and disabled sync keep their existing behavior. This targets the close-in-succession case, not launcher double-invocation or the other causes discussed in the issue.Added
browser_closed_window_restore.jsto check the persisted open-window list and closed-window history. In an isolated copy of Zen 1.22.3b with temporary profiles, the persisted-state assertions fail without the change and pass with it; closing both windows and restarting goes from two restored windows to one, with tabs preserved. Explicit two-window quit, crash recovery, undo-close-window, and pinned-only/disabled-sync checks also passed.I haven't run a full build of current dev or the new browser-chrome test. Runtime verification used the same close-hook change overlaid into the isolated installed-version copy; the installed browser and user's profile were untouched. Keeping this as a draft pending that validation.