Skip to content

browser: isolate favicon state by document - #336077

Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 3 commits into
mainfrom
agents/browser-favicon-lifecycle
Draft

Dmitriy Vasyura (dmitrivMS) wants to merge 3 commits into
mainfrom
agents/browser-favicon-lifecycle

Conversation

@dmitrivMS

@dmitrivMS Dmitriy Vasyura (dmitrivMS) commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator

Keep favicon work with its committed native document until that document is actually replaced.

  • Preserve the outgoing page's updates, in-flight requests, and history across aborted or diverted navigation.
  • Reject stale work after replacement, failure, or disposal.
  • Reacquire current-document candidates through the existing preload/frame helper when Electron suppresses unchanged favicon URL sets, including back/forward navigation.
  • Cover ownership, shared icons, candidate filtering, and history with focused unit/API tests and controlled Code OSS scenarios.

Favicon-only extraction from #335987, redesigned rather than copied. Based directly on main; no popup snapshot/version protocol or native-close cleanup from #336075.

Keep the committed favicon separate from pending navigation candidates. Promote candidates at commit, discard them on abort or failure, and reject superseded asynchronous requests without rewriting prior history.

Preserve same-document and replacement history, and cancel favicon work on native destruction. Cover the state transitions with focused unit tests and a browser API/CDP navigation scenario.

Separates favicon correctness from #335987 without introducing its snapshot protocol or the native-close fix in #336075.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 13, 2026 22:53
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added vscode-build VS Code build process issues engineering VS Code - Build / issue tracking / etc. labels Sep 13, 2026
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added this to the 1.139.0 milestone Sep 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Cancelling a pinned redirect leaves provisional favicon state active because subsequent cleanup events are suppressed.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 1 Medium severity

Open findings (1)
What changed in this PR

Separates committed and provisional favicon state for integrated browser navigations.

Changes:

  • Adds a document-aware favicon state manager.
  • Integrates favicon lifecycle handling with navigation and history.
  • Adds unit and browser API coverage.
File Description
browserFavicon.ts Implements favicon state isolation.
browserView.ts Connects favicon state to Electron navigation.
browserFavicon.test.ts Covers favicon transitions and races.
browser.cdp.test.ts Tests favicon behavior through CDP.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/vs/platform/browserView/electron-main/browserView.ts
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added the browser-integration Web browsing features integrated into VS Code (e.g. integrated browser) label Sep 13, 2026
Open an empty browser and attach CDP before navigating the local fixture. This keeps the favicon navigation test from depending on the separate initial URL/subscription handoff race that failed Linux CI.

Preserve all URL and icon assertions, history checks, and existing timeouts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/vs/platform/browserView/common/browserFavicon.ts Outdated
Comment thread src/vs/platform/browserView/common/browserFavicon.ts Outdated
Comment thread src/vs/platform/browserView/common/browserFavicon.ts Outdated
Invalidate favicon work only on document replacement, failure or disposal. Reacquire current-document candidates when Electron suppresses an unchanged URL set, while retaining native updates as the fast path.

Cover outgoing-page updates and requests, shared favicon URLs, navigation history, and native candidate filtering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: 3e8601c5 Current: dcc12c10

Changed (1)

imageCarousel/imageCarousel/SingleSection/Dark
Before After
before after

2 insignificant change(s) omitted (≤20 px, Δ≤2). See CI logs for details.

@dmitrivMS

Copy link
Copy Markdown
Collaborator Author

Validation follow-up for 6f0baf8:

  • Code OSS CI run 34797872609 succeeded. I verified all three named favicon API cases in the Linux, macOS, and Windows Electron logs.
  • Local validation: 44 unit tests, 21 browser API tests with two existing skips, and seven controlled Code OSS scenario groups / 12 behavior steps on Windows.
  • Old-native controls fail the shared-icon, outgoing-history, and held-first-icon assertions. The fix passes those controls' corresponding scenarios.

The separate popup-title handoff and raw-close cleanup remain outside this PR. Setup failures were retained separately rather than counted as favicon regressions or passing runs. The raw-close exception still belongs to #336075.

@saitanallensantiago26-beep

Keep favicon work with its committed native document until that document is actually replaced.

  • Preserve the outgoing page's updates, in-flight requests, and history across aborted or diverted navigation.
  • Reject stale work after replacement, failure, or disposal.
  • Reacquire current-document candidates through the existing preload/frame helper when Electron suppresses unchanged favicon URL sets, including back/forward navigation.
  • Cover ownership, shared icons, candidate filtering, and history with focused unit/API tests and controlled Code OSS scenarios.

Favicon-only extraction from #335987, redesigned rather than copied. Based directly on main; no popup snapshot/version protocol or native-close cleanup from #336075.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser-integration Web browsing features integrated into VS Code (e.g. integrated browser) engineering VS Code - Build / issue tracking / etc. vscode-build VS Code build process issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants