Fix mojom_ts_generator.py error with Python 3.11

This commit is contained in:
Marshall Greenblatt 2023-12-13 18:46:06 -05:00
parent 262a93b2f7
commit 206b7b1c95
2 changed files with 18 additions and 0 deletions

View File

@ -706,5 +706,10 @@ patches = [
# windows: Fix implicit conversion error when building cef_sandbox.
# https://chromium-review.googlesource.com/c/chromium/src/+/5120035
'name': 'base_allocator_5120035'
},
{
# Fix mojom_ts_generator.py error with Python 3.11.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1422178
'name': 'mojo_generator_1422178'
}
]

View File

@ -0,0 +1,13 @@
diff --git mojo/public/tools/bindings/generators/mojom_ts_generator.py mojo/public/tools/bindings/generators/mojom_ts_generator.py
index 98516f03276e4..a1bda9c021c52 100644
--- mojo/public/tools/bindings/generators/mojom_ts_generator.py
+++ mojo/public/tools/bindings/generators/mojom_ts_generator.py
@@ -177,6 +177,8 @@ def _GetWebUiModulePath(module):
path = module.metadata.get('webui_module_path')
if path is None or path == '/':
return path
+ if path == '':
+ return '/'
if _IsAbsoluteChromeResourcesPath(path):
return path.rstrip('/') + '/'
return '/{}/'.format(path.strip('/'))