Repository navigation
fix: memory leak in integrated browser inspector sessions - #338228
Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits intoSep 28, 2026
Merged
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
Dmitriy Vasyura (dmitrivMS) merged 4 commits into
Conversation
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:
|
Copilot started reviewing on behalf of
Simon Siefke (SimonSiefke)
September 27, 2026 17:57
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The late evaluation-result path needs a regression test to prevent reintroducing stale session retention.
Review effort: Balanced
Findings: 1
What changed in this PR
Fixes inspector-session listener retention when cross-origin iframes close.
Changes:
- Tracks listeners in per-session disposable stores.
- Cleans listeners on session closure and ignores late asynchronous results.
- Adds lifecycle-focused unit tests.
| File | Description |
|---|---|
browserViewInspector.ts |
Adds session-scoped listener cleanup. |
browserViewInspector.test.ts |
Tests session and inspector disposal behavior. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Collaborator
|
Simon Siefke (@SimonSiefke) Thank you! |
Dmitriy Vasyura (dmitrivMS)
enabled auto-merge (squash)
September 28, 2026 11:08
Dmitriy Vasyura (dmitrivMS)
approved these changes
Sep 28, 2026
Dirk Bäumer (dbaeumer)
approved these changes
Sep 28, 2026
Sandeep Somavarapu (sandy081)
approved these changes
Sep 28, 2026
Dmitriy Vasyura (dmitrivMS)
merged commit Sep 28, 2026
9c965cd
into
microsoft:main
55 of 56 checks passed
Simon Siefke (SimonSiefke)
deleted the
fix/memory-leak-browserViewInspector-sessions
branch
September 29, 2026 11:15
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.

Details
When a cross-site iframe closes, the integrated browser removes its frame inspector but leaves the session event listener in the browser inspector's disposable store. The session and its callbacks remain there until the whole browser closes.
Change
Group event and close listeners by session and dispose that group when the session closes. Ignore late session results and attachments after disposal.
Before
Creating and removing a cross-site iframe 37 times adds 37 old DebugSession objects and two sets of 37 callbacks in the main process.
After
No more inspector-session or matching callback growth is detected in the same 37-cycle test.
Test Video
Seven iframe creation and removal cycles in the integrated browser.
test.mp4
AI disclosure: Model: GPT 6 Astra. Worktime: 31 min