-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py]: add patching rules for CDP code generator #16161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
The generator code originates from: I was going to suggest proposing this fix upstream to that repo instead... but I just looked, and our version has diverged somewhat from the original, so it probably makes sense to fix this here. (but you might want to open a PR there also). I also noticed there is a test suite in the upstream repo: https://github.com/HyperionGray/python-chrome-devtools-protocol/blob/master/generator/test_generate.py It might be worth pulling that into our repo's unit tests and update it to reflect changes like this. |
That's literally what I did... and thought :D
Sure, I'll do it when I get a chance. |
User description
💥 What does this PR do?
As far as I'm concerned, there are five
$ref
s in the CDP Documentation that incorrectly refer to their own domain. Specifically, one pertains to a method, and four pertain to events:DOM.resolveNode
backendNodeId
Debugger.scriptFailedToParse
scriptLanguage
Debugger.scriptParsed
scriptLanguage
debugSymbols
DOM.scrollableFlagUpdated
nodeId
Currently, the
generate.py
script correctly patches the method (DOM.resolveNode
), but fails to patch the events. This causes issues when subscribing to these events. For example:This PR adds rules to properly patch these events.
🔧 Implementation Notes
New rules have been added to patch the mentioned events, adhering to the original style.
💡 Additional Considerations
I'm unsure whether the order of event parameters will change in the future. If it does, we may need to update the code to match parameters by name rather than by index.
🔄 Types of changes
PR Type
Bug fix
Description
Fix CDP code generator patching for erroneous
$ref
s in eventsAdd patches for
Debugger.scriptFailedToParse
andscriptParsed
eventsAdd patch for
DOM.scrollableFlagUpdated
eventUpdate comments to reflect all patched domains
Diagram Walkthrough
File Walkthrough
generate.py
Add CDP event patching rules
py/generate.py
Debugger.scriptFailedToParse
andscriptParsed
events
DOM.scrollableFlagUpdated
event