@@ -64,6 +64,23 @@ def old_chrome(chrome_milestone):
6464 return str (int (new_chrome (chrome_milestone )) - 3 )
6565
6666
67+ def flatten_browser_pdl (file_path , chrome_version ):
68+ """Fetches all included domain .pdl files and concatenates them."""
69+ with open (file_path , "r" ) as file :
70+ content = file .read ()
71+ # Find all include lines
72+ includes = re .findall (r"include domains/([A-Za-z0-9_]+\.pdl)" , content )
73+ base_url = f"https://raw.githubusercontent.com/chromium/chromium/{ chrome_version } /third_party/blink/public/devtools_protocol/domains/"
74+ concatenated = ""
75+ for domain_file in includes :
76+ url = base_url + domain_file
77+ response = http .request ("GET" , url )
78+ concatenated += response .data .decode ("utf-8" ) + "\n "
79+ # Overwrite the file with concatenated domains
80+ with open (file_path , "w" ) as file :
81+ file .write (concatenated )
82+
83+
6784def add_pdls (chrome_milestone ):
6885 source_dir = (
6986 root_dir / f"common/devtools/chromium/v{ previous_chrome (chrome_milestone )} "
@@ -84,6 +101,10 @@ def add_pdls(chrome_milestone):
84101 f"{ target_dir } /browser_protocol.pdl" ,
85102 )
86103
104+ flatten_browser_pdl (
105+ f"{ target_dir } /browser_protocol.pdl" , chrome_milestone ["version" ]
106+ )
107+
87108 deps_content = http .request (
88109 "GET" ,
89110 f"https://raw.githubusercontent.com/chromium/chromium/{ chrome_milestone ['version' ]} /DEPS" ,
0 commit comments