Skip to content

chore: generate the protocol channel types and use them in the client - #2049

Merged
Yury Semikhatsky (yury-s) merged 33 commits into
microsoft:mainfrom
yury-s:rewrite-protocol
Nov 17, 2026
Merged

Yury Semikhatsky (yury-s) merged 33 commits into
microsoft:mainfrom
yury-s:rewrite-protocol

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • scripts/generate_java_channels.js generates the protocol types (params, results, initializers, events, channels) from the upstream spec into com.microsoft.playwright.impl.protocol; generate_api.sh runs it, so verify_api.yml catches drift on a roll.
  • Every *Impl class sends commands through the generated channels instead of hand-built JsonObjects. No behaviour change intended.
  • The javadoc jar excludes all subpackages of impl (impl.junit was published before).

Hand-written changes are about 2k lines in 53 files; the rest is generated code.

Each ChannelOwner subclass now holds the generated <Type>Channel for its
protocol interface, so the per-class migrations to typed params can proceed
independently without touching each other's files.
…mpl, CredentialsImpl, ScreencastImpl, WebMCPImpl, SelectorsImpl, DebuggerImpl, BindingCall, JsonPipe, DisposableObject
…gh the connection

Utils.toProtocol(owner, options, params) reads the copied params with the
connection's Gson, so a locator mask's frame becomes the real FrameImpl. The
owner-less overload now refuses to read channel references instead of letting
Gson allocate a detached ChannelOwner.
… BrowserImpl, BrowserTypeImpl, Connection.Root
The generator writes one public class per file into
com.microsoft.playwright.impl.protocol, with the upstream names (no Protocol
prefix). The client uses the new package, and the owner classes and
ChannelOwner.sendMessage that the generated channels call are public.
Frame.expect params carry the handles of expectedValue, so they have to be
read with the connection's Gson. Adds a regression test.
@yury-s
Yury Semikhatsky (yury-s) merged commit 20502f5 into microsoft:main Nov 17, 2026
30 of 33 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