Finish browser state cleanup after native page closure - #336075
Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits intoSep 15, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
Dmitriy Vasyura (dmitrivMS) merged 2 commits into
Conversation
Guard against Electron clearing a WebContentsView's WebContents before the destroyed callback, so registered cleanup still completes. Extend the existing native popup lifecycle smoke test to reject the reported disposal exception after restart. Fixes #320443. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Dmitriy Vasyura (dmitrivMS)
September 13, 2026 22:24
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused guard addresses the reported lifecycle race and is covered by an appropriate native smoke test.
Review tier: Balanced (auto)
Findings: None
Note
Copilot is running an experiment and ran this review at Balanced.
What changed in this PR
Prevents an unhandled main-process error when Electron clears a browser view’s webContents during native closure.
Changes:
- Guards native
webContentscleanup during disposal. - Extends the popup lifecycle smoke test to detect the regression.
| File | Description |
|---|---|
src/vs/platform/browserView/electron-main/browserView.ts |
Safely handles missing native web contents during disposal. |
test/smoke/src/areas/browserView/browserView.test.ts |
Verifies disposal does not log the reported exception. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Dmitriy Vasyura (dmitrivMS)
marked this pull request as ready for review
September 13, 2026 22:57
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 13, 2026 22:57
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Kyle Cutler (@kycutler)Matched files:
Joaquín Ruales (@jruales)Matched files:
|
Dmitriy Vasyura (dmitrivMS)
requested review from
Joaquín Ruales (jruales) and
Kyle Cutler (kycutler)
September 13, 2026 23:11
Dmitriy Vasyura (dmitrivMS)
removed request for
Joaquín Ruales (jruales) and
Kyle Cutler (kycutler)
September 15, 2026 07:12
Giuseppe Cianci (Giuspepe)
approved these changes
Sep 15, 2026
Dmitriy Vasyura (dmitrivMS)
deleted the
agents/browser-native-close-cleanup-320443
branch
September 15, 2026 07:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoid an unhandled main-process error when Electron has already cleared a browser view's WebContents during native closure. Guard the native close call so registered cleanup still completes.
Strengthen the existing popup lifecycle smoke test to catch the reported disposal exception after restart.
Fixes #320443