Skip to content

CDP: Implement DOM.resolveNode #418

Closed
@krichprollsch

Description

@krichprollsch

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions