diff options
Diffstat (limited to 'xpcom/components')
-rw-r--r-- | xpcom/components/StaticComponents.cpp.in | 15 | ||||
-rw-r--r-- | xpcom/components/gen_static_components.py | 19 | ||||
-rw-r--r-- | xpcom/components/nsIComponentManager.idl | 2 | ||||
-rw-r--r-- | xpcom/components/nsIServiceManager.idl | 3 |
4 files changed, 28 insertions, 11 deletions
diff --git a/xpcom/components/StaticComponents.cpp.in b/xpcom/components/StaticComponents.cpp.in index 7f3fee6859..d717b9f64a 100644 --- a/xpcom/components/StaticComponents.cpp.in +++ b/xpcom/components/StaticComponents.cpp.in @@ -83,9 +83,14 @@ const nsXPTInterface gInterfaces[] = { //# @interfaces@ }; +//# @define_has_component_jsms@ + +#ifdef HAS_COMPONENT_JSMS +// TODO: Remove this once m-c and c-c migrations finish (bug 1881887). const StringOffset gComponentJSMs[] = { //# @component_jsms@ }; +#endif const StringOffset gComponentESModules[] = { //# @component_esmodules@ @@ -148,9 +153,9 @@ static nsresult ConstructJSMOrESMComponent(const nsACString& aURI, (void**)aResult); } -static nsresult ConstructJSMComponent(const nsACString& aURI, - const char* aConstructor, - nsISupports** aResult) { +[[maybe_unused]] static nsresult ConstructJSMComponent(const nsACString& aURI, + const char* aConstructor, + nsISupports** aResult) { return ConstructJSMOrESMComponent<ComponentType::JSM>( aURI, aConstructor, aResult); } @@ -351,11 +356,15 @@ const StaticProtocolHandler* StaticProtocolHandler::Lookup(const nsACString& aSc /* static */ already_AddRefed<nsIUTF8StringEnumerator> StaticComponents::GetComponentJSMs() { +#ifdef HAS_COMPONENT_JSMS auto jsms = MakeUnique<nsTArray<nsCString>>(MOZ_ARRAY_LENGTH(gComponentJSMs)); for (const auto& entry : gComponentJSMs) { jsms->AppendElement(GetString(entry)); } +#else + auto jsms = MakeUnique<nsTArray<nsCString>>(0); +#endif nsCOMPtr<nsIUTF8StringEnumerator> result; MOZ_ALWAYS_SUCCEEDS(NS_NewAdoptingUTF8StringEnumerator(getter_AddRefs(result), 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. diff --git a/xpcom/components/nsIComponentManager.idl b/xpcom/components/nsIComponentManager.idl index 9abde9960c..6b921be004 100644 --- a/xpcom/components/nsIComponentManager.idl +++ b/xpcom/components/nsIComponentManager.idl @@ -99,6 +99,8 @@ interface nsIComponentManager : nsISupports /** * Returns a list of JSM URLs which are used to create components. This * should only be used in automation. + * + * TODO: Remove this once m-c and c-c migrations finish (bug 1881887). */ nsIUTF8StringEnumerator getComponentJSMs(); diff --git a/xpcom/components/nsIServiceManager.idl b/xpcom/components/nsIServiceManager.idl index dd613070e9..e327b49d79 100644 --- a/xpcom/components/nsIServiceManager.idl +++ b/xpcom/components/nsIServiceManager.idl @@ -59,9 +59,6 @@ interface nsIServiceManager : nsISupports %{C++ -// Observing xpcom autoregistration. Topics will be 'start' and 'stop'. -#define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration" - #ifdef MOZILLA_INTERNAL_API #include "nsXPCOM.h" #include "nsComponentManagerUtils.h" |