Backout most of bug 1524687 for Windows PGO xpcshell selftest failures. r=backout
authorKris Maglione <maglione.k@gmail.com>
Thu, 14 Feb 2019 17:17:36 -0800
changeset 459522 3c3aeedfe69d8f743eef876afc98ac3c013f43d5
parent 459521 9a2965532d7b9d38cb645cba4550759695acc883
child 459523 7fdcdef438710bd7f93ed000c397a7f6646ca975
push id35562
push usercsabou@mozilla.com
push dateFri, 15 Feb 2019 18:40:35 +0000
treeherdermozilla-central@8961019ee4c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1524687
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout most of bug 1524687 for Windows PGO xpcshell selftest failures. r=backout
devtools/platform/components.conf
devtools/platform/moz.build
devtools/platform/nsJSInspector.cpp
dom/file/uri/BlobURLProtocolHandler.cpp
dom/file/uri/FontTableURIProtocolHandler.cpp
dom/file/uri/components.conf
dom/file/uri/moz.build
dom/media/webspeech/synth/moz.build
dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp
dom/media/webspeech/synth/speechd/components.conf
dom/media/webspeech/synth/speechd/moz.build
dom/media/webspeech/synth/test/FakeSynthModule.cpp
dom/media/webspeech/synth/test/components.conf
dom/media/webspeech/synth/test/nsFakeSynthServices.cpp
dom/media/webspeech/synth/test/nsFakeSynthServices.h
dom/plugins/base/components.conf
dom/plugins/base/moz.build
dom/plugins/base/nsPluginModule.cpp
dom/presentation/provider/PresentationDeviceProviderModule.cpp
dom/presentation/provider/components.conf
dom/presentation/provider/moz.build
dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js
extensions/cookie/components.conf
extensions/cookie/moz.build
extensions/cookie/nsCookieModule.cpp
extensions/cookie/nsCookieModule.h
extensions/permissions/components.conf
extensions/permissions/moz.build
extensions/permissions/nsModuleFactory.cpp
extensions/pref/autoconfig/src/components.conf
extensions/pref/autoconfig/src/moz.build
extensions/pref/autoconfig/src/nsConfigFactory.cpp
extensions/spellcheck/hunspell/glue/mozHunspell.cpp
extensions/spellcheck/src/components.conf
extensions/spellcheck/src/moz.build
extensions/spellcheck/src/mozSpellCheckerFactory.cpp
gfx/src/components.conf
gfx/src/moz.build
gfx/src/nsThebesGfxFactory.cpp
js/ductwork/debugger/JSDebugger.cpp
js/ductwork/debugger/components.conf
js/ductwork/debugger/moz.build
modules/libpref/Preferences.cpp
modules/libpref/Preferences.h
modules/libpref/components.conf
modules/libpref/moz.build
netwerk/dns/mdns/libmdns/components.conf
netwerk/dns/mdns/libmdns/moz.build
netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp
netwerk/protocol/gio/components.conf
netwerk/protocol/gio/moz.build
netwerk/protocol/gio/nsGIOProtocolHandler.cpp
parser/htmlparser/components.conf
parser/htmlparser/moz.build
security/manager/pki/components.conf
security/manager/pki/moz.build
security/manager/pki/nsPKIModule.cpp
security/sandbox/common/SandboxSettings.cpp
security/sandbox/common/components.conf
security/sandbox/common/moz.build
security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
security/sandbox/linux/reporter/components.conf
security/sandbox/linux/reporter/moz.build
services/crypto/component/IdentityCryptoService.cpp
services/crypto/component/components.conf
services/crypto/component/moz.build
storage/build/components.conf
storage/build/moz.build
storage/build/mozStorageModule.cpp
tools/profiler/gecko/components.conf
tools/profiler/gecko/nsProfilerFactory.cpp
tools/profiler/moz.build
xpfe/appshell/components.conf
xpfe/appshell/moz.build
xpfe/appshell/nsAppShellFactory.cpp
deleted file mode 100644
--- a/devtools/platform/components.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- 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'],
-    },
-]
--- a/devtools/platform/moz.build
+++ b/devtools/platform/moz.build
@@ -11,13 +11,9 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'jsinspector'
 
 SOURCES += [
     'nsJSInspector.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 FINAL_LIBRARY = 'xul'
--- a/devtools/platform/nsJSInspector.cpp
+++ b/devtools/platform/nsJSInspector.cpp
@@ -3,16 +3,17 @@
  * 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 "nsJSInspector.h"
 #include "nsIXPConnect.h"
 #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"
 #include "nsArray.h"
 #include "nsTArray.h"
 
 #define JSINSPECTOR_CONTRACTID "@mozilla.org/jsinspector;1"
 
@@ -21,16 +22,18 @@
     0xec5aa99c, 0x7abb, 0x4142, {                    \
       0xac, 0x5f, 0xaa, 0xb2, 0x41, 0x9e, 0x38, 0xe2 \
     }                                                \
   }
 
 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)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSInspector)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsJSInspector)
@@ -113,8 +116,23 @@ nsJSInspector::GetEventLoopNestLevel(uin
 NS_IMETHODIMP
 nsJSInspector::GetLastNestRequestor(JS::MutableHandle<JS::Value> out) {
   out.set(mLastRequestor);
   return NS_OK;
 }
 
 }  // 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;
