browser
browser copied to clipboard
CDP: Implement DOM.resolveNode
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?
- get the object JSValue corresponding to the Zig's struct
- use inspector session wrapObject to get a
RemoteObject
I tried to expose wrapObject
but I'm struggled with the c++ return...
https://github.com/lightpanda-io/zig-v8-fork/pull/36