fix(browsercontext): set closedStatus to closed after close#41806
Open
SebTardif wants to merge 2 commits into
Open
fix(browsercontext): set closedStatus to closed after close#41806SebTardif wants to merge 2 commits into
SebTardif wants to merge 2 commits into
Conversation
_didCloseInternal guarded on status === 'closed' but never set that value, so concurrent browserClosed and close both re-ran cleanup and emitted Close twice. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
dgozman
reviewed
Jul 16, 2026
dgozman
left a comment
Collaborator
There was a problem hiding this comment.
I don't think this test brings any value, but the fix itself is nice. Could you please remove the test?
dgozman: the fix is fine; the test does not add value.
Contributor
Author
Contributor
Test results for "MCP"3 failed 7757 passed, 1249 skipped Merge workflow run. |
Contributor
Test results for "tests 1"1 flaky49910 passed, 1158 skipped Merge workflow run. |
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.
Summary
BrowserContext._didCloseInternalguards on_closedStatus === 'closed', but that status was never set. ConcurrentbrowserClosed()andclose()(documented in the comment) both ran cleanup and emittedClosetwice (tracing.abort()twice, double fulfill of the close promise).Fix
Set
_closedStatus = 'closed'at the start of_didCloseInternalafter the early return, so a second entry is a no-op.Evidence (red / green)
Test plan
browserClosedemits servercloseoncebrowsercontext-basicsmoke still passes