Hey,

if you need a reference for implementing directly against the Chrome 
Devtools, I wrote a small tool inspired by node-inspector that does exactly 
that - you start your script with "bugger my_script.js", this opens up a 
websocket server that is compatible with the devtools protocol. Then you 
can just open chrome://devtools/devtools.html?ws=127.0.0.1:8058/websocket 
in Chrome. No patching of anything required. You can find the source 
here: https://github.com/jkrems/bugger. Especially the mapping of data 
types between v8 debugger and RemoteObjects is quite tricky since the 
documentation is barely existing, but maybe you find something useful in 
there. If you have any further question, feel free to reach out to me 
directly.

Cheers,
Jan

On Wednesday, July 10, 2013 1:32:29 AM UTC+2, Adam Crabtree wrote:
>
> Howdy all,
>
> I have LinkedIn's blessing to work full-time for 2 weeks on building a 
> node.js addon[1] for remote Chrome Devtools debugging. Since I've never 
> built an addon, this is a rather ambitious task for my first addon, and 
> nearly everyone in the community would benefit from this, I thought I'd 
> solicit interest in working with me on it, either directly via pull 
> requests or indirectly by giving advice on building node.js addons.
>
> Details:
>
> Per Pavel Feldman of the Chrome Devtools team, it's possible, with 
> possibly some limited support from Chrome to decouple some APIs if 
> necessary. For me personally, the inability to use the native Chrome 
> debugger has always been a little frustrating, and this is my attempt to do 
> what I can to resolve it. Any non-trivial contributions will receive 
> Contributor permissions to accelerate collaboration.
>
> Pavel has also graciously provided me with the following high-level 
> overview of where to start:
>
> // Begin Quote
> There is not much info available. These are the rough hints for you (use 
> cs.chromium.org to navigate Blink source). Then we could chat over VC / 
> hangouts / Skype.
>
> [Compile]
> InspectorController is a container for remote debugging protocol agents. 
> We have one for the Page (InspectorController.cpp) and we have one for the 
> workers (WorkerInspectorController.cpp that has limited functionality). 
> Given that Node is more like a worker (pure JS execution environment), take 
> a look at that file for the list of agents to compile in your module 
> (InspectorDebuggerAgent, InspectorConsoleAgent, InspectorProfileAgent, 
> etc.). So you would need to compile all of them.
>
> These agents would pull ScriptDebugServer.cpp, ScriptProfiler.cpp, Script* 
> etc. These are wrappers around v8, should compile against v8.h. Some of 
> them (ScriptProfiler) and most of the agents will reference Node and that's 
> what we need to fix. In fact, most of them will pull Page, Document, Node 
> for no good reason and that's what we need to fix upstream, in Blink.
>
> You would also need to generate InspectorBackendDispatcher and 
> InspectorFrontend from devtools/protocol.json. First one will parse 
> incoming JSON messages and will dispatch them on controller's agents, 
> second will generate typed API for agents to send messages back. Some 
> tweaking would be necessary here as well since currently we generate a 
> giant dispatch and giant front-end instead of per-domain files. Having them 
> per-domain would let you only take what you really need.
>
> [Wire]
> Lets assume it all compiled. Now you need to instantiate this controller 
> and call dispatchMessageFromFrontend on it with every message from the 
> front-end. Front-end will issue them using web socket transport, so you 
> need to have a server web socket as a part of your Node module that would 
> accept connection and do the right thing to the messages (call 
> dispatchMessageFromFrontend). And for the way back, your m_frontendChannel 
> would need to send info back using that web socket.
>
> [Debugging]
> After compiling and wiring, console will start working. But you also need 
> to make things work while on breakpoint. For that, you would need to 
> implement runMessageLoopOnPause in your version of WorkerScriptDebugServer.
>
> As I mentioned, it is quite some work both downstream (in the Node module) 
> and upstream (to remove poor Blink dependencies from agents). But it might 
> be worth it.
>
> Regards
> Pavel
>
> // End Quote
>
>
> Feel free to submit pull requests or post issue to 
> https://github.com/crabdude/lookingglass
>
> Cheers,
>  Adam Crabtree
>
> [1] http://nodejs.org/api/addons.html
>
> -- 
> Better a little with righteousness 
>        than much gain with injustice.
> Proverbs 16:8 
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to