feat(browserType): allow passing a ConnectionTransport to connectOverCDP#40972
Conversation
Adds a new overload to `BrowserType.connectOverCDP` that accepts a `ConnectionTransport` directly. The client detects the transport via duck-typing (presence of `send` and `close` methods) and dispatches through a separate internal channel method to the chromium-only implementation. The `ConnectionTransport` interface is only defined in the type overrides, not in the docs. This restores the functionality removed in microsoft#40195, but exposed via the existing public `connectOverCDP` method instead of a new method.
- Extract `_browserFromConnectResult` to share the post-channel Browser wiring between `_connectOverCDP` and `_connectOverCDPTransport`. - Replace the recursive `connectOverCDP` call in the options branch with a direct `_connectOverCDP` call. - Shorten the parameter name back to `endpointURLOrOptions`.
Test results for "MCP"7181 passed, 1113 skipped Merge workflow run. |
Test results for "tests 1"129 failed 5 flaky43782 passed, 861 skipped Merge workflow run. |
Summary
connectOverCDP(transport)overload that accepts aConnectionTransportdirectly, detected via duck-typing onsend/close.connectOverCDPTransportchannel; the public surface is only the new overload onconnectOverCDP.ConnectionTransportshape is defined only inutils/generate_types/overrides.d.ts, not in the docs.Restores functionality removed in #40195.