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 50eaaaacd6
commit 4bc6a5995a
2 changed files with 18 additions and 0 deletions

View File

@ -704,5 +704,10 @@ patches = [
# chrome: mac: Support locale configuration.
# https://github.com/chromiumembedded/cef/issues/3623
'name': 'mac_chrome_locale_3623'
},
{
# 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('/'))