Fixes #4822: Fix browser cleanup when remote browser connection enabled but no remote browser available #4824
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
This PR fixes issue #4822 where Chrome helper processes were not being properly cleaned up when remote browser connection was enabled but no remote browser was available.
Problem
When remote browser connection is enabled in settings but no remote browser is actually available, the code would:
disconnect()instead ofclose()the browserSolution
isUsingRemoteBrowserflag to track the actual connection type (not just the setting)closeBrowser()to use the actual connection type instead of just checking the settingresetBrowserState()is always called to properly clean up all stateTesting
Added unit tests that verify:
All tests pass and demonstrate the fix working correctly.
Changes
src/services/browser/BrowserSession.ts: Added connection tracking and fixed cleanup logicsrc/services/browser/__tests__/BrowserSession.test.ts: Added comprehensive test coverageFixes #4822
Important
Fixes browser cleanup logic in
BrowserSessionby tracking actual connection type and updating tests.isUsingRemoteBrowserflag inBrowserSessionto track actual connection type.closeBrowser()inBrowserSessionto useisUsingRemoteBrowserfor cleanup logic.resetBrowserState()is always called for proper cleanup.BrowserSession.test.tsto verify local browser closes when remote fallback is used.BrowserSession.ts: Connection tracking and cleanup logic.BrowserSession.test.ts: Comprehensive test coverage for connection scenarios.This description was created by
for d422915. You can customize this summary. It will automatically update as commits are pushed.