Skip to content
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: Implement DOM.resolveNode #418

Open
krichprollsch opened this issue Feb 11, 2025 · 0 comments
Open

CDP: Implement DOM.resolveNode #418

krichprollsch opened this issue Feb 11, 2025 · 0 comments
Assignees
Labels
CDP Chrome Debug Protocol chromedp

Comments

@krichprollsch
Copy link
Member

krichprollsch commented Feb 11, 2025

chromedp uses many DOM functions.
#404 implements some of them.

It needs DOM.resolveNode.

The problem, in the respoonse, we have to pass a RemoteObject including an objectId.
This objectId is known by v8 and the inspector. It's a parameter of Runtime.callFunctionOn

Here is an exemple of usage between chromedp and Chrome:

-> {"id":20,"sessionId":"A8BA6EAFDAFC0F71CD0A74B005D2B221","method":"DOM.resolveNode","params":{"nodeId":8}}                                                                                                   
<- {"id":20,"result":{"object":{"type":"object","subtype":"node","className":"HTMLHtmlElement","description":"html","objectId":"2713442814437272602.2.1"}},"sessionId":"A8BA6EAFDAFC0F71CD0A74B005D2B221"}
-> {"id":21,"sessionId":"A8BA6EAFDAFC0F71CD0A74B005D2B221","method":"Runtime.callFunctionOn","params":{"functionDeclaration":"function attribute(n) {\n    return this[n];\n}\n","objectId":"2713442814437272602.2.1","arguments":[{"value":"outerHTML"}],"silent":true,"returnByValue":true}}

The question is: how do I get a RemoteObject including an objectId from a native Zig struct?

  1. get the object JSValue corresponding to the Zig's struct
  2. use inspector session wrapObject to get a RemoteObject

I tried to expose wrapObject but I'm struggled with the c++ return...
lightpanda-io/zig-v8-fork#36

@krichprollsch krichprollsch added CDP Chrome Debug Protocol chromedp labels Feb 11, 2025
@krichprollsch krichprollsch self-assigned this Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CDP Chrome Debug Protocol chromedp
Projects
None yet
Development

No branches or pull requests

1 participant