--- a/dom/file/uri/BlobURLProtocolHandler.cpp
+++ b/dom/file/uri/BlobURLProtocolHandler.cpp
@@ -12,16 +12,17 @@
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/dom/Exceptions.h"
 #include "mozilla/dom/BlobImpl.h"
 #include "mozilla/dom/IPCBlobUtils.h"
 #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"
 #include "nsClassHashtable.h"
 #include "nsContentUtils.h"
 #include "nsError.h"
 #include "nsIAsyncShutdown.h"
 #include "nsIException.h"  // for nsIStackFrame
@@ -902,16 +903,43 @@ nsresult NS_GetSourceForMediaSourceURI(n
   RefPtr<MediaSource> mediaSource = info->mMediaSource;
   mediaSource.forget(aSource);
   return NS_OK;
 }
 
 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) {
     return false;
   }
 
   return info->mObjectType == aType;
 }
--- a/dom/file/uri/FontTableURIProtocolHandler.cpp
+++ b/dom/file/uri/FontTableURIProtocolHandler.cpp
@@ -1,19 +1,17 @@
 /* -*- 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 "FontTableURIProtocolHandler.h"
-#include "nsIURIMutator.h"
-#include "nsIUUIDGenerator.h"
+#include "mozilla/ModuleUtils.h"
 #include "nsNetUtil.h"
-#include "nsSimpleURI.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 /* static */ nsresult FontTableURIProtocolHandler::GenerateURIString(
     nsACString &aUri) {
   nsresult rv;
   nsCOMPtr<nsIUUIDGenerator> uuidgen =
@@ -109,8 +107,36 @@ FontTableURIProtocolHandler::NewURI(cons
   if (NS_FAILED(uri->SchemeIs(FONTTABLEURI_SCHEME, &schemeIs)) || !schemeIs) {
     NS_WARNING("Non-fonttable spec in FontTableURIProtocolHandler");
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   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;
deleted file mode 100644
--- a/dom/file/uri/components.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- 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'],
-    },
-]
--- a/dom/file/uri/moz.build
+++ b/dom/file/uri/moz.build
@@ -15,20 +15,16 @@ EXPORTS.mozilla.dom += [
 
 UNIFIED_SOURCES += [
     'BlobURL.cpp',
     'BlobURLChannel.cpp',
     'BlobURLProtocolHandler.cpp',
     'FontTableURIProtocolHandler.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 LOCAL_INCLUDES += [
     '/dom/file',
     '/netwerk/base',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
--- a/dom/media/webspeech/synth/moz.build
+++ b/dom/media/webspeech/synth/moz.build
@@ -33,23 +33,20 @@ if CONFIG['MOZ_WEBSPEECH']:
         'nsSynthVoiceRegistry.cpp',
         'SpeechSynthesis.cpp',
         'SpeechSynthesisUtterance.cpp',
         'SpeechSynthesisVoice.cpp',
     ]
 
     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']
 
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
         DIRS += ['cocoa']
 
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
         DIRS += ['android']
new file mode 100644
--- /dev/null
+++ b/dom/media/webspeech/synth/speechd/SpeechDispatcherModule.cpp
@@ -0,0 +1,54 @@
+/* -*- 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;
deleted file mode 100644
--- a/dom/media/webspeech/synth/speechd/components.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- 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'},
-    },
-]
--- a/dom/media/webspeech/synth/speechd/moz.build
+++ b/dom/media/webspeech/synth/speechd/moz.build
@@ -1,17 +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/.
 
 UNIFIED_SOURCES += [
+  'SpeechDispatcherModule.cpp',
   'SpeechDispatcherService.cpp'
 ]
-
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/media/webspeech/synth/test/FakeSynthModule.cpp
@@ -0,0 +1,45 @@
+/* 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;
deleted file mode 100644
--- a/dom/media/webspeech/synth/test/components.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- 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'},
-    },
-]
--- a/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp
+++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.cpp
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.h"
 #include "nsFakeSynthServices.h"
 #include "nsPrintfCString.h"
 #include "SharedBuffer.h"
 #include "nsISimpleEnumerator.h"
 
-#include "mozilla/ClearOnShutdown.h"
 #include "mozilla/dom/nsSynthVoiceRegistry.h"
 #include "mozilla/dom/nsSpeechTask.h"
 
 #include "nsThreadUtils.h"
 #include "prenv.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/DebugOnly.h"
 
@@ -269,22 +268,29 @@ nsFakeSynthServices* nsFakeSynthServices
   if (!XRE_IsParentProcess()) {
     MOZ_ASSERT(false,
                "nsFakeSynthServices can only be started on main gecko process");
     return nullptr;
   }
 
   if (!sSingleton) {
     sSingleton = new nsFakeSynthServices();
-    ClearOnShutdown(&sSingleton);
   }
 
   return sSingleton;
 }
 
 already_AddRefed<nsFakeSynthServices>
 nsFakeSynthServices::GetInstanceForService() {
   RefPtr<nsFakeSynthServices> picoService = GetInstance();
   return picoService.forget();
 }
 
+void nsFakeSynthServices::Shutdown() {
+  if (!sSingleton) {
+    return;
+  }
+
+  sSingleton = nullptr;
+}
+
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/media/webspeech/synth/test/nsFakeSynthServices.h
+++ b/dom/media/webspeech/synth/test/nsFakeSynthServices.h
@@ -24,16 +24,18 @@ class nsFakeSynthServices : public nsIOb
   NS_DECL_NSIOBSERVER
 
   nsFakeSynthServices() = default;
 
   static nsFakeSynthServices* GetInstance();
 
   static already_AddRefed<nsFakeSynthServices> GetInstanceForService();
 
+  static void Shutdown();
+
  private:
   virtual ~nsFakeSynthServices() = default;
 
   void Init();
 
   nsCOMPtr<nsISpeechService> mSynthService;
 
   static StaticRefPtr<nsFakeSynthServices> sSingleton;
deleted file mode 100644
--- a/dom/plugins/base/components.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- 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',
-    },
-]
--- a/dom/plugins/base/moz.build
+++ b/dom/plugins/base/moz.build
@@ -33,16 +33,17 @@ EXPORTS += [
     'nsPluginTags.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsJSNPRuntime.cpp',
     'nsNPAPIPluginInstance.cpp',
     'nsNPAPIPluginStreamListener.cpp',
     'nsPluginInstanceOwner.cpp',
+    'nsPluginModule.cpp',
     'nsPluginStreamListenerPeer.cpp',
     'nsPluginTags.cpp',
 ]
 
 SOURCES += [
     'nsNPAPIPlugin.cpp', # Conflict with X11 headers
     'nsPluginHost.cpp',  # Conflict with NS_NPAPIPLUGIN_CALLBACK
 ]
@@ -61,20 +62,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
         'nsPluginsDirDarwin.cpp', # conflict with mozilla::EventPriority
     ]
 else:
     UNIFIED_SOURCES += [
         'nsPluginNativeWindow.cpp',
         'nsPluginsDirUnix.cpp',
     ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/plugins/ipc',
     '/layout/generic',
     '/layout/xul',
     '/netwerk/base',
     '/widget',
     '/widget/cocoa',
new file mode 100644
--- /dev/null
+++ b/dom/plugins/base/nsPluginModule.cpp
@@ -0,0 +1,22 @@
+/* -*- 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;
new file mode 100644
--- /dev/null
+++ b/dom/presentation/provider/PresentationDeviceProviderModule.cpp
@@ -0,0 +1,49 @@
+/* -*- 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;
--- a/dom/presentation/provider/components.conf
+++ b/dom/presentation/provider/components.conf
@@ -1,28 +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/.
 
-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,
-    },
-    {
         'cid': '{f4079b8b-ede5-4b90-a112-5b415a931deb}',
         'contract_ids': ['@mozilla.org/presentation/control-service;1'],
         'jsm': 'resource://gre/modules/PresentationControlService.jsm',
         'constructor': 'PresentationControlService',
     },
 ]
 
 if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android':
--- a/dom/presentation/provider/moz.build
+++ b/dom/presentation/provider/moz.build
@@ -6,16 +6,17 @@
 
 EXTRA_JS_MODULES += [
     'PresentationControlService.jsm'
 ]
 
 UNIFIED_SOURCES += [
     'DeviceProviderHelpers.cpp',
     'MulticastDNSDeviceProvider.cpp',
+    'PresentationDeviceProviderModule.cpp',
 ]
 
 XPCOM_MANIFESTS += [
     'components.conf',
 ]
 
 EXTRA_JS_MODULES.presentation += [
     'ControllerStateMachine.jsm',
--- a/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js
+++ b/dom/presentation/tests/xpcshell/test_multicast_dns_device_provider.js
@@ -95,17 +95,17 @@ ContractHook.prototype = {
   reset() {},
 
   cleanup() {
     this.reset();
 
     this.unregister();
     let prevContract = this.hookedMap.get(this._contractID).pop();
 
-    if (prevContract.classID) {
+    if (prevContract.factory) {
       registrar.registerFactory(prevContract.classID,
                                 "",
                                 this._contractID,
                                 prevContract.factory);
     }
   },
 
   unregister() {
@@ -115,21 +115,17 @@ ContractHook.prototype = {
       classID = registrar.contractIDToCID(this._contractID);
       factory = Cm.getClassObject(Cc[this._contractID], Ci.nsIFactory);
     } catch (ex) {
       classID = "";
       factory = null;
     }
 
     if (factory) {
-      try {
-        registrar.unregisterFactory(classID, factory);
-      } catch (e) {
-        factory = null;
-      }
+      registrar.unregisterFactory(classID, factory);
     }
 
     return { classID, factory };
   },
 };
 
 function MockDNSServiceInfo() {}
 MockDNSServiceInfo.prototype = {
deleted file mode 100644
--- a/extensions/cookie/components.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-# -*- 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'],
-    },
-]
--- a/extensions/cookie/moz.build
+++ b/extensions/cookie/moz.build
@@ -12,20 +12,16 @@ EXPORTS += [
 
 UNIFIED_SOURCES += [
     'nsCookieModule.cpp',
     'nsCookiePermission.cpp',
     'nsPermission.cpp',
     'nsPermissionManager.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 LOCAL_INCLUDES += [
     '/caps',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
--- a/extensions/cookie/nsCookieModule.cpp
+++ b/extensions/cookie/nsCookieModule.cpp
@@ -1,12 +1,37 @@
 /* -*- 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 "nsIServiceManager.h"
+#include "nsPermissionManager.h"
+#include "nsICategoryManager.h"
 #include "nsCookiePermission.h"
+#include "nsString.h"
 
-namespace mozilla {
+// Define the constructor function for the objects
+NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPermissionManager,
+                                         nsPermissionManager::GetXPCOMSingleton)
+
+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(); }
 
-}  // namespace mozilla
+static const mozilla::Module kCookieModule = {mozilla::Module::kVersion,
+                                              kCookieCIDs,
+                                              kCookieContracts,
+                                              nullptr,
+                                              nullptr,
+                                              nullptr,
+                                              CookieModuleDtor};
+
+NSMODULE_DEFN(nsCookieModule) = &kCookieModule;
deleted file mode 100644
--- a/extensions/cookie/nsCookieModule.h
+++ /dev/null
@@ -1,19 +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/. */
-
-#ifndef nsCookieModule_h
-#define nsCookieModule_h
-
-#include "nscore.h"
-
-namespace mozilla {
-
-void CookieModuleDtor();
-
-}  // namespace mozilla
-
-#endif
-
deleted file mode 100644
--- a/extensions/permissions/components.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- 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'},
-    },
-]
--- a/extensions/permissions/moz.build
+++ b/extensions/permissions/moz.build
@@ -1,18 +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/.
 
 UNIFIED_SOURCES += [
     'nsContentBlocker.cpp',
-]
-
-XPCOM_MANIFESTS += [
-    'components.conf',
+    'nsModuleFactory.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'DOM')
new file mode 100644
--- /dev/null
+++ b/extensions/permissions/nsModuleFactory.cpp
@@ -0,0 +1,31 @@
+/* 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;
deleted file mode 100644
--- a/extensions/pref/autoconfig/src/components.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- 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'},
-    },
-]
--- a/extensions/pref/autoconfig/src/moz.build
+++ b/extensions/pref/autoconfig/src/moz.build
@@ -1,21 +1,18 @@
 # -*- 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/.
 
 UNIFIED_SOURCES += [
     'nsAutoConfig.cpp',
+    'nsConfigFactory.cpp',
     'nsJSConfigTriggers.cpp',
     'nsReadConfig.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 FINAL_LIBRARY = 'xul'
 
 FINAL_TARGET_FILES.defaults.autoconfig += [
     'prefcalls.js',
 ]
new file mode 100644
--- /dev/null
+++ b/extensions/pref/autoconfig/src/nsConfigFactory.cpp
@@ -0,0 +1,37 @@
+/* -*- 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;
--- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp
@@ -67,17 +67,16 @@
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "mozInlineSpellChecker.h"
 #include <stdlib.h>
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsNetUtil.h"
 #include "mozilla/dom/ContentParent.h"
-#include "mozilla/Components.h"
 
 using mozilla::dom::ContentParent;
 using namespace mozilla;
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(mozHunspell)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(mozHunspell)
 
 NS_INTERFACE_MAP_BEGIN(mozHunspell)
@@ -86,24 +85,16 @@ NS_INTERFACE_MAP_BEGIN(mozHunspell)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY(nsIMemoryReporter)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, mozISpellCheckingEngine)
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(mozHunspell)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTION(mozHunspell, mPersonalDictionary)
 
-NS_IMPL_COMPONENT_FACTORY(mozHunspell) {
-  auto hunspell = MakeRefPtr<mozHunspell>();
-  if (NS_SUCCEEDED(hunspell->Init())) {
-    return hunspell.forget().downcast<mozISpellCheckingEngine>();
-  }
-  return nullptr;
-}
-
 template <>
 mozilla::CountingAllocatorBase<HunspellAllocator>::AmountType
     mozilla::CountingAllocatorBase<HunspellAllocator>::sAmount(0);
 
 mozHunspell::mozHunspell() : mHunspell(nullptr) {
 #ifdef DEBUG
   // There must be only one instance of this class: it reports memory based on
   // a single static count in HunspellAllocator.
deleted file mode 100644
--- a/extensions/spellcheck/src/components.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- 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',
-    },
-]
--- a/extensions/spellcheck/src/moz.build
+++ b/extensions/spellcheck/src/moz.build
@@ -6,20 +6,17 @@
 
 include('/ipc/chromium/chromium-config.mozbuild')
 UNIFIED_SOURCES += [
     'mozEnglishWordUtils.cpp',
     'mozInlineSpellChecker.cpp',
     'mozInlineSpellWordUtil.cpp',
     'mozPersonalDictionary.cpp',
     'mozSpellChecker.cpp',
-]
-
-XPCOM_MANIFESTS += [
-    'components.conf',
+    'mozSpellCheckerFactory.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../hunspell/glue',
     '../hunspell/src',
     '/dom/base',
new file mode 100644
--- /dev/null
+++ b/extensions/spellcheck/src/mozSpellCheckerFactory.cpp
@@ -0,0 +1,31 @@
+/* -*- 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;
deleted file mode 100644
--- a/gfx/src/components.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- 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'],
-    },
-]
--- a/gfx/src/moz.build
+++ b/gfx/src/moz.build
@@ -63,29 +63,26 @@ UNIFIED_SOURCES += [
     'gfxCrashReporterUtils.cpp',
     'gfxTelemetry.cpp',
     'nsColor.cpp',
     'nsFont.cpp',
     'nsFontMetrics.cpp',
     'nsRect.cpp',
     'nsRegion.cpp',
     'nsThebesFontEnumerator.cpp',
+    'nsThebesGfxFactory.cpp',
     'nsTransform2D.cpp',
     'TiledRegion.cpp',
 ]
 
 # nsDeviceContext.cpp cannot be built in unified mode because it pulls in OS X system headers.
 SOURCES += [
     'nsDeviceContext.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 include('/ipc/chromium/chromium-config.mozbuild')
 
 LOCAL_INCLUDES += [
     '/dom/ipc',  # for ContentChild.h
 ]
 
 FINAL_LIBRARY = 'xul'
 
new file mode 100644
--- /dev/null
+++ b/gfx/src/nsThebesGfxFactory.cpp
@@ -0,0 +1,40 @@
+/* -*- 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;
--- a/js/ductwork/debugger/JSDebugger.cpp
+++ b/js/ductwork/debugger/JSDebugger.cpp
@@ -5,31 +5,34 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "JSDebugger.h"
 #include "nsIXPConnect.h"
 #include "nsThreadUtils.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "js/Wrapper.h"
+#include "mozilla/ModuleUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMemory.h"
 
 #define JSDEBUGGER_CONTRACTID "@mozilla.org/jsdebugger;1"
 
 #define JSDEBUGGER_CID                               \
   {                                                  \
     0x0365cbd5, 0xd46e, 0x4e94, {                    \
       0xa3, 0x9f, 0x83, 0xb6, 0x3c, 0xd1, 0xa9, 0x63 \
     }                                                \
   }
 
 namespace mozilla {
 namespace jsdebugger {
 
+NS_GENERIC_FACTORY_CONSTRUCTOR(JSDebugger)
+
 NS_IMPL_ISUPPORTS(JSDebugger, IJSDebugger)
 
 JSDebugger::JSDebugger() {}
 
 JSDebugger::~JSDebugger() {}
 
 NS_IMETHODIMP
 JSDebugger::AddClass(JS::Handle<JS::Value> global, JSContext* cx) {
@@ -67,8 +70,23 @@ JSDebugger::AddClass(JS::Handle<JS::Valu
     }
   }
 
   return NS_OK;
 }
 
 }  // 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;
deleted file mode 100644
--- a/js/ductwork/debugger/components.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- 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'],
-    },
-]
--- a/js/ductwork/debugger/moz.build
+++ b/js/ductwork/debugger/moz.build
@@ -14,17 +14,13 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'jsdebugger'
 
 XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini']
 
 SOURCES += [
     'JSDebugger.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 EXTRA_JS_MODULES += [
     'jsdebugger.jsm',
 ]
 
 FINAL_LIBRARY = 'xul'
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -12,23 +12,23 @@
 
 #include "base/basictypes.h"
 #include "GeckoProfiler.h"
 #include "MainThreadUtils.h"
 #include "mozilla/ArenaAllocatorExtensions.h"
 #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"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Services.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/SyncRunnable.h"
@@ -5404,21 +5404,40 @@ static void InitVarCachePref(const nsACS
 }  // namespace mozilla
 
 #undef ENSURE_PARENT_PROCESS
 
 //===========================================================================
 // Module and factory stuff
 //===========================================================================
 
-NS_IMPL_COMPONENT_FACTORY(nsPrefLocalizedString) {
-  auto str = MakeRefPtr<nsPrefLocalizedString>();
-  if (NS_SUCCEEDED(str->Init())) {
-    return str.forget().downcast<nsISupports>();
-  }
-  return nullptr;
-}
-
-namespace mozilla {
-
-void UnloadPrefsModule() { Preferences::Shutdown(); }
-
-}
+NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
+                                         Preferences::GetInstanceForService)
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
+
+static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
+static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
+
+static mozilla::Module::CIDEntry kPrefCIDs[] = {
+    {&kPrefServiceCID, true, nullptr, PreferencesConstructor,
+     Module::ALLOW_IN_SOCKET_PROCESS},
+    {&kPrefLocalizedStringCID, false, nullptr,
+     nsPrefLocalizedStringConstructor},
+    {nullptr}};
+
+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;
--- a/modules/libpref/Preferences.h
+++ b/modules/libpref/Preferences.h
@@ -28,18 +28,16 @@ class nsIFile;
 // The callback function will get passed the pref name which triggered the call
 // and the void* data which was passed to the registered callback function.
 typedef void (*PrefChangedFunc)(const char* aPref, void* aData);
 
 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.
 //
 // Note: We specify this as a dependent type TypedPrefChangeFunc<T>::SelfType so
 // that it does not participate in argument type deduction. This allows us to
 // use its implicit conversion constructor, and also allows our Register and
 // Unregister methods to accept non-capturing lambdas (which will not match
 // void(*)(const char*, T*) when used in type deduction) as callback functions.
deleted file mode 100644
--- a/modules/libpref/components.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- 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',
-    },
-]
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
@@ -31,20 +31,16 @@ EXPORTS.mozilla += [
     'StaticPrefs.h',
 ]
 
 UNIFIED_SOURCES += [
     'Preferences.cpp',
     'SharedPrefMap.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 DEFINES['OS_ARCH'] = CONFIG['OS_ARCH']
 DEFINES['MOZ_WIDGET_TOOLKIT'] = CONFIG['MOZ_WIDGET_TOOLKIT']
 if CONFIG['MOZ_ENABLE_WEBRENDER']:
     DEFINES['MOZ_ENABLE_WEBRENDER'] = True
--- a/netwerk/dns/mdns/libmdns/components.conf
+++ b/netwerk/dns/mdns/libmdns/components.conf
@@ -1,22 +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': '{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'],
-    },
-]
+Classes = []
 
 if buildconfig.substs['MOZ_WIDGET_TOOLKIT'] != 'cocoa':
     Classes += [
         {
             'cid': '{f9346d98-f27a-4e89-b744-493843416480}',
             'contract_ids': ['@mozilla.org/toolkit/components/mdnsresponder/dns-sd;1'],
             'jsm': 'resource://gre/modules/DNSServiceDiscovery.jsm',
             'constructor': 'nsDNSServiceDiscovery',
--- a/netwerk/dns/mdns/libmdns/moz.build
+++ b/netwerk/dns/mdns/libmdns/moz.build
@@ -33,16 +33,17 @@ else:
 
     if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
         EXTRA_JS_MODULES += [
             'MulticastDNSAndroid.jsm',
         ]
 
 UNIFIED_SOURCES += [
     'nsDNSServiceInfo.cpp',
+    'nsMulticastDNSModule.cpp',
 ]
 
 XPCOM_MANIFESTS += [
     'components.conf',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/netwerk/dns/mdns/libmdns/nsMulticastDNSModule.cpp
@@ -0,0 +1,63 @@
+/* -*- 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;
deleted file mode 100644
--- a/netwerk/protocol/gio/components.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- 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',
-    },
-]
--- a/netwerk/protocol/gio/moz.build
+++ b/netwerk/protocol/gio/moz.build
@@ -3,19 +3,15 @@
 # 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/.
 
 SOURCES += [
     'nsGIOProtocolHandler.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 FINAL_LIBRARY = 'xul'
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Widget: Gtk')
 
--- a/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
+++ b/netwerk/protocol/gio/nsGIOProtocolHandler.cpp
@@ -2,17 +2,17 @@
 /* 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/. */
 
 /*
  * This code is based on original Mozilla gnome-vfs extension. It implements
  * input stream provided by GVFS/GIO.
  */
-#include "mozilla/Components.h"
+#include "mozilla/ModuleUtils.h"
 #include "mozilla/NullPrincipal.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIObserver.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsIStringBundle.h"
 #include "nsIStandardURL.h"
@@ -27,18 +27,16 @@
 #include "nsIInputStream.h"
 #include "nsIProtocolHandler.h"
 #include "mozilla/Monitor.h"
 #include "plstr.h"
 #include "prtime.h"
 #include <gio/gio.h>
 #include <algorithm>
 
-using namespace mozilla;
-
 #define MOZ_GIO_SCHEME "moz-gio"
 #define MOZ_GIO_SUPPORTED_PROTOCOLS "network.gio.supported-protocols"
 
 //-----------------------------------------------------------------------------
 
 // NSPR_LOG_MODULES=gio:5
 static mozilla::LazyLogModule sGIOLog("gio");
 #define LOG(args) MOZ_LOG(sGIOLog, mozilla::LogLevel::Debug, args)
@@ -842,24 +840,16 @@ class nsGIOProtocolHandler final : publi
   void InitSupportedProtocolsPref(nsIPrefBranch *prefs);
   bool IsSupportedProtocol(const nsCString &spec);
 
   nsCString mSupportedProtocols;
 };
 
 NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver)
 
