From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- xpcom/components/gen_static_components.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'xpcom/components/gen_static_components.py') diff --git a/xpcom/components/gen_static_components.py b/xpcom/components/gen_static_components.py index f759dc3132..122b7b21ca 100644 --- a/xpcom/components/gen_static_components.py +++ b/xpcom/components/gen_static_components.py @@ -920,14 +920,18 @@ def gen_substs(manifests): cid_phf = PerfectHash(modules, PHF_SIZE, key=lambda module: module.cid.bytes) - contract_phf = PerfectHash(contracts, PHF_SIZE, key=lambda entry: entry.contract) + contract_phf = PerfectHash( + contracts, PHF_SIZE, key=lambda entry: entry.contract.encode() + ) js_services_phf = PerfectHash( - list(js_services.values()), PHF_SIZE, key=lambda entry: entry.js_name + list(js_services.values()), PHF_SIZE, key=lambda entry: entry.js_name.encode() ) protocol_handlers_phf = PerfectHash( - list(protocol_handlers.values()), TINY_PHF_SIZE, key=lambda entry: entry.scheme + list(protocol_handlers.values()), + TINY_PHF_SIZE, + key=lambda entry: entry.scheme.encode(), ) js_services_json = {} @@ -945,7 +949,7 @@ def gen_substs(manifests): substs["contract_count"] = len(contracts) substs["protocol_handler_count"] = len(protocol_handlers) - substs["default_protocol_handler_idx"] = protocol_handlers_phf.get_index("default") + substs["default_protocol_handler_idx"] = protocol_handlers_phf.get_index(b"default") gen_module_funcs(substs, module_funcs) @@ -954,6 +958,9 @@ def gen_substs(manifests): substs["component_jsms"] = ( "\n".join(" %s," % strings.entry_to_cxx(jsm) for jsm in sorted(jsms)) + "\n" ) + substs["define_has_component_jsms"] = ( + "#define HAS_COMPONENT_JSMS" if len(jsms) > 0 else "" + ) substs["component_esmodules"] = ( "\n".join( " %s," % strings.entry_to_cxx(esModule) for esModule in sorted(esModules) @@ -1021,7 +1028,9 @@ def gen_substs(manifests): key_length="aKey.Length()", ) - substs["js_services_json"] = json.dumps(js_services_json, sort_keys=True, indent=4) + substs["js_services_json"] = ( + json.dumps(js_services_json, sort_keys=True, indent=2) + "\n" + ) # Do this only after everything else has been emitted so we're sure the # string table is complete. -- cgit v1.2.3