summaryrefslogtreecommitdiffstats
path: root/xpcom/components/gen_static_components.py
diff options
context:
space:
mode:
Diffstat (limited to 'xpcom/components/gen_static_components.py')
-rw-r--r--xpcom/components/gen_static_components.py19
1 files changed, 14 insertions, 5 deletions
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.