-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cdp serialization / deserialization #123
Conversation
* Move serialization to CDP-side by using `generateWebDriverValue` in CallFunction, Evaluate and when serialization is needed. * Remove in-realm serialization / deserialization. * Reformatted some files. Not done: * Complete serialization tests. * Deserialization tests.
1fe5532
to
cec2924
Compare
Force WPT using the dev chrome channel
#initializePageLifecycleEventListener() { | ||
this.#cdpClient.Page.setLifecycleEventsEnabled({ enabled: true }); | ||
|
||
this.#cdpClient.Page.on('lifecycleEvent', async (params) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should there be .off calls for every .on call somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it out of scope of this PR. Ideally, we should subscribe to events only when user subscribed to them, and unsubscribe when user unsubscribed. But for now Mapper (as well as Puppeteer, AFAIK) just listens to all event and sends the needed to user.
// Primitive Protocol Value | ||
// https://w3c.github.io/webdriver-bidi/#data-types-protocolValue-primitiveProtocolValue | ||
case 'undefined': { | ||
return { unserializableValue: 'undefined' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does unserializableValue means? a value that cannot be deserialized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime.CallArgument. unserializableValue
is basically a string that is evaluated instead of being JSON-deserialized.
LGTM in general but I am not very familiar with the bidi spec to see if serialisation is correct. |
We delegate the serialization logic to CDP, but verify it in e2e tests. Deserialization is on the Mapper side, but it is tested by e2e as well. |
Use CDP
generateWebDriverValue
for serialization.The PR happened to be quite huge, as it involved lots of refactoring.
generateWebDriverValue
in CallFunction, Evaluate and when serialization is needed.