Re: Adding a New DevTools Domain

99 views
Skip to first unread message

Andrey Kosyakov

unread,
Jul 21, 2020, 5:13:46 PM7/21/20
to Joey Allen, Alexei Filippov, Dmitry Gozman, peterm...@chromium.org, Pavel Feldman, sig...@chromium.org, Yang Guo, chrome-debugging-protocol
chromium-dev -> bcc, +chrome-debugging-protocol 

On Tue, Jul 21, 2020 at 1:16 PM Joey Allen <allen...@gmail.com> wrote:
We are working on a research project related to browser security auditing, and the project requires us to implement a new domain for the DevTools framework. We have some experience in adding new DevTools domains in prior versions of Chromium (48.0.2528.1). However, the code has significantly changed in newer versions.  We have been following the Contribution to Devtools Guideline [1]. Unfortunately, the documentation is limited in terms of providing information related to adding a new protocol domain, and we are looking for some guidance on how to achieve this.
                                                                               
What we have done so far:                                                      
                                                                               
1) We added the initial C++ code to define the new inspector agent. The inspector agent we are interested in will reside in blink, so we added the code in third_party/blink/renderer/core/inspector.
                                                                               
2)  We modified the options list in the config file (third_party/blink/renderer/core/inspector/inspector_protocol_config.json) to include the new domain.                                                  
                                                                               
3) We have also defined the new domain in the file third_party/blink/public/devtools_protocol/browser_protocol.pdl using the new pdl format. 

1-3 sound right!
                                                            
4) We have modified third_party/blink/public/devtools_protocol/browser_protocol-1.3.json to include the new domain.                                                                

You don't need this one -- browser-protocol-1.3.json is a snapshot of version 1.3 that is used for backwards compatibility. You only need to modify the PDL and protocol config when adding new domains/methods.
                                                                                
5) Finally, we have verified that the generated code for the domain exists in out/content_shell/gen/third_party/blink/renderer/core/inspector/protocol/  and Chromium is compiling correctly.                                          
                                                                                  
However, when we try to enable this domain via CDP, we get the following error message:

{'code': -32601, 'message': "'Forensics.enable' wasn't found"}


You also need to instantiate the new agent that you've added -- for blink agents, this is done in WebDevToolsAgentImpl::AttachSession() in case of regular pages and in WorkerInspectorController::AttachSession() in case of workers.                                                                                    
 We will continue reviewing the DevTools code to try and identify any portions of the code that we need to further customize in order to implement the new domain into the DevTools framework. However, any guidance or documentation on how to implement a new DevTools domain and information on how to debug the issue would be greatly appreciated.                                                                                                                  
                                                                                  
[1] https://docs.google.com/document/d/1c-COD2kaK__5iMM5SEx-PzNA7HFmgttcYfOHHX0HaOM/edit

There isn't a doc on adding a new agent, but following a recent CL that was adding a new agent may help.

Best regards,
Andrey.


Reply all
Reply to author
Forward
0 new messages