-NS_IMPL_COMPONENT_FACTORY(nsGIOProtocolHandler) {
-  auto inst = MakeRefPtr<nsGIOProtocolHandler>();
-  if (NS_SUCCEEDED(inst->Init())) {
-    return inst.forget().downcast<nsIProtocolHandler>();
-  }
-  return nullptr;
-}
-
 nsresult nsGIOProtocolHandler::Init() {
   nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs) {
     InitSupportedProtocolsPref(prefs);
     prefs->AddObserver(MOZ_GIO_SUPPORTED_PROTOCOLS, this, false);
   }
 
   return NS_OK;
@@ -1018,8 +1008,35 @@ NS_IMETHODIMP
 nsGIOProtocolHandler::Observe(nsISupports *aSubject, const char *aTopic,
                               const char16_t *aData) {
   if (strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0) {
     nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
     InitSupportedProtocolsPref(prefs);
   }
   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;
deleted file mode 100644
--- a/parser/htmlparser/components.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- 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'],
-    },
-]
--- a/parser/htmlparser/moz.build
+++ b/parser/htmlparser/moz.build
@@ -41,16 +41,12 @@ UNIFIED_SOURCES += [
     'nsHTMLTokenizer.cpp',
     'nsParser.cpp',
     'nsParserModule.cpp',
     'nsParserMsgUtils.cpp',
     'nsScanner.cpp',
     'nsScannerString.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
deleted file mode 100644
--- a/security/manager/pki/components.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- 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',
-    },
-]
--- a/security/manager/pki/moz.build
+++ b/security/manager/pki/moz.build
@@ -11,20 +11,17 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'pippki'
 
 UNIFIED_SOURCES += [
     'nsASN1Tree.cpp',
     'nsNSSDialogHelper.cpp',
     'nsNSSDialogs.cpp',
-]
-
-XPCOM_MANIFESTS += [
-    'components.conf',
+    'nsPKIModule.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '!/dist/public/nss',
 ]
 
 FINAL_LIBRARY = 'xul'
 
