Preserve browser popup state across IPC handoff - #335987
Dmitriy Vasyura (dmitrivMS) wants to merge 9 commits into
Conversation
Reconcile native navigation state after dynamic event subscription and reject stale snapshots or already-included events. Preserve newer per-field updates, editor identity, and closure coupling, with deterministic model and production workbench/IPC coverage. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Async favicon completion can still overwrite newer navigation state, and reconciliation adds avoidable heavyweight IPC and screenshot work.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 1
Open findings (3)
What changed in this PR
This PR adds versioned browser navigation-state reconciliation across the main-process/renderer IPC boundary to recover popup state missed before subscription.
Changes:
- Versions navigation, title, loading, favicon events, and snapshots.
- Reconciles model state after event subscriptions while preserving editor lifecycle.
- Adds deterministic model and workbench regression coverage.
| File | Description |
|---|---|
browserAutoReloadFeatures.test.ts |
Versions mock navigation events. |
browserViewWorkbenchService.test.ts |
Tests popup handoff through IPC/workbench layers. |
browserViewModel.test.ts |
Updates model test state fixtures. |
browserEditorInput.test.ts |
Updates navigation event fixture. |
browserViewModelState.test.ts |
Tests snapshot/event ordering and closure. |
browserView.test.ts |
Updates browser model fixtures. |
browserViewWorkbenchService.ts |
Makes input disposal handling one-shot. |
browserView.ts (workbench) |
Adds per-field reconciliation and local events. |
browserView.ts (electron-main) |
Versions authoritative browser state updates. |
browserView.ts (platform) |
Extends browser state/event contracts with versions. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Guard asynchronous favicon application against newer requests and navigation. Use navigation-only snapshots and suppress unchanged loading notifications from snapshots while preserving native events. Add deterministic regressions for the review feedback on #335987. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Cross-host redirects can still retain or publish stale favicon state despite navigation invalidation.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 1
Open findings (1)
Use the pending navigation URL for redirect chains and invalidate favicon work before clearing authoritative state. Cover snapshots, history, late completions, same-host and subframe redirects, and rejected navigations through actual BrowserView handlers with an injectable native view factory. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Access main-process Electron APIs through its default export so BrowserView can be dynamically imported by the renderer unit runner with its injected native view. Reproduce the CI ESM linking failure and validate all 47 targeted tests with native ESM loading instead of CommonJS bundling. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Programmatic cross-host navigation can retain stale favicons, and title-only reconciliation emits false navigation events.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 2
Open findings (2)
Resolved findings (1)
Preserve pending favicon work for diverted previews and clear authoritative state for accepted programmatic navigation. Publish silently changed icons after commit without rewriting the old history entry. Reconcile title and favicon snapshots without synthetic navigation, while clearing restored label fallbacks. Cover Electron event order and real native-to-model delivery with deterministic ESM regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the committed favicon across provisional navigation and restore it when an uncommitted load stops, without reviving stale favicon requests. Complete registered cleanup when Electron has already cleared a closed view's WebContents. Add 13 regressions for abort ordering, model synchronization, and native/editor/window disposal. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Provisional favicon completions can still corrupt committed history or overwrite state after terminal navigation failure.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 2
Open findings (2)
|
Base:
|
Defer favicon history updates until navigation commits, including replacement entries and same-document updates during a pending load. Invalidate pending favicon requests and clear provisional icons on non-aborted main-frame failures. Add 14 regressions for commit, abort, history replacement, subframes, and failure/completion ordering. Addresses the additional favicon review feedback on #335987. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|


Summary
Fixes a race where a popup finishes loading before the workbench subscribes to its events, leaving the tab's title or loading state stale (smoke failure).
Initial navigation and
ERR_ABORTEDhandling are unchanged.Validation
Fixes #320443.