Skip to content

Commit 380db03

Browse files
committed
[py]: add patching rules for CDP code generator
1 parent 4ecdae3 commit 380db03

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

py/generate.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,18 +1005,33 @@ def main(browser_protocol_path, js_protocol_path, output_path):
10051005

10061006
# Patch up CDP errors. It's easier to patch that here than it is to modify
10071007
# the generator code.
1008-
# 1. DOM includes an erroneous $ref that refers to itself.
1009-
# 2. Page includes an event with an extraneous backtick in the description.
1008+
# 1. ``Debugger`` includes 3 erroneous ``$ref``s that refer to itself.
1009+
# 2. ``DOM`` includes 2 erroneous ``$ref``s that refer to itself.
1010+
# 3. ``Page`` includes an event with an extraneous backtick in the description.
10101011
for domain in domains:
1011-
if domain.domain == 'DOM':
1012+
if domain.domain == 'Debugger':
1013+
for event in domain.events:
1014+
if event.name == 'scriptFailedToParse':
1015+
# Patch 1.1
1016+
event.parameters[16].ref = 'ScriptLanguage'
1017+
elif event.name == 'scriptParsed':
1018+
# Patch 1.2
1019+
event.parameters[17].ref = 'ScriptLanguage'
1020+
# Patch 1.3
1021+
event.parameters[18].items.ref = 'DebugSymbols'
1022+
elif domain.domain == 'DOM':
10121023
for cmd in domain.commands:
10131024
if cmd.name == 'resolveNode':
1014-
# Patch 1
1025+
# Patch 2.1
10151026
cmd.parameters[1].ref = 'BackendNodeId'
1027+
for event in domain.events:
1028+
if event.name == 'scrollableFlagUpdated':
1029+
# Patch 2.2
1030+
event.parameters[0].ref = 'NodeId'
10161031
elif domain.domain == 'Page':
10171032
for event in domain.events:
10181033
if event.name == 'screencastVisibilityChanged':
1019-
# Patch 2
1034+
# Patch 3
10201035
event.description = event.description.replace('`', '')
10211036

10221037
for domain in domains:

0 commit comments

Comments
 (0)