|
ChromeDevToolsProtocol
Google Chrome Developer Tools Protocol
The protocol is deprecated and its support is going to be finished. See below. IntroductionThe existing V8 Debugger Protocol is not sufficient to provide Google Chrome, Chromium, or any other browser that supports the protocol, with the capability of remote debugging via TCP/IP sockets. The V8 Debugger protocol covers only JavaScript debugging operations, and only within a single V8 virtual machine (VM). In reality, there can be one or more separate V8 VMs inside a Google Chrome instance, residing in different renderer processes. Also, retrieving URLs loaded in the browser tabs, inspecting or modifying the DOM tree are not covered by JavaScript operations. Because of these restrictions, the ChromeDevTools protocol has been created to enable the exchange of additional information between a remote debugger and the browser instance being debugged. The ChromeDevTools protocol can be used as a transport for other debugging-related protocols, including the existing V8 Debugger Protocol. The proposed protocol can be used as a transport for other debugging-related protocols, including the existing V8 Debugger Protocol. A single subsystem that uses ChromeDevTools protocol as a transport for its own debugging-related protocol is called a "Tool". A V8 VM Debugger, a DOM debugger, or a Developer Tools Service are examples of a Tool. Protocol NameProtocol is called 'ChromeDevTools Protocol'. The name is pretty overloaded though. You can be sure that you are using this protocol, if you are starting Google Chrome/Chromium with the following parameter: --remote-shell-port=<port> Compare with WebKit Remote Debugging Protocol. Protocol Message StructureFor simplicity of parsing, and higher human readability, the generic protocol message structure follows that of an HTTP request/response message (barring the Starting line): Header1 ... HeaderN <empty line> Content where <empty line> represents a single pair of the \r\n (CR LF) characters. A single header format is: <HeaderName>:<HeaderValue>CRLF Request/Response message headers
Content-Length (required) - the total length of the Сontent field in bytes. Tool (required) - a string specifying the Tool that will handle the message. Destination (optional) - a string that identifies the concrete application-specific host object in whose context the message should be handled. For a V8 debugger it can be an identifier of a Google Chrome tab running JavaScript code, and for Developer Tools Service it can be absent altogether because the content pertains to the global Google Chrome context rather than some specific object contained in the browser (e.g. the content can contain a request for the supported version of the Developer Tools protocol.) "0" (zero) is an invalid host object identifier, reserved for specific protocol purposes. Note: Tools may add other headers that they will extract while processing messages. Content The optional Content field value is unique to each command as well as the request/response message. For example, it can contain the V8 Debugger Protocol request/response JSON messages or some plain-text command for a simpler tool. The content must use the UTF8 charset. If this field is absent, the Content-Length header value must be 0. Establishing the Debugger ConnectionA remote debugger that supports the ChromeDevTools protocol, connects to a server socket opened by Google Chrome. A remote debugger sends a handshake message consisting of 23 ASCII characters, ChromeDevToolsHandshakeCRLF Google Chrome replies with the same 23-byte message. Once the connection is established, the remote debugger might want to query the list of tabs using the list_tabs command. Supported ToolsCurrently, all the supported Tools use JSON as the Content format. DevToolsServiceThis tool provides a remote debugger with information about the inspectable environment. Common DevToolsService JSON fields:
Available commands:
The following result codes are possible:
The request/response examples:
V8DebuggerThis tool enables communication between a remote debugger and the V8 debuggers running inside a Google Chrome instance. Common V8Debugger JSON fields:
Available commands:
The following result codes are possible:
The request/response examples:
Deprecation And RemovalThe new debug protocol "WebKit Remote Debug Protocol" is being developed to succeed ChromeDevTools protocol. ChromeDevTools protocol should be considered deprecated. Google Chrome/Chromium browser discontinued its support in 17.0.950.* version (between developer builds 111534 and 111559). The SDK and EclipseDebugger are going to simultaneously support both protocols behind the single interface starting from 0.3.0 version. | |||||||||||||||||||||||||||||||||
Looking at the source code of org.chromium.sdk.internal.transport.Message, Content-Length actually expresses the number of characters in the content, not the number of bytes.
I'm actually okay with that as it allows me to read all messages using a single reader and don't have to juggle a Reader and an InputStream?, but you should fix the docs.
Errata: response for "list_tabs" has wrong "command".
Your implementation of "backtrace" command uses a boolean argument named "inlineRefs", but it's not documented in the V8 protocol.
What's the response if the debugged target (i.e. Chromium) doesn't recognize the value of the Tool header?
{"command":"ping", "result":0, "data":"ok"}
I'm sending an "evaluate_javascript" command getting back a "debugger_command" response??!? any thoughts?
rolyv19: yup, it's compiling that "javascript:void(0);" from "evaluate_javascript" and sending you back an "afterCompile" event about it.
Are there any commands for dealing with updates to the DOM?
i don't get "navigated" event once the url get changed?? is it working
sroussey, this should be a feature files in Issues. Could you please file it?
manisha, yes, this is an important problem. we lost this functionality some time ago. I should be fixed in chrome soon. unfortunately I don't see a proper workaround until then
manisha, this problem seems to be fixed in chrome now.
As a developer, can we not remotely controle the browser? From my Java application i would like to connect to Chromium. And i would like to get Chromium renderer or Chromium itself in my Java GUI, and communicate using Object/Class/Method instead of doing it over TCP/UDP??
Shamun, I'm sorry but this seems to be very far beyond the scope of this project.
After successful handshake, which felt great, I send this and it gets ignored by chrome. Could you tell me how exactly should this request look like:
Content-Length:18 Tool:DevToolService?
I tried with and without quotes but nothing works. I encode with UTF8 using C# terminal I wrote. The handshake worked though. I am making my debugger support Chrome: www.remotedebugger.com
I found a way: Content-Length:22 Tool:DevToolsService?
{"command": "version"}
Soon google fans will have a new commercial debugger
Daniel www.remotedebugger.com
Hi Daniel
Good luck with your debugger! Should you have any questions about protocol stuff feel free to contact our http://groups.google.com/group/chromedevtools-dev group.
Also probably I should mention our recent plans on switching to a new protocol (known as WebInspector? protocol). This wiki page will be updated soon once I have a document to refer.
Peter
Thanks! Please keep it posted, I'll update my code as you guys update yours, no problem. I am very serious about adding support of google chrome to my debugger. I believe in it. And this wire protocol is very simple way to do it. All I need is 1 complete sample JSON command with header per "supported tool" and a list of commands, and I will just plug it all into an already functioning debugger. It's not that complicated. I think Google will only win if my debugger supports it.
I sent a request to join the group.
I saw a list of command in Remote-debugging section here: http://code.google.com/chrome/devtools/docs/remote-debugging.html May be you are referring to it.
They look interesting. They don't work if I run them under DevToolsService?. How can I run any one of them?
Cheers
Daniel www.remotedebugger.com
Daniel
If you need you always can spy on the current protocol right from the Eclipse IDE. You just have to enable "Show debugger network communication console" in debug launch configuration.
As to the new protocol -- yes, you found its reference. Unfortunately the announce is not here yet, so you'll have to wait for it to learn the details. New protocol won't work via the old transport protocol (DevToolsService?).
I suggest we move further discussion into chromedevtools-dev group, which is better for this.
Peter
Thanks I'll check eclipse and continue this discussion in the group Cheers Dan
Hi, I opended a TCP/IP socket with telnet semantics, handshaked ok, attached ok, and now I am trying to send some more complex commands. I am stuck even though I am using the syntax as eclipse plugin. How do I send a simple version command?
This is what I use:
{"command":"debugger_command","data":{"seq":100,"type":"request","command":"version"}}
Elias
Some more info, the actual socket string I am sending is:
Tool:V8Debugger? Destination:2 Content-Length:86
{"command":"debugger_command","data":{"seq":100,"type":"request","command":"version"}}
Hi Elias,
let's have this talk in a dedicated place: http://groups.google.com/group/chromedevtools-dev (I'll need to join it first I believe.) This is not a right place for such discussions.
Peter