Skip to content

feat(browserType): throw on remote connectOverCDP(transport)#40997

Merged
pavelfeldman merged 1 commit into
microsoft:mainfrom
Skn0tt:feat-connect-over-cdp-transport-remote-check
May 26, 2026
Merged

feat(browserType): throw on remote connectOverCDP(transport)#40997
pavelfeldman merged 1 commit into
microsoft:mainfrom
Skn0tt:feat-connect-over-cdp-transport-remote-check

Conversation

@Skn0tt
Copy link
Copy Markdown
Member

@Skn0tt Skn0tt commented May 26, 2026

Summary

  • Throw an explicit error in connectOverCDP(transport) when the client is connected to a remote server.
  • The protocol declares transport: binary but the dispatcher uses as any on both sides to forward the live JS object — so it only works in-process. Over a wire the validator would coerce the transport to a Buffer and the server would fail downstream.
  • Mirrors the isRemote() guards in artifact.ts, video.ts, and elementHandle.ts.

Context: introduced in 8f50322 ("feat(browserType): allow passing a ConnectionTransport to connectOverCDP", #40972).

Passing a ConnectionTransport to connectOverCDP only works when client
and server share a heap: the protocol declares `transport: binary` but
the dispatcher uses `as any` to forward the live object with its
send/close/onmessage methods. Over a real wire the transport would be
coerced to a Buffer and the server would fail downstream with a
confusing error.

Add an isRemote() guard with a clear message, matching the pattern in
artifact.ts, video.ts, and elementHandle.ts.
@Skn0tt Skn0tt requested a review from yury-s May 26, 2026 08:33
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

7181 passed, 1113 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

7 flaky ⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@ubuntu-22.04-chromium-tip-of-tree`
⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@ubuntu-22.04-chromium-tip-of-tree`
⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/video.spec.ts:275 › screencast › should capture navigation `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:719 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-page] › page/page-leaks.spec.ts:85 › click should not leak `@firefox-ubuntu-22.04-node20`

43921 passed, 861 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants