Search code examples
remote-debugginggoogle-chrome-devtools

How do I get a `callFrameID` to pass to `Debugger.evaluateOnCallFrame`?


WebKit's Remote Debugging Protocol went 1.0 recently and I've been playing around with it a little, mostly out of curiosity and interest. I've thrown together a very basic recreation of Chrome's developer tools console as a replacement front-end, but I'm a little confused as to how I can execute code in a specific frame/window like Chrome's Dev Tools allow you to.

At the moment, I'm using the Runtime.evaluate method to execute my console input. This seems inadequate because of the aforementioned problem and it doesn't provide the command line API. I've discovered the Debugger.evaluateOnCallFrame method, which requires a callFrameID parameter. The only problem is, it doesn't seem possible to remotely acquire a list of callFrame objects to pass to this method.

I have a feeling I'm completely missing something here. Does anyone know the solution?


Solution

  • Have a look at the Debugger.paused event, which will give you an array of current call frames.