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"}
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
Best regards,
Andrey.