new file mode 100644
--- /dev/null
+++ b/security/manager/pki/nsPKIModule.cpp
@@ -0,0 +1,34 @@
+/* -*- 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;
--- a/security/sandbox/common/SandboxSettings.cpp
+++ b/security/sandbox/common/SandboxSettings.cpp
@@ -1,23 +1,21 @@
 /* -*- 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 "mozISandboxSettings.h"
 
-#include "mozilla/Components.h"
+#include "mozilla/ModuleUtils.h"
 #include "mozilla/Preferences.h"
 
 #include "prenv.h"
 
-using namespace mozilla;
-
 namespace mozilla {
 
 int GetEffectiveContentSandboxLevel() {
   if (PR_GetEnv("MOZ_DISABLE_CONTENT_SANDBOX")) {
     return 0;
   }
   int level = Preferences::GetInt("security.sandbox.content.level");
 // On Windows and macOS, enforce a minimum content sandbox level of 1 (except on
@@ -69,14 +67,25 @@ class SandboxSettings final : public moz
 NS_IMPL_ISUPPORTS(SandboxSettings, mozISandboxSettings)
 
 NS_IMETHODIMP SandboxSettings::GetEffectiveContentSandboxLevel(
     int32_t *aRetVal) {
   *aRetVal = mozilla::GetEffectiveContentSandboxLevel();
   return NS_OK;
 }
 
-}  // namespace mozilla
+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}};
 
-NS_IMPL_COMPONENT_FACTORY(mozISandboxSettings) {
-  return MakeAndAddRef<SandboxSettings>().downcast<nsISupports>();
-}
+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
deleted file mode 100644
--- a/security/sandbox/common/components.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- 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',
-    },
-]
--- a/security/sandbox/common/moz.build
+++ b/security/sandbox/common/moz.build
@@ -4,20 +4,16 @@
 # 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/.
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Security: Process Sandboxing')
 
 UNIFIED_SOURCES += ['SandboxSettings.cpp']
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 XPIDL_SOURCES += [
     'mozISandboxSettings.idl',
 ]
 
 XPIDL_MODULE = 'sandbox'
 
 FINAL_LIBRARY = 'xul'
 
--- a/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
+++ b/security/sandbox/linux/reporter/SandboxReporterWrappers.cpp
@@ -5,24 +5,22 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozISandboxReporter.h"
 #include "SandboxReporter.h"
 
 #include <time.h>
 
 #include "mozilla/Assertions.h"
-#include "mozilla/Components.h"
+#include "mozilla/ModuleUtils.h"
 #include "nsCOMPtr.h"
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include "nsXULAppAPI.h"
 
-using namespace mozilla;
-
 namespace mozilla {
 
 class SandboxReportWrapper final : public mozISandboxReport {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISANDBOXREPORT
 
   explicit SandboxReportWrapper(const SandboxReport& aReport)
@@ -178,13 +176,26 @@ NS_IMETHODIMP SandboxReporterWrapper::Sn
   }
 
   nsCOMPtr<mozISandboxReportArray> wrapper =
       new SandboxReportArray(SandboxReporter::Singleton()->GetSnapshot());
   wrapper.forget(aRetval);
   return NS_OK;
 }
 
-}  // namespace mozilla
+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}};
 
-NS_IMPL_COMPONENT_FACTORY(mozISandboxReporter) {
-  return MakeAndAddRef<SandboxReporterWrapper>().downcast<nsISupports>();
-}
+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
deleted file mode 100644
--- a/security/sandbox/linux/reporter/components.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- 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',
-    },
-]
--- a/security/sandbox/linux/reporter/moz.build
+++ b/security/sandbox/linux/reporter/moz.build
@@ -9,20 +9,16 @@ EXPORTS.mozilla += [
     'SandboxReporterCommon.h',
 ]
 
 SOURCES += [
     'SandboxReporter.cpp',
     'SandboxReporterWrappers.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 LOCAL_INCLUDES += [
     '/security/sandbox/linux', # SandboxLogging.h
 ]
 
 # Need this for base::PlatformThread
 include('/ipc/chromium/chromium-config.mozbuild')
 
 # Need this for safe_sprintf.h used by SandboxLogging.h,
--- a/services/crypto/component/IdentityCryptoService.cpp
+++ b/services/crypto/component/IdentityCryptoService.cpp
@@ -1,24 +1,24 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=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 "nsIIdentityCryptoService.h"
+#include "mozilla/ModuleUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIThread.h"
 #include "nsThreadUtils.h"
 #include "nsCOMPtr.h"
 #include "nsProxyRelease.h"
 #include "nsString.h"
 #include "mozilla/ArrayUtils.h"  // ArrayLength
 #include "mozilla/Base64.h"
-#include "mozilla/Components.h"
 #include "ScopedNSSTypes.h"
 #include "NSSErrorsService.h"
 
 #include "nss.h"
 #include "pk11pub.h"
 #include "secmod.h"
 #include "secerr.h"
 #include "keyhi.h"
@@ -444,19 +444,36 @@ SignRunnable::Run() {
     NS_DispatchToMainThread(this);
   } else {
     // Back on Main Thread
     (void)mCallback->SignFinished(mRv, mSignature);
   }
 
   return NS_OK;
 }
-}  // unnamed namespace
 
 // XPCOM module registration
 
-NS_IMPL_COMPONENT_FACTORY(nsIIdentityCryptoService) {
-  auto inst = MakeRefPtr<IdentityCryptoService>();
-  if (NS_SUCCEEDED(inst->Init())) {
-    return inst.forget().downcast<nsIIdentityCryptoService>();
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(IdentityCryptoService, Init)
+
+#define NS_IDENTITYCRYPTOSERVICE_CID                 \
+  {                                                  \
+    0xbea13a3a, 0x44e8, 0x4d7f, {                    \
+      0xa0, 0xa2, 0x2c, 0x67, 0xf8, 0x4e, 0x3a, 0x97 \
+    }                                                \
   }
-  return nullptr;
-}
+
+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;
deleted file mode 100644
--- a/services/crypto/component/components.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# -*- 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',
-    },
-]
--- a/services/crypto/component/moz.build
+++ b/services/crypto/component/moz.build
@@ -9,13 +9,9 @@ XPIDL_SOURCES += [
 ]
 
 XPIDL_MODULE = 'services-crypto-component'
 
 SOURCES += [
     'IdentityCryptoService.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/storage/build/components.conf
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- 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'},
-    },
-]
--- a/storage/build/moz.build
+++ b/storage/build/moz.build
@@ -3,15 +3,19 @@
 # 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/.
 
 EXPORTS += [
     'mozStorageCID.h',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
+SOURCES += [
+    'mozStorageModule.cpp',
 ]
 
 FINAL_LIBRARY = 'xul'
 
+LOCAL_INCLUDES += [
+    '..',
+]
+
 CXXFLAGS += CONFIG['SQLITE_CFLAGS']
new file mode 100644
--- /dev/null
+++ b/storage/build/mozStorageModule.cpp
@@ -0,0 +1,48 @@
+/* -*- 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;
deleted file mode 100644
--- a/tools/profiler/gecko/components.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-# -*- 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',
-    },
-]
new file mode 100644
--- /dev/null
+++ b/tools/profiler/gecko/nsProfilerFactory.cpp
@@ -0,0 +1,25 @@
+/* -*- 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;
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -25,31 +25,28 @@ if CONFIG['MOZ_GECKO_PROFILER']:
         'core/ProfileBuffer.cpp',
         'core/ProfileBufferEntry.cpp',
         'core/ProfiledThreadData.cpp',
         'core/ProfileJSONWriter.cpp',
         'core/ProfilerBacktrace.cpp',
         'core/ProfilerMarkerPayload.cpp',
         'core/RegisteredThread.cpp',
         'gecko/ChildProfilerController.cpp',
+        'gecko/nsProfilerFactory.cpp',
         'gecko/nsProfilerStartParams.cpp',
         'gecko/ProfilerChild.cpp',
         'gecko/ProfilerIOInterposeObserver.cpp',
         'gecko/ProfilerParent.cpp',
         'gecko/ThreadResponsiveness.cpp',
     ]
     if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['MOZ_PROFILER_MEMORY']:
         SOURCES += [
             '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
         # called TextRange, which conflicts with mozilla::TextRange due to
         # a "using namespace mozilla;" declaration from a different file.
         SOURCES += [
             'gecko/nsProfiler.cpp',
         ]
deleted file mode 100644
--- a/xpfe/appshell/components.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- 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',
-    },
-]
--- a/xpfe/appshell/moz.build
+++ b/xpfe/appshell/moz.build
@@ -21,29 +21,26 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'appshell'
 
 EXPORTS += [
     'LiveResizeListener.h',
     'nsAppShellCID.h',
 ]
 
 UNIFIED_SOURCES += [
+    'nsAppShellFactory.cpp',
     'nsAppShellService.cpp',
     'nsAppShellWindowEnumerator.cpp',
     'nsChromeTreeOwner.cpp',
     'nsContentTreeOwner.cpp',
     'nsWebShellWindow.cpp',
     'nsWindowMediator.cpp',
     'nsXULWindow.cpp',
 ]
 
-XPCOM_MANIFESTS += [
-    'components.conf',
-]
-
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/xul',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 include('/ipc/chromium/chromium-config.mozbuild')
new file mode 100644
--- /dev/null
+++ b/xpfe/appshell/nsAppShellFactory.cpp
@@ -0,0 +1,38 @@
+/* -*- 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;