diff --git a/devtools/platform/components.conf b/devtools/platform/components.conf new file mode 100644 index 000000000000..7e7d451b832c --- /dev/null +++ b/devtools/platform/components.conf @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{ec5aa99c-7abb-4142-ac5f-aab2419e38e2}', + 'contract_ids': ['@mozilla.org/jsinspector;1'], + 'type': 'mozilla::jsinspector::nsJSInspector', + 'headers': ['/devtools/platform/nsJSInspector.h'], + }, +] diff --git a/devtools/platform/moz.build b/devtools/platform/moz.build index 5aad20065ea7..349f5554029c 100644 --- a/devtools/platform/moz.build +++ b/devtools/platform/moz.build @@ -16,4 +16,8 @@ SOURCES += [ 'nsJSInspector.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' diff --git a/devtools/platform/nsJSInspector.cpp b/devtools/platform/nsJSInspector.cpp index 298f61121e46..e4a1e92130f3 100644 --- a/devtools/platform/nsJSInspector.cpp +++ b/devtools/platform/nsJSInspector.cpp @@ -8,7 +8,6 @@ #include "nsThreadUtils.h" #include "jsfriendapi.h" #include "mozilla/HoldDropJSObjects.h" -#include "mozilla/ModuleUtils.h" #include "mozilla/dom/ScriptSettings.h" #include "nsServiceManagerUtils.h" #include "nsMemory.h" @@ -27,8 +26,6 @@ namespace mozilla { namespace jsinspector { -NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSInspector) - NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsJSInspector) NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsIJSInspector) @@ -121,18 +118,3 @@ nsJSInspector::GetLastNestRequestor(JS::MutableHandle out) { } // namespace jsinspector } // namespace mozilla - -NS_DEFINE_NAMED_CID(JSINSPECTOR_CID); - -static const mozilla::Module::CIDEntry kJSInspectorCIDs[] = { - {&kJSINSPECTOR_CID, false, nullptr, - mozilla::jsinspector::nsJSInspectorConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kJSInspectorContracts[] = { - {JSINSPECTOR_CONTRACTID, &kJSINSPECTOR_CID}, {nullptr}}; - -static const mozilla::Module kJSInspectorModule = { - mozilla::Module::kVersion, kJSInspectorCIDs, kJSInspectorContracts}; - -NSMODULE_DEFN(jsinspector) = &kJSInspectorModule; diff --git a/dom/file/uri/BlobURLProtocolHandler.cpp b/dom/file/uri/BlobURLProtocolHandler.cpp index b0547b5e185c..b722ff8ee7cf 100644 --- a/dom/file/uri/BlobURLProtocolHandler.cpp +++ b/dom/file/uri/BlobURLProtocolHandler.cpp @@ -17,7 +17,6 @@ #include "mozilla/dom/MediaSource.h" #include "mozilla/ipc/IPCStreamUtils.h" #include "mozilla/LoadInfo.h" -#include "mozilla/ModuleUtils.h" #include "mozilla/NullPrincipal.h" #include "mozilla/Preferences.h" #include "mozilla/SystemGroup.h" @@ -908,33 +907,6 @@ nsresult NS_GetSourceForMediaSourceURI(nsIURI* aURI, MediaSource** aSource) { namespace mozilla { namespace dom { -#define NS_BLOBPROTOCOLHANDLER_CID \ - { \ - 0xb43964aa, 0xa078, 0x44b2, { \ - 0xb0, 0x6b, 0xfd, 0x4d, 0x1b, 0x17, 0x2e, 0x66 \ - } \ - } - -NS_GENERIC_FACTORY_CONSTRUCTOR(BlobURLProtocolHandler) - -NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID); - -static const Module::CIDEntry kBlobURLProtocolHandlerCIDs[] = { - {&kNS_BLOBPROTOCOLHANDLER_CID, false, nullptr, - BlobURLProtocolHandlerConstructor}, - {nullptr}}; - -static const Module::ContractIDEntry kBlobURLProtocolHandlerContracts[] = { - {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME, - &kNS_BLOBPROTOCOLHANDLER_CID}, - {nullptr}}; - -static const Module kBlobURLProtocolHandlerModule = { - Module::kVersion, kBlobURLProtocolHandlerCIDs, - kBlobURLProtocolHandlerContracts}; - -NSMODULE_DEFN(BlobURLProtocolHandler) = &kBlobURLProtocolHandlerModule; - bool IsType(nsIURI* aUri, DataInfo::ObjectType aType) { DataInfo* info = GetDataInfoFromURI(aUri); if (!info) { diff --git a/dom/file/uri/FontTableURIProtocolHandler.cpp b/dom/file/uri/FontTableURIProtocolHandler.cpp index 3dd37f1822e8..6245352527a0 100644 --- a/dom/file/uri/FontTableURIProtocolHandler.cpp +++ b/dom/file/uri/FontTableURIProtocolHandler.cpp @@ -5,8 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "FontTableURIProtocolHandler.h" -#include "mozilla/ModuleUtils.h" +#include "nsIURIMutator.h" +#include "nsIUUIDGenerator.h" #include "nsNetUtil.h" +#include "nsSimpleURI.h" using namespace mozilla; using namespace mozilla::dom; @@ -112,31 +114,3 @@ FontTableURIProtocolHandler::NewURI(const nsACString &aSpec, uri.forget(aResult); return NS_OK; } - -#define NS_FONTTABLEPROTOCOLHANDLER_CID \ - { \ - 0x3fc8f04e, 0xd719, 0x43ca, { \ - 0x9a, 0xd0, 0x18, 0xee, 0x32, 0x02, 0x11, 0xf2 \ - } \ - } - -NS_GENERIC_FACTORY_CONSTRUCTOR(FontTableURIProtocolHandler) - -NS_DEFINE_NAMED_CID(NS_FONTTABLEPROTOCOLHANDLER_CID); - -static const mozilla::Module::CIDEntry FontTableURIProtocolHandlerCIDs[] = { - {&kNS_FONTTABLEPROTOCOLHANDLER_CID, false, nullptr, - FontTableURIProtocolHandlerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry - FontTableURIProtocolHandlerContracts[] = { - {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX FONTTABLEURI_SCHEME, - &kNS_FONTTABLEPROTOCOLHANDLER_CID}, - {nullptr}}; - -static const mozilla::Module FontTableURIProtocolHandlerModule = { - mozilla::Module::kVersion, FontTableURIProtocolHandlerCIDs, - FontTableURIProtocolHandlerContracts}; - -NSMODULE_DEFN(FontTableURIProtocolHandler) = &FontTableURIProtocolHandlerModule; diff --git a/dom/file/uri/components.conf b/dom/file/uri/components.conf new file mode 100644 index 000000000000..67b7f799bb66 --- /dev/null +++ b/dom/file/uri/components.conf @@ -0,0 +1,20 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{3fc8f04e-d719-43ca-9ad0-18ee320211f2}', + 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-fonttable'], + 'type': 'mozilla::dom::FontTableURIProtocolHandler', + 'headers': ['mozilla/dom/FontTableURIProtocolHandler.h'], + }, + { + 'cid': '{b43964aa-a078-44b2-b06b-fd4d1b172e66}', + 'contract_ids': ['@mozilla.org/network/protocol;1?name=blob'], + 'type': 'mozilla::dom::BlobURLProtocolHandler', + 'headers': ['mozilla/dom/BlobURLProtocolHandler.h'], + }, +] diff --git a/dom/file/uri/moz.build b/dom/file/uri/moz.build index 1bf3b9ccc673..bfd9c4e6024c 100644 --- a/dom/file/uri/moz.build +++ b/dom/file/uri/moz.build @@ -20,6 +20,10 @@ UNIFIED_SOURCES += [ 'FontTableURIProtocolHandler.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + LOCAL_INCLUDES += [ '/dom/file', '/netwerk/base', diff --git a/dom/media/webspeech/synth/moz.build b/dom/media/webspeech/synth/moz.build index 696881c83822..ab1136dbec29 100644 --- a/dom/media/webspeech/synth/moz.build +++ b/dom/media/webspeech/synth/moz.build @@ -38,10 +38,13 @@ if CONFIG['MOZ_WEBSPEECH']: if CONFIG['MOZ_WEBSPEECH_TEST_BACKEND']: UNIFIED_SOURCES += [ - 'test/FakeSynthModule.cpp', 'test/nsFakeSynthServices.cpp' ] + XPCOM_MANIFESTS += [ + 'test/components.conf', + ] + if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': DIRS += ['windows'] diff --git a/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp b/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp deleted file mode 100644 index 4bf356bc846d..000000000000 --- a/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nsIClassInfoImpl.h" -#include "SpeechDispatcherService.h" - -using namespace mozilla::dom; - -#define SPEECHDISPATCHERSERVICE_CID \ - { \ - 0x8817b1cf, 0x5ada, 0x43bf, { \ - 0xbd, 0x73, 0x60, 0x76, 0x57, 0x70, 0x3d, 0x0d \ - } \ - } - -#define SPEECHDISPATCHERSERVICE_CONTRACTID \ - "@mozilla.org/synthspeechdispatcher;1" - -// Defines SpeechDispatcherServiceConstructor -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( - SpeechDispatcherService, SpeechDispatcherService::GetInstanceForService) - -// Defines kSPEECHDISPATCHERSERVICE_CID -NS_DEFINE_NAMED_CID(SPEECHDISPATCHERSERVICE_CID); - -static const mozilla::Module::CIDEntry kCIDs[] = { - {&kSPEECHDISPATCHERSERVICE_CID, true, nullptr, - SpeechDispatcherServiceConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kContracts[] = { - {SPEECHDISPATCHERSERVICE_CONTRACTID, &kSPEECHDISPATCHERSERVICE_CID}, - {nullptr}}; - -static const mozilla::Module::CategoryEntry kCategories[] = { - {"speech-synth-started", "SpeechDispatcher Speech Synth", - SPEECHDISPATCHERSERVICE_CONTRACTID}, - {nullptr}}; - -static const mozilla::Module kModule = { - mozilla::Module::kVersion, - kCIDs, - kContracts, - kCategories, - nullptr, - nullptr, - nullptr, -}; - -NSMODULE_DEFN(synthspeechdispatcher) = &kModule; diff --git a/dom/media/webspeech/synth/speechd/components.conf b/dom/media/webspeech/synth/speechd/components.conf new file mode 100644 index 000000000000..56b01ba5cbc5 --- /dev/null +++ b/dom/media/webspeech/synth/speechd/components.conf @@ -0,0 +1,17 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{8817b1cf-5ada-43bf-bd73-607657703d0d}', + 'contract_ids': ['@mozilla.org/synthspeechdispatcher;1'], + 'singleton': True, + 'type': 'mozilla::dom::SpeechDispatcherService', + 'headers': ['/dom/media/webspeech/synth/speechd/SpeechDispatcherService.h'], + 'constructor': 'mozilla::dom::SpeechDispatcherService::GetInstanceForService', + 'categories': {"speech-synth-started": 'SpeechDispatcher Speech Synth'}, + }, +] diff --git a/dom/media/webspeech/synth/speechd/moz.build b/dom/media/webspeech/synth/speechd/moz.build index 51d675c10a48..5dc831883d6c 100644 --- a/dom/media/webspeech/synth/speechd/moz.build +++ b/dom/media/webspeech/synth/speechd/moz.build @@ -5,9 +5,13 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. UNIFIED_SOURCES += [ - 'SpeechDispatcherModule.cpp', 'SpeechDispatcherService.cpp' ] + +XPCOM_MANIFESTS += [ + 'components.conf', +] + include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/dom/media/webspeech/synth/test/FakeSynthModule.cpp b/dom/media/webspeech/synth/test/FakeSynthModule.cpp deleted file mode 100644 index c195748f3922..000000000000 --- a/dom/media/webspeech/synth/test/FakeSynthModule.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nsIClassInfoImpl.h" - -#include "nsFakeSynthServices.h" - -using namespace mozilla::dom; - -#define FAKESYNTHSERVICE_CID \ - { \ - 0xe7d52d9e, 0xc148, 0x47d8, { \ - 0xab, 0x2a, 0x95, 0xd7, 0xf4, 0x0e, 0xa5, 0x3d \ - } \ - } - -#define FAKESYNTHSERVICE_CONTRACTID "@mozilla.org/fakesynth;1" - -// Defines nsFakeSynthServicesConstructor -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR( - nsFakeSynthServices, nsFakeSynthServices::GetInstanceForService) - -// Defines kFAKESYNTHSERVICE_CID -NS_DEFINE_NAMED_CID(FAKESYNTHSERVICE_CID); - -static const mozilla::Module::CIDEntry kCIDs[] = { - {&kFAKESYNTHSERVICE_CID, true, nullptr, nsFakeSynthServicesConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kContracts[] = { - {FAKESYNTHSERVICE_CONTRACTID, &kFAKESYNTHSERVICE_CID}, {nullptr}}; - -static const mozilla::Module::CategoryEntry kCategories[] = { - {"speech-synth-started", "Fake Speech Synth", FAKESYNTHSERVICE_CONTRACTID}, - {nullptr}}; - -static void UnloadFakeSynthmodule() { nsFakeSynthServices::Shutdown(); } - -static const mozilla::Module kModule = { - mozilla::Module::kVersion, kCIDs, kContracts, kCategories, nullptr, nullptr, - UnloadFakeSynthmodule}; - -NSMODULE_DEFN(fakesynth) = &kModule; diff --git a/dom/media/webspeech/synth/test/components.conf b/dom/media/webspeech/synth/test/components.conf new file mode 100644 index 000000000000..f37e4eafae77 --- /dev/null +++ b/dom/media/webspeech/synth/test/components.conf @@ -0,0 +1,17 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{e7d52d9e-c148-47d8-ab2a-95d7f40ea53d}', + 'contract_ids': ['@mozilla.org/fakesynth;1'], + 'singleton': True, + 'type': 'mozilla::dom::nsFakeSynthServices', + 'headers': ['/dom/media/webspeech/synth/test/nsFakeSynthServices.h'], + 'constructor': 'mozilla::dom::nsFakeSynthServices::GetInstanceForService', + 'categories': {'speech-synth-started': 'Fake Speech Synth'}, + }, +] diff --git a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp index 2c7db5ec4ee0..e1d6a2bb4028 100644 --- a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp +++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp @@ -10,6 +10,7 @@ #include "SharedBuffer.h" #include "nsISimpleEnumerator.h" +#include "mozilla/ClearOnShutdown.h" #include "mozilla/dom/nsSynthVoiceRegistry.h" #include "mozilla/dom/nsSpeechTask.h" @@ -273,6 +274,7 @@ nsFakeSynthServices* nsFakeSynthServices::GetInstance() { if (!sSingleton) { sSingleton = new nsFakeSynthServices(); + ClearOnShutdown(&sSingleton); } return sSingleton; @@ -284,13 +286,5 @@ nsFakeSynthServices::GetInstanceForService() { return picoService.forget(); } -void nsFakeSynthServices::Shutdown() { - if (!sSingleton) { - return; - } - - sSingleton = nullptr; -} - } // namespace dom } // namespace mozilla diff --git a/dom/media/webspeech/synth/test/nsFakeSynthServices.h b/dom/media/webspeech/synth/test/nsFakeSynthServices.h index 9d059bc899f7..872ad0bb9fdb 100644 --- a/dom/media/webspeech/synth/test/nsFakeSynthServices.h +++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.h @@ -29,8 +29,6 @@ class nsFakeSynthServices : public nsIObserver { static already_AddRefed GetInstanceForService(); - static void Shutdown(); - private: virtual ~nsFakeSynthServices() = default; diff --git a/dom/plugins/base/components.conf b/dom/plugins/base/components.conf new file mode 100644 index 000000000000..4b90c78f4416 --- /dev/null +++ b/dom/plugins/base/components.conf @@ -0,0 +1,16 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{23e8fd98-a625-4b08-be1a-f7cc18a5b106}', + 'contract_ids': ['@mozilla.org/plugin/host;1'], + 'singleton': True, + 'type': 'nsPluginHost', + 'headers': ['nsPluginHost.h'], + 'constructor': 'nsPluginHost::GetInst', + }, +] diff --git a/dom/plugins/base/moz.build b/dom/plugins/base/moz.build index 57027479efee..b9a3e67b3009 100644 --- a/dom/plugins/base/moz.build +++ b/dom/plugins/base/moz.build @@ -38,7 +38,6 @@ UNIFIED_SOURCES += [ 'nsNPAPIPluginInstance.cpp', 'nsNPAPIPluginStreamListener.cpp', 'nsPluginInstanceOwner.cpp', - 'nsPluginModule.cpp', 'nsPluginStreamListenerPeer.cpp', 'nsPluginTags.cpp', ] @@ -67,6 +66,10 @@ else: 'nsPluginsDirUnix.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + LOCAL_INCLUDES += [ '/dom/base', '/dom/plugins/ipc', diff --git a/dom/plugins/base/nsPluginModule.cpp b/dom/plugins/base/nsPluginModule.cpp deleted file mode 100644 index 4648a7567aae..000000000000 --- a/dom/plugins/base/nsPluginModule.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nsPluginHost.h" -#include "nsPluginsCID.h" - -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPluginHost, nsPluginHost::GetInst) -NS_DEFINE_NAMED_CID(NS_PLUGIN_HOST_CID); - -static const mozilla::Module::CIDEntry kPluginCIDs[] = { - {&kNS_PLUGIN_HOST_CID, false, nullptr, nsPluginHostConstructor}, {nullptr}}; - -static const mozilla::Module::ContractIDEntry kPluginContracts[] = { - {MOZ_PLUGIN_HOST_CONTRACTID, &kNS_PLUGIN_HOST_CID}, {nullptr}}; - -static const mozilla::Module kPluginModule = {mozilla::Module::kVersion, - kPluginCIDs, kPluginContracts}; - -NSMODULE_DEFN(nsPluginModule) = &kPluginModule; diff --git a/dom/presentation/provider/PresentationDeviceProviderModule.cpp b/dom/presentation/provider/PresentationDeviceProviderModule.cpp deleted file mode 100644 index 4afa3c08d3ec..000000000000 --- a/dom/presentation/provider/PresentationDeviceProviderModule.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "MulticastDNSDeviceProvider.h" -#include "mozilla/ModuleUtils.h" - -#define MULTICAST_DNS_PROVIDER_CID \ - { \ - 0x814f947a, 0x52f7, 0x41c9, { \ - 0x94, 0xa1, 0x36, 0x84, 0x79, 0x72, 0x84, 0xac \ - } \ - } - -#define MULTICAST_DNS_PROVIDER_CONTRACT_ID \ - "@mozilla.org/presentation-device/multicastdns-provider;1" - -using mozilla::dom::presentation::MulticastDNSDeviceProvider; - -NS_GENERIC_FACTORY_CONSTRUCTOR(MulticastDNSDeviceProvider) -NS_DEFINE_NAMED_CID(MULTICAST_DNS_PROVIDER_CID); - -static const mozilla::Module::CIDEntry kPresentationDeviceProviderCIDs[] = { - {&kMULTICAST_DNS_PROVIDER_CID, false, nullptr, - MulticastDNSDeviceProviderConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry - kPresentationDeviceProviderContracts[] = { - {MULTICAST_DNS_PROVIDER_CONTRACT_ID, &kMULTICAST_DNS_PROVIDER_CID}, - {nullptr}}; - -static const mozilla::Module::CategoryEntry - kPresentationDeviceProviderCategories[] = { -#if defined(MOZ_WIDGET_COCOA) || defined(MOZ_WIDGET_ANDROID) - {PRESENTATION_DEVICE_PROVIDER_CATEGORY, "MulticastDNSDeviceProvider", - MULTICAST_DNS_PROVIDER_CONTRACT_ID}, -#endif - {nullptr}}; - -static const mozilla::Module kPresentationDeviceProviderModule = { - mozilla::Module::kVersion, kPresentationDeviceProviderCIDs, - kPresentationDeviceProviderContracts, - kPresentationDeviceProviderCategories}; - -NSMODULE_DEFN(PresentationDeviceProviderModule) = - &kPresentationDeviceProviderModule; diff --git a/dom/presentation/provider/components.conf b/dom/presentation/provider/components.conf new file mode 100644 index 000000000000..4ab5cbaad421 --- /dev/null +++ b/dom/presentation/provider/components.conf @@ -0,0 +1,20 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +categories = {} + +if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'android'): + categories["presentation-device-provider"] = "MulticastDNSDeviceProvider" + +Classes = [ + { + 'cid': '{814f947a-52f7-41c9-94a1-3684797284ac}', + 'contract_ids': ['@mozilla.org/presentation-device/multicastdns-provider;1'], + 'type': 'mozilla::dom::presentation::MulticastDNSDeviceProvider', + 'headers': ['/dom/presentation/provider/MulticastDNSDeviceProvider.h'], + 'categories': categories, + }, +] diff --git a/dom/presentation/provider/moz.build b/dom/presentation/provider/moz.build index 0a26a5b48c83..bae962a95ed5 100644 --- a/dom/presentation/provider/moz.build +++ b/dom/presentation/provider/moz.build @@ -12,7 +12,10 @@ EXTRA_COMPONENTS += [ UNIFIED_SOURCES += [ 'DeviceProviderHelpers.cpp', 'MulticastDNSDeviceProvider.cpp', - 'PresentationDeviceProviderModule.cpp', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] EXTRA_JS_MODULES.presentation += [ diff --git a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js index 2a9d08c27aa3..beb8592e530b 100644 --- a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js +++ b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js @@ -100,7 +100,7 @@ ContractHook.prototype = { this.unregister(); let prevContract = this.hookedMap.get(this._contractID).pop(); - if (prevContract.factory) { + if (prevContract.classID) { registrar.registerFactory(prevContract.classID, "", this._contractID, @@ -120,7 +120,11 @@ ContractHook.prototype = { } if (factory) { - registrar.unregisterFactory(classID, factory); + try { + registrar.unregisterFactory(classID, factory); + } catch (e) { + factory = null; + } } return { classID, factory }; diff --git a/extensions/cookie/components.conf b/extensions/cookie/components.conf new file mode 100644 index 000000000000..1e0075b1e52e --- /dev/null +++ b/extensions/cookie/components.conf @@ -0,0 +1,22 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Headers = [ + '/extensions/cookie/nsCookieModule.h', +] + +UnloadFunc = 'mozilla::CookieModuleDtor' + +Classes = [ + { + 'cid': '{4f6b5e00-0c36-11d5-a535-0010a401eb10}', + 'contract_ids': ['@mozilla.org/permissionmanager;1'], + 'singleton': True, + 'type': 'nsIPermissionManager', + 'constructor': 'nsPermissionManager::GetXPCOMSingleton', + 'headers': ['/extensions/cookie/nsPermissionManager.h'], + }, +] diff --git a/extensions/cookie/moz.build b/extensions/cookie/moz.build index 51f906e00777..079150c156fd 100644 --- a/extensions/cookie/moz.build +++ b/extensions/cookie/moz.build @@ -17,6 +17,10 @@ UNIFIED_SOURCES += [ 'nsPermissionManager.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + LOCAL_INCLUDES += [ '/caps', ] diff --git a/extensions/cookie/nsCookieModule.cpp b/extensions/cookie/nsCookieModule.cpp index 310b2e5b8eff..63c2db62bdeb 100644 --- a/extensions/cookie/nsCookieModule.cpp +++ b/extensions/cookie/nsCookieModule.cpp @@ -3,35 +3,10 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "mozilla/ModuleUtils.h" -#include "nsIServiceManager.h" -#include "nsPermissionManager.h" -#include "nsICategoryManager.h" #include "nsCookiePermission.h" -#include "nsString.h" -// Define the constructor function for the objects -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager, - nsPermissionManager::GetXPCOMSingleton) +namespace mozilla { -NS_DEFINE_NAMED_CID(NS_PERMISSIONMANAGER_CID); +void CookieModuleDtor() { nsCookiePermission::Shutdown(); } -static const mozilla::Module::CIDEntry kCookieCIDs[] = { - {&kNS_PERMISSIONMANAGER_CID, false, nullptr, - nsIPermissionManagerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kCookieContracts[] = { - {NS_PERMISSIONMANAGER_CONTRACTID, &kNS_PERMISSIONMANAGER_CID}, {nullptr}}; - -static void CookieModuleDtor() { nsCookiePermission::Shutdown(); } - -static const mozilla::Module kCookieModule = {mozilla::Module::kVersion, - kCookieCIDs, - kCookieContracts, - nullptr, - nullptr, - nullptr, - CookieModuleDtor}; - -NSMODULE_DEFN(nsCookieModule) = &kCookieModule; +} // namespace mozilla diff --git a/extensions/cookie/nsCookieModule.h b/extensions/cookie/nsCookieModule.h new file mode 100644 index 000000000000..a654a1c85707 --- /dev/null +++ b/extensions/cookie/nsCookieModule.h @@ -0,0 +1,19 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsCookieModule_h +#define nsCookieModule_h + +#include "nscore.h" + +namespace mozilla { + +void CookieModuleDtor(); + +} // namespace mozilla + +#endif + diff --git a/extensions/permissions/components.conf b/extensions/permissions/components.conf new file mode 100644 index 000000000000..ed04a893b32b --- /dev/null +++ b/extensions/permissions/components.conf @@ -0,0 +1,16 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{4ca6b67b-5cc7-4e71-a98a-97af1c134862}', + 'contract_ids': ['@mozilla.org/permissions/contentblocker;1'], + 'type': 'nsContentBlocker', + 'headers': ['/extensions/permissions/nsContentBlocker.h'], + 'init_method': 'Init', + 'categories': {'content-policy': '@mozilla.org/permissions/contentblocker;1'}, + }, +] diff --git a/extensions/permissions/moz.build b/extensions/permissions/moz.build index 14bc17b5c748..6860583da840 100644 --- a/extensions/permissions/moz.build +++ b/extensions/permissions/moz.build @@ -6,7 +6,10 @@ UNIFIED_SOURCES += [ 'nsContentBlocker.cpp', - 'nsModuleFactory.cpp', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] FINAL_LIBRARY = 'xul' diff --git a/extensions/permissions/nsModuleFactory.cpp b/extensions/permissions/nsModuleFactory.cpp deleted file mode 100644 index 3ed08e918a4d..000000000000 --- a/extensions/permissions/nsModuleFactory.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nsIServiceManager.h" -#include "nsContentBlocker.h" -#include "nsString.h" - -// Define the constructor function for the objects -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsContentBlocker, Init) - -NS_DEFINE_NAMED_CID(NS_CONTENTBLOCKER_CID); - -static const mozilla::Module::CIDEntry kPermissionsCIDs[] = { - {&kNS_CONTENTBLOCKER_CID, false, nullptr, nsContentBlockerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kPermissionsContracts[] = { - {NS_CONTENTBLOCKER_CONTRACTID, &kNS_CONTENTBLOCKER_CID}, {nullptr}}; - -static const mozilla::Module::CategoryEntry kPermissionsCategories[] = { - {"content-policy", NS_CONTENTBLOCKER_CONTRACTID, - NS_CONTENTBLOCKER_CONTRACTID}, - {nullptr}}; - -static const mozilla::Module kPermissionsModule = { - mozilla::Module::kVersion, kPermissionsCIDs, kPermissionsContracts, - kPermissionsCategories}; - -NSMODULE_DEFN(nsPermissionsModule) = &kPermissionsModule; diff --git a/extensions/pref/autoconfig/src/components.conf b/extensions/pref/autoconfig/src/components.conf new file mode 100644 index 000000000000..789a44b2e39b --- /dev/null +++ b/extensions/pref/autoconfig/src/components.conf @@ -0,0 +1,16 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{ba5bc4c6-1dd1-11b2-bb89-b844c6ec0339}', + 'contract_ids': ['@mozilla.org/readconfig;1'], + 'type': 'nsReadConfig', + 'headers': ['/extensions/pref/autoconfig/src/nsReadConfig.h'], + 'init_method': 'Init', + 'categories': {'pref-config-startup': 'ReadConfig Module'}, + }, +] diff --git a/extensions/pref/autoconfig/src/moz.build b/extensions/pref/autoconfig/src/moz.build index 3417269f0793..cb697f0c6615 100644 --- a/extensions/pref/autoconfig/src/moz.build +++ b/extensions/pref/autoconfig/src/moz.build @@ -6,11 +6,14 @@ UNIFIED_SOURCES += [ 'nsAutoConfig.cpp', - 'nsConfigFactory.cpp', 'nsJSConfigTriggers.cpp', 'nsReadConfig.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' FINAL_TARGET_FILES.defaults.autoconfig += [ diff --git a/extensions/pref/autoconfig/src/nsConfigFactory.cpp b/extensions/pref/autoconfig/src/nsConfigFactory.cpp deleted file mode 100644 index 3ad82ecbc7ac..000000000000 --- a/extensions/pref/autoconfig/src/nsConfigFactory.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nsReadConfig.h" -#include "nsIAppStartupNotifier.h" - -#define NS_READCONFIG_CID \ - { \ - 0xba5bc4c6, 0x1dd1, 0x11b2, { \ - 0xbb, 0x89, 0xb8, 0x44, 0xc6, 0xec, 0x03, 0x39 \ - } \ - } - -#define NS_READCONFIG_CONTRACTID "@mozilla.org/readconfig;1" - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsReadConfig, Init) - -NS_DEFINE_NAMED_CID(NS_READCONFIG_CID); - -static const mozilla::Module::CIDEntry kAutoConfigCIDs[] = { - {&kNS_READCONFIG_CID, false, nullptr, nsReadConfigConstructor}, {nullptr}}; - -static const mozilla::Module::ContractIDEntry kAutoConfigContracts[] = { - {NS_READCONFIG_CONTRACTID, &kNS_READCONFIG_CID}, {nullptr}}; - -static const mozilla::Module::CategoryEntry kAutoConfigCategories[] = { - {"pref-config-startup", "ReadConfig Module", NS_READCONFIG_CONTRACTID}, - {nullptr}}; - -static const mozilla::Module kAutoConfigModule = { - mozilla::Module::kVersion, kAutoConfigCIDs, kAutoConfigContracts, - kAutoConfigCategories}; - -NSMODULE_DEFN(nsAutoConfigModule) = &kAutoConfigModule; diff --git a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp index e2d985c247ab..9f60f2269d78 100644 --- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp @@ -72,6 +72,7 @@ #include "nsIPrefBranch.h" #include "nsNetUtil.h" #include "mozilla/dom/ContentParent.h" +#include "mozilla/Components.h" using mozilla::dom::ContentParent; using namespace mozilla; @@ -90,6 +91,14 @@ NS_INTERFACE_MAP_END NS_IMPL_CYCLE_COLLECTION(mozHunspell, mPersonalDictionary) +NS_IMPL_COMPONENT_FACTORY(mozHunspell) { + auto hunspell = MakeRefPtr(); + if (NS_SUCCEEDED(hunspell->Init())) { + return hunspell.forget().downcast(); + } + return nullptr; +} + template <> mozilla::CountingAllocatorBase::AmountType mozilla::CountingAllocatorBase::sAmount(0); diff --git a/extensions/spellcheck/src/components.conf b/extensions/spellcheck/src/components.conf new file mode 100644 index 000000000000..7fc73c1a1714 --- /dev/null +++ b/extensions/spellcheck/src/components.conf @@ -0,0 +1,20 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{56c778e4-1bee-45f3-a689-886692a97fe7}', + 'contract_ids': ['@mozilla.org/spellchecker/engine;1'], + 'type': 'mozHunspell', + }, + { + 'cid': '{7ef52eaf-b7e1-462b-87e2-5d1dbaca9048}', + 'contract_ids': ['@mozilla.org/spellchecker/personaldictionary;1'], + 'type': 'mozPersonalDictionary', + 'headers': ['/extensions/spellcheck/src/mozPersonalDictionary.h'], + 'init_method': 'Init', + }, +] diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build index 3eabf96c4a5f..1fa03d1c566b 100644 --- a/extensions/spellcheck/src/moz.build +++ b/extensions/spellcheck/src/moz.build @@ -11,7 +11,10 @@ UNIFIED_SOURCES += [ 'mozInlineSpellWordUtil.cpp', 'mozPersonalDictionary.cpp', 'mozSpellChecker.cpp', - 'mozSpellCheckerFactory.cpp', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] FINAL_LIBRARY = 'xul' diff --git a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp deleted file mode 100644 index 4b7dff4266c6..000000000000 --- a/extensions/spellcheck/src/mozSpellCheckerFactory.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "mozHunspell.h" -#include "mozPersonalDictionary.h" -#include "nsIFile.h" - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozHunspell, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(mozPersonalDictionary, Init) - -NS_DEFINE_NAMED_CID(MOZ_HUNSPELL_CID); -NS_DEFINE_NAMED_CID(MOZ_PERSONALDICTIONARY_CID); - -static const mozilla::Module::CIDEntry kSpellcheckCIDs[] = { - {&kMOZ_HUNSPELL_CID, false, nullptr, mozHunspellConstructor}, - {&kMOZ_PERSONALDICTIONARY_CID, false, nullptr, - mozPersonalDictionaryConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kSpellcheckContracts[] = { - {MOZ_HUNSPELL_CONTRACTID, &kMOZ_HUNSPELL_CID}, - {MOZ_PERSONALDICTIONARY_CONTRACTID, &kMOZ_PERSONALDICTIONARY_CID}, - {nullptr}}; - -const mozilla::Module kSpellcheckModule = { - mozilla::Module::kVersion, kSpellcheckCIDs, kSpellcheckContracts, nullptr}; - -NSMODULE_DEFN(mozSpellCheckerModule) = &kSpellcheckModule; diff --git a/gfx/src/components.conf b/gfx/src/components.conf new file mode 100644 index 000000000000..d1c5d69351b1 --- /dev/null +++ b/gfx/src/components.conf @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{a6cf9115-15b3-11d2-932e-00805f8add32}', + 'contract_ids': ['@mozilla.org/gfx/fontenumerator;1'], + 'type': 'nsThebesFontEnumerator', + 'headers': ['/gfx/src/nsThebesFontEnumerator.h'], + }, +] diff --git a/gfx/src/moz.build b/gfx/src/moz.build index 8c0e6b9a089a..75aea035e3c3 100644 --- a/gfx/src/moz.build +++ b/gfx/src/moz.build @@ -68,7 +68,6 @@ UNIFIED_SOURCES += [ 'nsRect.cpp', 'nsRegion.cpp', 'nsThebesFontEnumerator.cpp', - 'nsThebesGfxFactory.cpp', 'nsTransform2D.cpp', 'TiledRegion.cpp', ] @@ -78,6 +77,10 @@ SOURCES += [ 'nsDeviceContext.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + include('/ipc/chromium/chromium-config.mozbuild') LOCAL_INCLUDES += [ diff --git a/gfx/src/nsThebesGfxFactory.cpp b/gfx/src/nsThebesGfxFactory.cpp deleted file mode 100644 index 301876541d7d..000000000000 --- a/gfx/src/nsThebesGfxFactory.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "gfxPlatform.h" // for gfxPlatform -#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2 -#include "mozilla/Attributes.h" // for final -#include "mozilla/Module.h" // for Module, Module::CIDEntry, etc -#include "mozilla/ModuleUtils.h" -#include "mozilla/mozalloc.h" // for operator new -#include "nsCOMPtr.h" // for nsCOMPtr -#include "nsError.h" // for NS_ERROR_NO_AGGREGATION, etc -#include "nsGfxCIID.h" // for NS_FONT_ENUMERATOR_CID, etc -#include "nsID.h" // for NS_DEFINE_NAMED_CID, etc -#include "nsISupports.h" // for NS_DECL_ISUPPORTS, etc -#include "nsThebesFontEnumerator.h" // for nsThebesFontEnumerator - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsThebesFontEnumerator) - -NS_DEFINE_NAMED_CID(NS_FONT_ENUMERATOR_CID); - -static const mozilla::Module::CIDEntry kThebesCIDs[] = { - {&kNS_FONT_ENUMERATOR_CID, false, nullptr, - nsThebesFontEnumeratorConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kThebesContracts[] = { - {"@mozilla.org/gfx/fontenumerator;1", &kNS_FONT_ENUMERATOR_CID}, {nullptr}}; - -static const mozilla::Module kThebesModule = {mozilla::Module::kVersion, - kThebesCIDs, - kThebesContracts, - nullptr, - nullptr, - nullptr, - nullptr}; - -NSMODULE_DEFN(nsGfxModule) = &kThebesModule; diff --git a/js/ductwork/debugger/JSDebugger.cpp b/js/ductwork/debugger/JSDebugger.cpp index 9e6af1b54af2..4fcb1a681897 100644 --- a/js/ductwork/debugger/JSDebugger.cpp +++ b/js/ductwork/debugger/JSDebugger.cpp @@ -10,7 +10,6 @@ #include "jsapi.h" #include "jsfriendapi.h" #include "js/Wrapper.h" -#include "mozilla/ModuleUtils.h" #include "nsServiceManagerUtils.h" #include "nsMemory.h" @@ -26,8 +25,6 @@ namespace mozilla { namespace jsdebugger { -NS_GENERIC_FACTORY_CONSTRUCTOR(JSDebugger) - NS_IMPL_ISUPPORTS(JSDebugger, IJSDebugger) JSDebugger::JSDebugger() {} @@ -75,18 +72,3 @@ JSDebugger::AddClass(JS::Handle global, JSContext* cx) { } // namespace jsdebugger } // namespace mozilla - -NS_DEFINE_NAMED_CID(JSDEBUGGER_CID); - -static const mozilla::Module::CIDEntry kJSDebuggerCIDs[] = { - {&kJSDEBUGGER_CID, false, nullptr, - mozilla::jsdebugger::JSDebuggerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kJSDebuggerContracts[] = { - {JSDEBUGGER_CONTRACTID, &kJSDEBUGGER_CID}, {nullptr}}; - -static const mozilla::Module kJSDebuggerModule = { - mozilla::Module::kVersion, kJSDebuggerCIDs, kJSDebuggerContracts}; - -NSMODULE_DEFN(jsdebugger) = &kJSDebuggerModule; diff --git a/js/ductwork/debugger/components.conf b/js/ductwork/debugger/components.conf new file mode 100644 index 000000000000..16d3c450dc40 --- /dev/null +++ b/js/ductwork/debugger/components.conf @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{0365cbd5-d46e-4e94-a39f-83b63cd1a963}', + 'contract_ids': ['@mozilla.org/jsdebugger;1'], + 'type': 'mozilla::jsdebugger::JSDebugger', + 'headers': ['/js/ductwork/debugger/JSDebugger.h'], + }, +] diff --git a/js/ductwork/debugger/moz.build b/js/ductwork/debugger/moz.build index 0fb85f8b86ef..6309c202c231 100644 --- a/js/ductwork/debugger/moz.build +++ b/js/ductwork/debugger/moz.build @@ -19,6 +19,10 @@ SOURCES += [ 'JSDebugger.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + EXTRA_JS_MODULES += [ 'jsdebugger.jsm', ] diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index 8b87f36dc519..aad344bd3149 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -17,13 +17,13 @@ #include "mozilla/ArenaAllocator.h" #include "mozilla/ArrayUtils.h" #include "mozilla/Attributes.h" +#include "mozilla/Components.h" #include "mozilla/dom/PContent.h" #include "mozilla/HashFunctions.h" #include "mozilla/HashTable.h" #include "mozilla/Logging.h" #include "mozilla/Maybe.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/ModuleUtils.h" #include "mozilla/Omnijar.h" #include "mozilla/Preferences.h" #include "mozilla/ResultExtensions.h" @@ -5409,35 +5409,16 @@ static void InitVarCachePref(const nsACString& aName, float* aCache, // Module and factory stuff //=========================================================================== -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences, - Preferences::GetInstanceForService) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init) +NS_IMPL_COMPONENT_FACTORY(nsPrefLocalizedString) { + auto str = MakeRefPtr(); + if (NS_SUCCEEDED(str->Init())) { + return str.forget().downcast(); + } + return nullptr; +} -static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID); -static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID); +namespace mozilla { -static mozilla::Module::CIDEntry kPrefCIDs[] = { - {&kPrefServiceCID, true, nullptr, PreferencesConstructor, - Module::ALLOW_IN_SOCKET_PROCESS}, - {&kPrefLocalizedStringCID, false, nullptr, - nsPrefLocalizedStringConstructor}, - {nullptr}}; +void UnloadPrefsModule() { Preferences::Shutdown(); } -static mozilla::Module::ContractIDEntry kPrefContracts[] = { - {NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID, - Module::ALLOW_IN_SOCKET_PROCESS}, - {NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID}, - {nullptr}}; - -static void UnloadPrefsModule() { Preferences::Shutdown(); } - -static const mozilla::Module kPrefModule = {mozilla::Module::kVersion, - kPrefCIDs, - kPrefContracts, - nullptr, - nullptr, - nullptr, - UnloadPrefsModule, - Module::ALLOW_IN_SOCKET_PROCESS}; - -NSMODULE_DEFN(nsPrefModule) = &kPrefModule; +} diff --git a/modules/libpref/Preferences.h b/modules/libpref/Preferences.h index 68a58022edb6..14e0b95b314d 100644 --- a/modules/libpref/Preferences.h +++ b/modules/libpref/Preferences.h @@ -33,6 +33,8 @@ class nsPrefBranch; namespace mozilla { +void UnloadPrefsModule(); + // A typesafe version of PrefChangeFunc, with its data argument type deduced // from the type of the argument passed to RegisterCallback. // diff --git a/modules/libpref/components.conf b/modules/libpref/components.conf new file mode 100644 index 000000000000..4b8dff423af0 --- /dev/null +++ b/modules/libpref/components.conf @@ -0,0 +1,27 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Headers = [ + 'mozilla/Preferences.h', +] + +UnloadFunc = 'mozilla::UnloadPrefsModule' + +Classes = [ + { + 'cid': '{91ca2441-050f-4f7c-9df8-75b40ea40156}', + 'contract_ids': ['@mozilla.org/preferences-service;1'], + 'singleton': True, + 'type': 'mozilla::Preferences', + 'headers': ['mozilla/Preferences.h'], + 'constructor': 'mozilla::Preferences::GetInstanceForService', + }, + { + 'cid': '{064d9cee-1dd2-11b2-83e3-d25ab0193c26}', + 'contract_ids': ['@mozilla.org/pref-localizedstring;1'], + 'type': 'nsPrefLocalizedString', + }, +] diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build index 4e6694cd220e..f7055f38df49 100644 --- a/modules/libpref/moz.build +++ b/modules/libpref/moz.build @@ -36,6 +36,10 @@ UNIFIED_SOURCES += [ 'SharedPrefMap.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' diff --git a/netwerk/dns/mdns/libmdns/components.conf b/netwerk/dns/mdns/libmdns/components.conf new file mode 100644 index 000000000000..7eea221d06ee --- /dev/null +++ b/netwerk/dns/mdns/libmdns/components.conf @@ -0,0 +1,14 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{14a50f2b-7ff6-48a5-88e3-615fd111f5d3}', + 'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-info;1'], + 'type': 'mozilla::net::nsDNSServiceInfo', + 'headers': ['/netwerk/dns/mdns/libmdns/nsDNSServiceInfo.h'], + }, +] diff --git a/netwerk/dns/mdns/libmdns/moz.build b/netwerk/dns/mdns/libmdns/moz.build index fee67758dd63..b1e533e25fae 100644 --- a/netwerk/dns/mdns/libmdns/moz.build +++ b/netwerk/dns/mdns/libmdns/moz.build @@ -38,7 +38,10 @@ else: UNIFIED_SOURCES += [ 'nsDNSServiceInfo.cpp', - 'nsMulticastDNSModule.cpp', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp deleted file mode 100644 index 3a108abcbc66..000000000000 --- a/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#if defined(MOZ_WIDGET_COCOA) -# define ENABLE_DNS_SERVICE_DISCOVERY -#endif - -#include "mozilla/ModuleUtils.h" - -#ifdef ENABLE_DNS_SERVICE_DISCOVERY -# include "nsDNSServiceDiscovery.h" -#endif - -#include "nsDNSServiceInfo.h" - -#ifdef ENABLE_DNS_SERVICE_DISCOVERY -using mozilla::net::nsDNSServiceDiscovery; -# define DNSSERVICEDISCOVERY_CID \ - { \ - 0x8df43d23, 0xd3f9, 0x4dd5, { \ - 0xb9, 0x65, 0xde, 0x2c, 0xa3, 0xf6, 0xa4, 0x2c \ - } \ - } -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDNSServiceDiscovery, Init) -NS_DEFINE_NAMED_CID(DNSSERVICEDISCOVERY_CID); -#endif // ENABLE_DNS_SERVICE_DISCOVERY - -using mozilla::net::nsDNSServiceInfo; -#define DNSSERVICEINFO_CID \ - { \ - 0x14a50f2b, 0x7ff6, 0x48a5, { \ - 0x88, 0xe3, 0x61, 0x5f, 0xd1, 0x11, 0xf5, 0xd3 \ - } \ - } -NS_GENERIC_FACTORY_CONSTRUCTOR(nsDNSServiceInfo) -NS_DEFINE_NAMED_CID(DNSSERVICEINFO_CID); - -static const mozilla::Module::CIDEntry knsDNSServiceDiscoveryCIDs[] = { -#ifdef ENABLE_DNS_SERVICE_DISCOVERY - {&kDNSSERVICEDISCOVERY_CID, false, nullptr, - nsDNSServiceDiscoveryConstructor}, -#endif - {&kDNSSERVICEINFO_CID, false, nullptr, nsDNSServiceInfoConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry - knsDNSServiceDiscoveryContracts[] = { -#ifdef ENABLE_DNS_SERVICE_DISCOVERY - {DNSSERVICEDISCOVERY_CONTRACT_ID, &kDNSSERVICEDISCOVERY_CID}, -#endif - {DNSSERVICEINFO_CONTRACT_ID, &kDNSSERVICEINFO_CID}, - {nullptr}}; - -static const mozilla::Module::CategoryEntry knsDNSServiceDiscoveryCategories[] = - {{nullptr}}; - -static const mozilla::Module knsDNSServiceDiscoveryModule = { - mozilla::Module::kVersion, knsDNSServiceDiscoveryCIDs, - knsDNSServiceDiscoveryContracts, knsDNSServiceDiscoveryCategories}; - -NSMODULE_DEFN(nsDNSServiceDiscoveryModule) = &knsDNSServiceDiscoveryModule; diff --git a/netwerk/protocol/gio/components.conf b/netwerk/protocol/gio/components.conf new file mode 100644 index 000000000000..a8b9a50fb17e --- /dev/null +++ b/netwerk/protocol/gio/components.conf @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{ee706783-3af8-4d19-9e84-e2ebfe213480}', + 'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-gio'], + 'type': 'nsGIOProtocolHandler', + }, +] diff --git a/netwerk/protocol/gio/moz.build b/netwerk/protocol/gio/moz.build index 7a45898537ca..268d125dd3fc 100644 --- a/netwerk/protocol/gio/moz.build +++ b/netwerk/protocol/gio/moz.build @@ -8,6 +8,10 @@ SOURCES += [ 'nsGIOProtocolHandler.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' CXXFLAGS += CONFIG['TK_CFLAGS'] diff --git a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp index 85ef0ab9ba05..c34f209aee55 100644 --- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp +++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp @@ -7,7 +7,7 @@ * This code is based on original Mozilla gnome-vfs extension. It implements * input stream provided by GVFS/GIO. */ -#include "mozilla/ModuleUtils.h" +#include "mozilla/Components.h" #include "mozilla/NullPrincipal.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" @@ -32,6 +32,8 @@ #include #include +using namespace mozilla; + #define MOZ_GIO_SCHEME "moz-gio" #define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols" @@ -845,6 +847,14 @@ class nsGIOProtocolHandler final : public nsIProtocolHandler, NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver) +NS_IMPL_COMPONENT_FACTORY(nsGIOProtocolHandler) { + auto inst = MakeRefPtr(); + if (NS_SUCCEEDED(inst->Init())) { + return inst.forget().downcast(); + } + return nullptr; +} + nsresult nsGIOProtocolHandler::Init() { nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); if (prefs) { @@ -1013,30 +1023,3 @@ nsGIOProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic, } return NS_OK; } - -//----------------------------------------------------------------------------- - -#define NS_GIOPROTOCOLHANDLER_CID \ - { /* ee706783-3af8-4d19-9e84-e2ebfe213480 */ \ - 0xee706783, 0x3af8, 0x4d19, { \ - 0x9e, 0x84, 0xe2, 0xeb, 0xfe, 0x21, 0x34, 0x80 \ - } \ - } - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGIOProtocolHandler, Init) -NS_DEFINE_NAMED_CID(NS_GIOPROTOCOLHANDLER_CID); - -static const mozilla::Module::CIDEntry kVFSCIDs[] = { - {&kNS_GIOPROTOCOLHANDLER_CID, false, nullptr, - nsGIOProtocolHandlerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kVFSContracts[] = { - {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX MOZ_GIO_SCHEME, - &kNS_GIOPROTOCOLHANDLER_CID}, - {nullptr}}; - -static const mozilla::Module kVFSModule = {mozilla::Module::kVersion, kVFSCIDs, - kVFSContracts}; - -NSMODULE_DEFN(nsGIOModule) = &kVFSModule; diff --git a/parser/htmlparser/components.conf b/parser/htmlparser/components.conf new file mode 100644 index 000000000000..bf00428c4055 --- /dev/null +++ b/parser/htmlparser/components.conf @@ -0,0 +1,20 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Headers = [ + 'nsHTMLTags.h', +] + +UnloadFunc = 'nsHTMLTags::ReleaseTable' + +Classes = [ + { + 'cid': '{2ce606b0-bee6-11d1-aad9-00805f8a3e14}', + 'contract_ids': [], + 'type': 'nsParser', + 'headers': ['/parser/htmlparser/nsParser.h'], + }, +] diff --git a/parser/htmlparser/moz.build b/parser/htmlparser/moz.build index 46d61831431d..a582f967de8f 100644 --- a/parser/htmlparser/moz.build +++ b/parser/htmlparser/moz.build @@ -46,6 +46,10 @@ UNIFIED_SOURCES += [ 'nsScannerString.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' if CONFIG['CC_TYPE'] in ('clang', 'gcc'): diff --git a/security/manager/pki/components.conf b/security/manager/pki/components.conf new file mode 100644 index 000000000000..4850e1f17d8d --- /dev/null +++ b/security/manager/pki/components.conf @@ -0,0 +1,27 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{4bfaa9f0-1dd2-11b2-afae-a82cbaa0b606}', + 'contract_ids': ['@mozilla.org/security/nsASN1Tree;1'], + 'type': 'nsNSSASN1Tree', + 'headers': ['/security/manager/pki/nsASN1Tree.h'], + }, + { + 'cid': '{518e071f-1dd2-11b2-937e-c45f14def778}', + 'contract_ids': [ + '@mozilla.org/nsCertificateDialogs;1', + '@mozilla.org/nsClientAuthDialogs;1', + '@mozilla.org/nsGeneratingKeypairInfoDialogs;1', + '@mozilla.org/nsTokenDialogs;1', + '@mozilla.org/nsTokenPasswordDialogs;1', + ], + 'type': 'nsNSSDialogs', + 'headers': ['/security/manager/pki/nsNSSDialogs.h'], + 'init_method': 'Init', + }, +] diff --git a/security/manager/pki/moz.build b/security/manager/pki/moz.build index 7c3081d4ca61..93e5205f3a40 100644 --- a/security/manager/pki/moz.build +++ b/security/manager/pki/moz.build @@ -16,7 +16,10 @@ UNIFIED_SOURCES += [ 'nsASN1Tree.cpp', 'nsNSSDialogHelper.cpp', 'nsNSSDialogs.cpp', - 'nsPKIModule.cpp', +] + +XPCOM_MANIFESTS += [ + 'components.conf', ] LOCAL_INCLUDES += [ diff --git a/security/manager/pki/nsPKIModule.cpp b/security/manager/pki/nsPKIModule.cpp deleted file mode 100644 index ca081ad09dad..000000000000 --- a/security/manager/pki/nsPKIModule.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nsASN1Tree.h" -#include "nsNSSDialogs.h" - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNSSDialogs, Init) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsNSSASN1Tree) - -NS_DEFINE_NAMED_CID(NS_NSSDIALOGS_CID); -NS_DEFINE_NAMED_CID(NS_NSSASN1OUTINER_CID); - -static const mozilla::Module::CIDEntry kPKICIDs[] = { - {&kNS_NSSDIALOGS_CID, false, nullptr, nsNSSDialogsConstructor}, - {&kNS_NSSASN1OUTINER_CID, false, nullptr, nsNSSASN1TreeConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kPKIContracts[] = { - {NS_TOKENPASSWORDSDIALOG_CONTRACTID, &kNS_NSSDIALOGS_CID}, - {NS_CERTIFICATEDIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, - {NS_CLIENTAUTHDIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, - {NS_TOKENDIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, - {NS_GENERATINGKEYPAIRINFODIALOGS_CONTRACTID, &kNS_NSSDIALOGS_CID}, - {NS_ASN1TREE_CONTRACTID, &kNS_NSSASN1OUTINER_CID}, - {nullptr}}; - -static const mozilla::Module kPKIModule = {mozilla::Module::kVersion, kPKICIDs, - kPKIContracts}; - -NSMODULE_DEFN(PKI) = &kPKIModule; diff --git a/security/sandbox/common/SandboxSettings.cpp b/security/sandbox/common/SandboxSettings.cpp index 11c55d3cdb20..7e437953e264 100644 --- a/security/sandbox/common/SandboxSettings.cpp +++ b/security/sandbox/common/SandboxSettings.cpp @@ -6,11 +6,13 @@ #include "mozISandboxSettings.h" -#include "mozilla/ModuleUtils.h" +#include "mozilla/Components.h" #include "mozilla/Preferences.h" #include "prenv.h" +using namespace mozilla; + namespace mozilla { int GetEffectiveContentSandboxLevel() { @@ -72,20 +74,9 @@ NS_IMETHODIMP SandboxSettings::GetEffectiveContentSandboxLevel( return NS_OK; } -NS_GENERIC_FACTORY_CONSTRUCTOR(SandboxSettings) - -NS_DEFINE_NAMED_CID(MOZ_SANDBOX_SETTINGS_CID); - -static const mozilla::Module::CIDEntry kSandboxSettingsCIDs[] = { - {&kMOZ_SANDBOX_SETTINGS_CID, false, nullptr, SandboxSettingsConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kSandboxSettingsContracts[] = { - {MOZ_SANDBOX_SETTINGS_CONTRACTID, &kMOZ_SANDBOX_SETTINGS_CID}, {nullptr}}; - -static const mozilla::Module kSandboxSettingsModule = { - mozilla::Module::kVersion, kSandboxSettingsCIDs, kSandboxSettingsContracts}; - -NSMODULE_DEFN(SandboxSettingsModule) = &kSandboxSettingsModule; - } // namespace mozilla + + +NS_IMPL_COMPONENT_FACTORY(mozISandboxSettings) { + return MakeAndAddRef().downcast(); +} diff --git a/security/sandbox/common/components.conf b/security/sandbox/common/components.conf new file mode 100644 index 000000000000..fe8b07ca9699 --- /dev/null +++ b/security/sandbox/common/components.conf @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{5516303d-9007-45a0-94b9-940ef134a6e2}', + 'contract_ids': ['@mozilla.org/sandbox/sandbox-settings;1'], + 'type': 'mozISandboxSettings', + }, +] diff --git a/security/sandbox/common/moz.build b/security/sandbox/common/moz.build index a2fcba4cad22..10c1cf63f8f7 100644 --- a/security/sandbox/common/moz.build +++ b/security/sandbox/common/moz.build @@ -9,6 +9,10 @@ with Files('**'): UNIFIED_SOURCES += ['SandboxSettings.cpp'] +XPCOM_MANIFESTS += [ + 'components.conf', +] + XPIDL_SOURCES += [ 'mozISandboxSettings.idl', ] diff --git a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp index 4db5b3a31915..d2d64037f452 100644 --- a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp +++ b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp @@ -10,12 +10,14 @@ #include #include "mozilla/Assertions.h" -#include "mozilla/ModuleUtils.h" +#include "mozilla/Components.h" #include "nsCOMPtr.h" #include "nsPrintfCString.h" #include "nsTArray.h" #include "nsXULAppAPI.h" +using namespace mozilla; + namespace mozilla { class SandboxReportWrapper final : public mozISandboxReport { @@ -181,21 +183,8 @@ NS_IMETHODIMP SandboxReporterWrapper::Snapshot( return NS_OK; } -NS_GENERIC_FACTORY_CONSTRUCTOR(SandboxReporterWrapper) - -NS_DEFINE_NAMED_CID(MOZ_SANDBOX_REPORTER_CID); - -static const mozilla::Module::CIDEntry kSandboxReporterCIDs[] = { - {&kMOZ_SANDBOX_REPORTER_CID, false, nullptr, - SandboxReporterWrapperConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kSandboxReporterContracts[] = { - {MOZ_SANDBOX_REPORTER_CONTRACTID, &kMOZ_SANDBOX_REPORTER_CID}, {nullptr}}; - -static const mozilla::Module kSandboxReporterModule = { - mozilla::Module::kVersion, kSandboxReporterCIDs, kSandboxReporterContracts}; - -NSMODULE_DEFN(SandboxReporterModule) = &kSandboxReporterModule; - } // namespace mozilla + +NS_IMPL_COMPONENT_FACTORY(mozISandboxReporter) { + return MakeAndAddRef().downcast(); +} diff --git a/security/sandbox/linux/reporter/components.conf b/security/sandbox/linux/reporter/components.conf new file mode 100644 index 000000000000..7bd278f3498e --- /dev/null +++ b/security/sandbox/linux/reporter/components.conf @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{5118a6f9-2493-4f97-9552-620663e03cb3}', + 'contract_ids': ['@mozilla.org/sandbox/syscall-reporter;1'], + 'type': 'mozISandboxReporter', + }, +] diff --git a/security/sandbox/linux/reporter/moz.build b/security/sandbox/linux/reporter/moz.build index 5244b494d8fc..0a9c5cf3de50 100644 --- a/security/sandbox/linux/reporter/moz.build +++ b/security/sandbox/linux/reporter/moz.build @@ -14,6 +14,10 @@ SOURCES += [ 'SandboxReporterWrappers.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + LOCAL_INCLUDES += [ '/security/sandbox/linux', # SandboxLogging.h ] diff --git a/services/crypto/component/IdentityCryptoService.cpp b/services/crypto/component/IdentityCryptoService.cpp index 11668c579ec4..de1f7032753d 100644 --- a/services/crypto/component/IdentityCryptoService.cpp +++ b/services/crypto/component/IdentityCryptoService.cpp @@ -5,7 +5,6 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIIdentityCryptoService.h" -#include "mozilla/ModuleUtils.h" #include "nsServiceManagerUtils.h" #include "nsIThread.h" #include "nsThreadUtils.h" @@ -14,6 +13,7 @@ #include "nsString.h" #include "mozilla/ArrayUtils.h" // ArrayLength #include "mozilla/Base64.h" +#include "mozilla/Components.h" #include "ScopedNSSTypes.h" #include "NSSErrorsService.h" @@ -449,31 +449,14 @@ SignRunnable::Run() { return NS_OK; } +} // unnamed namespace // XPCOM module registration -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(IdentityCryptoService, Init) - -#define NS_IDENTITYCRYPTOSERVICE_CID \ - { \ - 0xbea13a3a, 0x44e8, 0x4d7f, { \ - 0xa0, 0xa2, 0x2c, 0x67, 0xf8, 0x4e, 0x3a, 0x97 \ - } \ +NS_IMPL_COMPONENT_FACTORY(nsIIdentityCryptoService) { + auto inst = MakeRefPtr(); + if (NS_SUCCEEDED(inst->Init())) { + return inst.forget().downcast(); } - -NS_DEFINE_NAMED_CID(NS_IDENTITYCRYPTOSERVICE_CID); - -const mozilla::Module::CIDEntry kCIDs[] = { - {&kNS_IDENTITYCRYPTOSERVICE_CID, false, nullptr, - IdentityCryptoServiceConstructor}, - {nullptr}}; - -const mozilla::Module::ContractIDEntry kContracts[] = { - {"@mozilla.org/identity/crypto-service;1", &kNS_IDENTITYCRYPTOSERVICE_CID}, - {nullptr}}; - -const mozilla::Module kModule = {mozilla::Module::kVersion, kCIDs, kContracts}; - -} // unnamed namespace - -NSMODULE_DEFN(identity) = &kModule; + return nullptr; +} diff --git a/services/crypto/component/components.conf b/services/crypto/component/components.conf new file mode 100644 index 000000000000..49a4b74d7a54 --- /dev/null +++ b/services/crypto/component/components.conf @@ -0,0 +1,13 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{bea13a3a-44e8-4d7f-a0a2-2c67f84e3a97}', + 'contract_ids': ['@mozilla.org/identity/crypto-service;1'], + 'type': 'nsIIdentityCryptoService', + }, +] diff --git a/services/crypto/component/moz.build b/services/crypto/component/moz.build index e91868118810..b6db8c8fea8c 100644 --- a/services/crypto/component/moz.build +++ b/services/crypto/component/moz.build @@ -14,4 +14,8 @@ SOURCES += [ 'IdentityCryptoService.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + FINAL_LIBRARY = 'xul' diff --git a/storage/build/components.conf b/storage/build/components.conf new file mode 100644 index 000000000000..13eb8b4bd9de --- /dev/null +++ b/storage/build/components.conf @@ -0,0 +1,25 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{bbbb1d61-438f-4436-92ed-8308e5830fb0}', + 'contract_ids': ['@mozilla.org/storage/service;1'], + 'singleton': True, + 'type': 'mozilla::storage::Service', + 'headers': ['/storage/mozStorageService.h'], + 'constructor': 'mozilla::storage::Service::getSingleton', + }, + { + 'cid': '{3b667ee0-d2da-4ccc-9c3d-95f2ca6a8b4c}', + 'contract_ids': ['@mozilla.org/storage/vacuum;1'], + 'singleton': True, + 'type': 'mozilla::storage::VacuumManager', + 'headers': ['/storage/VacuumManager.h'], + 'constructor': 'mozilla::storage::VacuumManager::getSingleton', + 'categories': {'idle-daily': 'MozStorage Vacuum Manager'}, + }, +] diff --git a/storage/build/moz.build b/storage/build/moz.build index 284cd7e3f574..27c61326d3d3 100644 --- a/storage/build/moz.build +++ b/storage/build/moz.build @@ -8,14 +8,10 @@ EXPORTS += [ 'mozStorageCID.h', ] -SOURCES += [ - 'mozStorageModule.cpp', +XPCOM_MANIFESTS += [ + 'components.conf', ] FINAL_LIBRARY = 'xul' -LOCAL_INCLUDES += [ - '..', -] - CXXFLAGS += CONFIG['SQLITE_CFLAGS'] diff --git a/storage/build/mozStorageModule.cpp b/storage/build/mozStorageModule.cpp deleted file mode 100644 index e57c7e4a80a4..000000000000 --- a/storage/build/mozStorageModule.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsCOMPtr.h" -#include "mozilla/ModuleUtils.h" - -#include "mozStorageService.h" -#include "mozStorageConnection.h" -#include "VacuumManager.h" - -#include "mozStorageCID.h" - -namespace mozilla { -namespace storage { - -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Service, Service::getSingleton) -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(VacuumManager, - VacuumManager::getSingleton) - -} // namespace storage -} // namespace mozilla - -NS_DEFINE_NAMED_CID(MOZ_STORAGE_SERVICE_CID); -NS_DEFINE_NAMED_CID(VACUUMMANAGER_CID); - -static const mozilla::Module::CIDEntry kStorageCIDs[] = { - {&kMOZ_STORAGE_SERVICE_CID, false, nullptr, - mozilla::storage::ServiceConstructor}, - {&kVACUUMMANAGER_CID, false, nullptr, - mozilla::storage::VacuumManagerConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kStorageContracts[] = { - {MOZ_STORAGE_SERVICE_CONTRACTID, &kMOZ_STORAGE_SERVICE_CID}, - {VACUUMMANAGER_CONTRACTID, &kVACUUMMANAGER_CID}, - {nullptr}}; - -static const mozilla::Module::CategoryEntry kStorageCategories[] = { - {"idle-daily", "MozStorage Vacuum Manager", VACUUMMANAGER_CONTRACTID}, - {nullptr}}; - -static const mozilla::Module kStorageModule = {mozilla::Module::kVersion, - kStorageCIDs, kStorageContracts, - kStorageCategories}; - -NSMODULE_DEFN(mozStorageModule) = &kStorageModule; diff --git a/tools/profiler/gecko/components.conf b/tools/profiler/gecko/components.conf new file mode 100644 index 000000000000..1584afc25465 --- /dev/null +++ b/tools/profiler/gecko/components.conf @@ -0,0 +1,15 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{25db9b8e-8123-4de1-b66d-8bbbedf2cdf4}', + 'contract_ids': ['@mozilla.org/tools/profiler;1'], + 'type': 'nsProfiler', + 'headers': ['/tools/profiler/gecko/nsProfiler.h'], + 'init_method': 'Init', + }, +] diff --git a/tools/profiler/gecko/nsProfilerFactory.cpp b/tools/profiler/gecko/nsProfilerFactory.cpp deleted file mode 100644 index 2835555490a4..000000000000 --- a/tools/profiler/gecko/nsProfilerFactory.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsProfiler.h" -#include "nsProfilerCIID.h" - -#include "mozilla/ModuleUtils.h" -#include "nsCOMPtr.h" - -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsProfiler, Init) - -NS_DEFINE_NAMED_CID(NS_PROFILER_CID); - -static const mozilla::Module::CIDEntry kProfilerCIDs[] = { - {&kNS_PROFILER_CID, false, nullptr, nsProfilerConstructor}, {nullptr}}; - -static const mozilla::Module::ContractIDEntry kProfilerContracts[] = { - {"@mozilla.org/tools/profiler;1", &kNS_PROFILER_CID}, {nullptr}}; - -static const mozilla::Module kProfilerModule = { - mozilla::Module::kVersion, kProfilerCIDs, kProfilerContracts}; - -NSMODULE_DEFN(nsProfilerModule) = &kProfilerModule; diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build index c417de5219db..f6a6617b060d 100644 --- a/tools/profiler/moz.build +++ b/tools/profiler/moz.build @@ -30,7 +30,6 @@ if CONFIG['MOZ_GECKO_PROFILER']: 'core/ProfilerMarkerPayload.cpp', 'core/RegisteredThread.cpp', 'gecko/ChildProfilerController.cpp', - 'gecko/nsProfilerFactory.cpp', 'gecko/nsProfilerStartParams.cpp', 'gecko/ProfilerChild.cpp', 'gecko/ProfilerIOInterposeObserver.cpp', @@ -42,6 +41,10 @@ if CONFIG['MOZ_GECKO_PROFILER']: 'core/memory_hooks.cpp', # conflicts with platform.h class Thread ] + XPCOM_MANIFESTS += [ + 'gecko/components.conf', + ] + if CONFIG['OS_TARGET'] == 'Darwin': # This file cannot be built in unified mode because it includes # "nsLocalFile.h", which pulls in a system header which uses a type diff --git a/xpfe/appshell/components.conf b/xpfe/appshell/components.conf new file mode 100644 index 000000000000..547f5e502874 --- /dev/null +++ b/xpfe/appshell/components.conf @@ -0,0 +1,21 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Classes = [ + { + 'cid': '{0099907d-123c-4853-a46a-43098b5fb68c}', + 'contract_ids': ['@mozilla.org/appshell/appShellService;1'], + 'type': 'nsAppShellService', + 'headers': ['/xpfe/appshell/nsAppShellService.h'], + }, + { + 'cid': '{79a2b7cc-f05b-4605-bfa0-fac54f27eec8}', + 'contract_ids': ['@mozilla.org/appshell/window-mediator;1'], + 'type': 'nsWindowMediator', + 'headers': ['/xpfe/appshell/nsWindowMediator.h'], + 'init_method': 'Init', + }, +] diff --git a/xpfe/appshell/moz.build b/xpfe/appshell/moz.build index a46feae97122..ca09649e4fd9 100644 --- a/xpfe/appshell/moz.build +++ b/xpfe/appshell/moz.build @@ -26,7 +26,6 @@ EXPORTS += [ ] UNIFIED_SOURCES += [ - 'nsAppShellFactory.cpp', 'nsAppShellService.cpp', 'nsAppShellWindowEnumerator.cpp', 'nsChromeTreeOwner.cpp', @@ -36,6 +35,10 @@ UNIFIED_SOURCES += [ 'nsXULWindow.cpp', ] +XPCOM_MANIFESTS += [ + 'components.conf', +] + LOCAL_INCLUDES += [ '/dom/base', '/dom/xul', diff --git a/xpfe/appshell/nsAppShellFactory.cpp b/xpfe/appshell/nsAppShellFactory.cpp deleted file mode 100644 index 0684a2c558d7..000000000000 --- a/xpfe/appshell/nsAppShellFactory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/ModuleUtils.h" -#include "nscore.h" -#include "nsIWindowMediator.h" - -#include "nsIAppShellService.h" -#include "nsAppShellService.h" -#include "nsWindowMediator.h" -#include "nsChromeTreeOwner.h" -#include "nsAppShellCID.h" - -NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppShellService) -NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowMediator, Init) - -NS_DEFINE_NAMED_CID(NS_APPSHELLSERVICE_CID); -NS_DEFINE_NAMED_CID(NS_WINDOWMEDIATOR_CID); - -static const mozilla::Module::CIDEntry kAppShellCIDs[] = { - {&kNS_APPSHELLSERVICE_CID, false, nullptr, nsAppShellServiceConstructor}, - {&kNS_WINDOWMEDIATOR_CID, false, nullptr, nsWindowMediatorConstructor}, - {nullptr}}; - -static const mozilla::Module::ContractIDEntry kAppShellContracts[] = { - {NS_APPSHELLSERVICE_CONTRACTID, &kNS_APPSHELLSERVICE_CID}, - {NS_WINDOWMEDIATOR_CONTRACTID, &kNS_WINDOWMEDIATOR_CID}, - {nullptr}}; - -static const mozilla::Module kAppShellModule = { - mozilla::Module::kVersion, - kAppShellCIDs, - kAppShellContracts, -}; - -NSMODULE_DEFN(appshell) = &kAppShellModule;