Skip to content

chore: translate the client from the Node.js client line by line - #2067

Merged
Yury Semikhatsky (yury-s) merged 30 commits into
microsoft:mainfrom
yury-s:rewrite-oneshot
Nov 21, 2026
Merged

Yury Semikhatsky (yury-s) merged 30 commits into
microsoft:mainfrom
yury-s:rewrite-oneshot

Conversation

@yury-s

@yury-s Yury Semikhatsky (yury-s) commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Every client class in impl is now a line-by-line translation of its file in packages/playwright-core/src/client/ (same member order, upstream names, // Port of <file>.ts. header, // java: notes where Java differs), so a roll applies the upstream diff at the same place. Includes the leaf classes of chore: port the leaf classes of the client from the Node.js client #2059.
  • Helper files are ported too: Serialization follows serializers.ts; Headers, StringUtils, MimeType, Time, LocatorUtils live in impl.isomorphic; LongStandingScope, LocalUtils, ClientHelper, FileUtils follow their upstream files; Utils keeps only Java-specific helpers. Dead code is removed.
  • Not line by line, marked in the code: synchronous route handlers, Connect/JsonPipe (the connection pulls messages), UrlMatcher (globs are converted by the driver). The assertion classes are not retranslated yet.

Behaviour that now follows upstream

  • connectOverCDP defaults to a 30 s timeout (was 180 s).
  • APIRequestContext.get/post/... always send their own method, even after RequestOptions.setMethod.
  • Response.finished() waits for the page to close when the request fails after its response; APIResponse.ok() is true for 200-299 only.
  • A null header value throws Expected value of header "x" to be String, but "object" is found.
  • route.fulfill with a path takes the content type from the upstream table; the stack files of a trace go to tracesDir.
  • Long, Float, Throwable and primitive arrays serialize as evaluate arguments (byte[] as Int8Array).
  • Upstream error texts for maxRedirects, a missing upload file and an unsupported argument; four java: fixmes are dropped.

…ch, tracing and browser classes from the Node.js client
Serialization follows serializers.ts; Headers, StringUtils, MimeType, Time and LongStandingScope
follow their isomorphic files; LocalUtils, ClientHelper and FileUtils are completed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd tune the prompt a bit to keep as close to l2l as possible, even if that means that we are adding unused methods and implement features that were missing in the port.

A member without a Java caller is package-private at its upstream position; what Java cannot
express has a note there. Adds ClientInstrumentation and Coverage.
@yury-s

Copy link
Copy Markdown
Member Author

Done in c1771ee: every member of the ported upstream files is now in the Java file at its upstream position, used or not (package-private when nothing calls it). That includes clientInstrumentation.ts, coverage.ts and the full isomorphic helpers. What Java can't express (AbortSignal, zones, Symbol.asyncDispose, …) has a one-line // java: note at its position.

Still not ported: android.ts, electron.ts, WebSocketTransport, and the assertions (follow-up).

@yury-s
Yury Semikhatsky (yury-s) merged commit bd7262a into microsoft:main Nov 21, 2026
13 of 14 checks passed
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