Bug 1524687: Part 8 - Convert remaining toolkit modules to static registration. r=mossop
☠☠ backed out by 3b1b94e39795 ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Thu, 24 Jan 2019 16:34:52 -0800
changeset 458968 b9862758b98c
parent 458967 92d9e927deec
child 458969 9c24919ac5c2
push id111908
push usermaglione.k@gmail.com
push dateThu, 14 Feb 2019 02:29:45 +0000
treeherdermozilla-inbound@625f71135038 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
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
Bug 1524687: Part 8 - Convert remaining toolkit modules to static registration. r=mossop Differential Revision: https://phabricator.services.mozilla.com/D18403
toolkit/components/autocomplete/components.conf
toolkit/components/autocomplete/moz.build
toolkit/components/autocomplete/nsAutoCompleteController.cpp
toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
toolkit/components/browser/build/components.conf
toolkit/components/browser/build/moz.build
toolkit/components/browser/build/nsWebBrowserModule.cpp
toolkit/components/build/nsToolkitCompsCID.h
toolkit/components/ctypes/components.conf
toolkit/components/ctypes/ctypes.cpp
toolkit/components/ctypes/moz.build
toolkit/components/mediasniffer/components.conf
toolkit/components/mediasniffer/moz.build
toolkit/components/mediasniffer/nsMediaSnifferModule.cpp
toolkit/components/mozintl/MozIntlHelper.cpp
toolkit/components/mozintl/components.conf
toolkit/components/mozintl/moz.build
toolkit/components/perf/PerfMeasurement.cpp
toolkit/components/perf/components.conf
toolkit/components/perf/moz.build
toolkit/components/reflect/components.conf
toolkit/components/reflect/moz.build
toolkit/components/reflect/reflect.cpp
toolkit/components/remote/components.conf
toolkit/components/remote/moz.build
toolkit/components/remote/nsRemoteService.cpp
toolkit/components/satchel/components.conf
toolkit/components/satchel/moz.build
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/telemetry/core/Telemetry.cpp
toolkit/components/telemetry/core/Telemetry.h
toolkit/components/telemetry/core/components.conf
toolkit/components/telemetry/moz.build
toolkit/components/thumbnails/components.conf
toolkit/components/thumbnails/moz.build
toolkit/components/thumbnails/nsPageThumbsModule.cpp
toolkit/system/gnome/components.conf
toolkit/system/gnome/moz.build
toolkit/system/gnome/nsGConfService.h
toolkit/system/gnome/nsGnomeModule.cpp
toolkit/system/gnome/nsGnomeModule.h
toolkit/system/unixproxy/components.conf
toolkit/system/unixproxy/moz.build
toolkit/system/unixproxy/nsLibProxySettings.cpp
toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
new file mode 100644
--- /dev/null
+++ b/toolkit/components/autocomplete/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': '{f6d5ebbd-34f4-487d-9d10-3d34123e3eb9}',
+        'contract_ids': ['@mozilla.org/autocomplete/controller;1'],
+        'type': 'nsAutoCompleteController',
+        'headers': ['/toolkit/components/autocomplete/nsAutoCompleteController.h'],
+    },
+    {
+        'cid': '{2ee3039b-2de4-43d9-93b0-649beacff39a}',
+        'contract_ids': ['@mozilla.org/autocomplete/simple-result;1'],
+        'type': 'nsAutoCompleteSimpleResult',
+        'headers': ['/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h'],
+    },
+]
--- a/toolkit/components/autocomplete/moz.build
+++ b/toolkit/components/autocomplete/moz.build
@@ -17,12 +17,16 @@ XPIDL_SOURCES += [
 
 XPIDL_MODULE = 'autocomplete'
 
 UNIFIED_SOURCES += [
     'nsAutoCompleteController.cpp',
     'nsAutoCompleteSimpleResult.cpp',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Autocomplete')
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -4,24 +4,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAutoCompleteController.h"
 #include "nsAutoCompleteSimpleResult.h"
 
 #include "nsAutoPtr.h"
 #include "nsNetCID.h"
 #include "nsIIOService.h"
-#include "nsToolkitCompsCID.h"
 #include "nsIServiceManager.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
-#include "mozilla/ModuleUtils.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include "mozilla/dom/Event.h"
 
 static const char *kAutoCompleteSearchCID =
     "@mozilla.org/autocomplete/search;1?name=";
 
 using namespace mozilla;
@@ -1753,31 +1751,8 @@ nsresult nsAutoCompleteController::Match
 
     // Advance the popup table index cursor past the
     // results of the current search.
     index += matchCount;
   }
 
   return NS_OK;
 }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteController)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteSimpleResult)
-
-NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETECONTROLLER_CID);
-NS_DEFINE_NAMED_CID(NS_AUTOCOMPLETESIMPLERESULT_CID);
-
-static const mozilla::Module::CIDEntry kAutoCompleteCIDs[] = {
-    {&kNS_AUTOCOMPLETECONTROLLER_CID, false, nullptr,
-     nsAutoCompleteControllerConstructor},
-    {&kNS_AUTOCOMPLETESIMPLERESULT_CID, false, nullptr,
-     nsAutoCompleteSimpleResultConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kAutoCompleteContracts[] = {
-    {NS_AUTOCOMPLETECONTROLLER_CONTRACTID, &kNS_AUTOCOMPLETECONTROLLER_CID},
-    {NS_AUTOCOMPLETESIMPLERESULT_CONTRACTID, &kNS_AUTOCOMPLETESIMPLERESULT_CID},
-    {nullptr}};
-
-static const mozilla::Module kAutoCompleteModule = {
-    mozilla::Module::kVersion, kAutoCompleteCIDs, kAutoCompleteContracts};
-
-NSMODULE_DEFN(tkAutoCompleteModule) = &kAutoCompleteModule;
--- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
@@ -11,38 +11,16 @@
        static_cast<MatchesArray::size_type>(_index) == mMatches.Length())) { \
     MOZ_ASSERT(false, "Trying to use an invalid index on mMatches");         \
     return NS_ERROR_ILLEGAL_VALUE;                                           \
   }
 
 NS_IMPL_ISUPPORTS(nsAutoCompleteSimpleResult, nsIAutoCompleteResult,
                   nsIAutoCompleteSimpleResult)
 
-struct AutoCompleteSimpleResultMatch {
-  AutoCompleteSimpleResultMatch(const nsAString& aValue,
-                                const nsAString& aComment,
-                                const nsAString& aImage,
-                                const nsAString& aStyle,
-                                const nsAString& aFinalCompleteValue,
-                                const nsAString& aLabel)
-      : mValue(aValue),
-        mComment(aComment),
-        mImage(aImage),
-        mStyle(aStyle),
-        mFinalCompleteValue(aFinalCompleteValue),
-        mLabel(aLabel) {}
-
-  nsString mValue;
-  nsString mComment;
-  nsString mImage;
-  nsString mStyle;
-  nsString mFinalCompleteValue;
-  nsString mLabel;
-};
-
 nsAutoCompleteSimpleResult::nsAutoCompleteSimpleResult()
     : mDefaultIndex(-1), mSearchResult(RESULT_NOMATCH) {}
 
 nsresult nsAutoCompleteSimpleResult::AppendResult(
     nsIAutoCompleteResult* aResult) {
   nsAutoString searchString;
   nsresult rv = aResult->GetSearchString(searchString);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
+++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
@@ -8,17 +8,37 @@
 #include "nsIAutoCompleteResult.h"
 #include "nsIAutoCompleteSimpleResult.h"
 
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
 
-struct AutoCompleteSimpleResultMatch;
+struct AutoCompleteSimpleResultMatch {
+  AutoCompleteSimpleResultMatch(const nsAString& aValue,
+                                const nsAString& aComment,
+                                const nsAString& aImage,
+                                const nsAString& aStyle,
+                                const nsAString& aFinalCompleteValue,
+                                const nsAString& aLabel)
+      : mValue(aValue),
+        mComment(aComment),
+        mImage(aImage),
+        mStyle(aStyle),
+        mFinalCompleteValue(aFinalCompleteValue),
+        mLabel(aLabel) {}
+
+  nsString mValue;
+  nsString mComment;
+  nsString mImage;
+  nsString mStyle;
+  nsString mFinalCompleteValue;
+  nsString mLabel;
+};
 
 class nsAutoCompleteSimpleResult final : public nsIAutoCompleteSimpleResult {
  public:
   nsAutoCompleteSimpleResult();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUTOCOMPLETERESULT
   NS_DECL_NSIAUTOCOMPLETESIMPLERESULT
new file mode 100644
--- /dev/null
+++ b/toolkit/components/browser/build/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': '{f66bc334-1dd1-11b2-bab2-90e04fe15c19}',
+        'contract_ids': ['@mozilla.org/embedding/browser/content-policy;1'],
+        'type': 'nsWebBrowserContentPolicy',
+        'headers': ['/toolkit/components/browser/nsWebBrowserContentPolicy.h'],
+        'categories': {'content-policy': '@mozilla.org/embedding/browser/content-policy;1'},
+    },
+]
--- a/toolkit/components/browser/build/moz.build
+++ b/toolkit/components/browser/build/moz.build
@@ -1,14 +1,11 @@
 # -*- 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/.
 
-SOURCES += [
-    'nsWebBrowserModule.cpp',
+XPCOM_MANIFESTS += [
+    'components.conf',
 ]
 
 FINAL_LIBRARY = 'xul'
-LOCAL_INCLUDES += [
-    '..',
-]
deleted file mode 100644
--- a/toolkit/components/browser/build/nsWebBrowserModule.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 "mozilla/ModuleUtils.h"
-#include "nsIServiceManager.h"
-#include "nsString.h"
-
-#include "nsEmbedCID.h"
-
-#include "nsWebBrowser.h"
-#include "nsWebBrowserContentPolicy.h"
-
-// Factory Constructors
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserContentPolicy)
-
-NS_DEFINE_NAMED_CID(NS_WEBBROWSERCONTENTPOLICY_CID);
-
-static const mozilla::Module::CIDEntry kWebBrowserCIDs[] = {
-    {&kNS_WEBBROWSERCONTENTPOLICY_CID, false, nullptr,
-     nsWebBrowserContentPolicyConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kWebBrowserContracts[] = {
-    {NS_WEBBROWSERCONTENTPOLICY_CONTRACTID, &kNS_WEBBROWSERCONTENTPOLICY_CID},
-    {nullptr}};
-
-static const mozilla::Module::CategoryEntry kWebBrowserCategories[] = {
-    {"content-policy", NS_WEBBROWSERCONTENTPOLICY_CONTRACTID,
-     NS_WEBBROWSERCONTENTPOLICY_CONTRACTID},
-    {nullptr}};
-
-static const mozilla::Module kWebBrowserModule = {
-    mozilla::Module::kVersion, kWebBrowserCIDs, kWebBrowserContracts,
-    kWebBrowserCategories};
-
-NSMODULE_DEFN(Browser_Embedding_Module) = &kWebBrowserModule;
--- a/toolkit/components/build/nsToolkitCompsCID.h
+++ b/toolkit/components/build/nsToolkitCompsCID.h
@@ -48,48 +48,24 @@
 // {84E11F80-CA55-11DD-AD8B-0800200C9A66}
 #define NS_SYSTEMALERTSSERVICE_CID                   \
   {                                                  \
     0x84e11f80, 0xca55, 0x11dd, {                    \
       0xad, 0x8b, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 \
     }                                                \
   }
 
-// {F6D5EBBD-34F4-487d-9D10-3D34123E3EB9}
-#define NS_AUTOCOMPLETECONTROLLER_CID                \
-  {                                                  \
-    0xf6d5ebbd, 0x34f4, 0x487d, {                    \
-      0x9d, 0x10, 0x3d, 0x34, 0x12, 0x3e, 0x3e, 0xb9 \
-    }                                                \
-  }
-
-// {2ee3039b-2de4-43d9-93b0-649beacff39a}
-#define NS_AUTOCOMPLETESIMPLERESULT_CID              \
-  {                                                  \
-    0x2ee3039b, 0x2de4, 0x43d9, {                    \
-      0x93, 0xb0, 0x64, 0x9b, 0xea, 0xcf, 0xf3, 0x9a \
-    }                                                \
-  }
-
 // {7A6F70B6-2BBD-44b5-9304-501352D44AB5}
 #define NS_AUTOCOMPLETEMDBRESULT_CID                \
   {                                                 \
     0x7a6f70b6, 0x2bbd, 0x44b5, {                   \
       0x93, 0x4, 0x50, 0x13, 0x52, 0xd4, 0x4a, 0xb5 \
     }                                               \
   }
 
-// {895DB6C7-DBDF-40ea-9F64-B175033243DC}
-#define NS_FORMFILLCONTROLLER_CID                   \
-  {                                                 \
-    0x895db6c7, 0xdbdf, 0x40ea, {                   \
-      0x9f, 0x64, 0xb1, 0x75, 0x3, 0x32, 0x43, 0xdc \
-    }                                               \
-  }
-
 // {59648a91-5a60-4122-8ff2-54b839c84aed}
 #define NS_GLOBALHISTORY_CID                         \
   {                                                  \
     0x59648a91, 0x5a60, 0x4122, {                    \
       0x8f, 0xf2, 0x54, 0xb8, 0x39, 0xc8, 0x4a, 0xed \
     }                                                \
   }
 
new file mode 100644
--- /dev/null
+++ b/toolkit/components/ctypes/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': '{0c797702-1c60-4051-9dd7-4d7405605642}',
+        'contract_ids': ['@mozilla.org/jsctypes;1'],
+        'type': 'mozilla::ctypes::Module',
+        'headers': ['/toolkit/components/ctypes/ctypes.h'],
+    },
+]
--- a/toolkit/components/ctypes/ctypes.cpp
+++ b/toolkit/components/ctypes/ctypes.cpp
@@ -1,34 +1,24 @@
 /* -*- 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 "ctypes.h"
 #include "jsapi.h"
 #include "js/MemoryFunctions.h"
-#include "mozilla/ModuleUtils.h"
 #include "nsMemory.h"
 #include "nsString.h"
 #include "nsNativeCharsetUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozJSComponentLoader.h"
 #include "nsZipArchive.h"
 #include "xpc_make_class.h"
 
-#define JSCTYPES_CONTRACTID "@mozilla.org/jsctypes;1"
-
-#define JSCTYPES_CID                                \
-  {                                                 \
-    0xc797702, 0x1c60, 0x4051, {                    \
-      0x9d, 0xd7, 0x4d, 0x74, 0x5, 0x60, 0x56, 0x42 \
-    }                                               \
-  }
-
 namespace mozilla {
 namespace ctypes {
 
 static char* UnicodeToNative(JSContext* cx, const char16_t* source,
                              size_t slen) {
   nsAutoCString native;
   nsDependentString unicode(reinterpret_cast<const char16_t*>(source), slen);
   nsresult rv = NS_CopyUnicodeToNative(unicode, native);
@@ -41,18 +31,16 @@ static char* UnicodeToNative(JSContext* 
   if (!result) return nullptr;
 
   memcpy(result, native.get(), native.Length() + 1);
   return result;
 }
 
 static JSCTypesCallbacks sCallbacks = {UnicodeToNative};
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(Module)
-
 NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable)
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
@@ -107,22 +95,8 @@ Module::Call(nsIXPConnectWrappedNative* 
   loader->FindTargetObject(cx, &targetObj);
 
   *_retval = InitAndSealCTypesClass(cx, targetObj);
   return NS_OK;
 }
 
 }  // namespace ctypes
 }  // namespace mozilla
-
-NS_DEFINE_NAMED_CID(JSCTYPES_CID);
-
-static const mozilla::Module::CIDEntry kCTypesCIDs[] = {
-    {&kJSCTYPES_CID, false, nullptr, mozilla::ctypes::ModuleConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kCTypesContracts[] = {
-    {JSCTYPES_CONTRACTID, &kJSCTYPES_CID}, {nullptr}};
-
-static const mozilla::Module kCTypesModule = {mozilla::Module::kVersion,
-                                              kCTypesCIDs, kCTypesContracts};
-
-NSMODULE_DEFN(jsctypes) = &kCTypesModule;
--- a/toolkit/components/ctypes/moz.build
+++ b/toolkit/components/ctypes/moz.build
@@ -13,12 +13,16 @@ SOURCES += [
 LOCAL_INCLUDES += [
     '/js/xpconnect/loader',
 ]
 
 EXTRA_JS_MODULES += [
     'ctypes.jsm',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'js-ctypes')
new file mode 100644
--- /dev/null
+++ b/toolkit/components/mediasniffer/components.conf
@@ -0,0 +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/.
+
+Classes = [
+    {
+        'cid': '{3fdd6c28-5b87-4e3e-8b57-8e83c23c1a6d}',
+        'contract_ids': ['@mozilla.org/media/sniffer;1'],
+        'type': 'nsMediaSniffer',
+        'headers': ['nsMediaSniffer.h'],
+        'categories': {
+            'content-sniffing-services': '@mozilla.org/media/sniffer;1',
+            'net-content-sniffers': '@mozilla.org/media/sniffer;1',
+        },
+    },
+]
--- a/toolkit/components/mediasniffer/moz.build
+++ b/toolkit/components/mediasniffer/moz.build
@@ -8,15 +8,18 @@ XPCSHELL_TESTS_MANIFESTS += ['test/unit/
 
 EXPORTS += [
     'nsMediaSniffer.h',
 ]
 
 UNIFIED_SOURCES += [
     'mp3sniff.c',
     'nsMediaSniffer.cpp',
-    'nsMediaSnifferModule.cpp',
+]
+
+XPCOM_MANIFESTS += [
+    'components.conf',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Audio/Video')
deleted file mode 100644
--- a/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp
+++ /dev/null
@@ -1,32 +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 "nsMediaSniffer.h"
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSniffer)
-
-NS_DEFINE_NAMED_CID(NS_MEDIA_SNIFFER_CID);
-
-static const mozilla::Module::CIDEntry kMediaSnifferCIDs[] = {
-    {&kNS_MEDIA_SNIFFER_CID, false, nullptr, nsMediaSnifferConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kMediaSnifferContracts[] = {
-    {NS_MEDIA_SNIFFER_CONTRACTID, &kNS_MEDIA_SNIFFER_CID}, {nullptr}};
-
-static const mozilla::Module::CategoryEntry kMediaSnifferCategories[] = {
-    {"content-sniffing-services", NS_MEDIA_SNIFFER_CONTRACTID,
-     NS_MEDIA_SNIFFER_CONTRACTID},
-    {"net-content-sniffers", NS_MEDIA_SNIFFER_CONTRACTID,
-     NS_MEDIA_SNIFFER_CONTRACTID},
-    {nullptr}};
-
-static const mozilla::Module kMediaSnifferModule = {
-    mozilla::Module::kVersion, kMediaSnifferCIDs, kMediaSnifferContracts,
-    kMediaSnifferCategories};
-
-NSMODULE_DEFN(nsMediaSnifferModule) = &kMediaSnifferModule;
--- a/toolkit/components/mozintl/MozIntlHelper.cpp
+++ b/toolkit/components/mozintl/MozIntlHelper.cpp
@@ -2,24 +2,16 @@
 /* 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 "MozIntlHelper.h"
 #include "jsapi.h"
 #include "js/PropertySpec.h"
 #include "js/Wrapper.h"
-#include "mozilla/ModuleUtils.h"
-
-#define MOZ_MOZINTLHELPER_CID                        \
-  {                                                  \
-    0xb43c96be, 0x2b3a, 0x4dc4, {                    \
-      0x90, 0xe9, 0xb0, 0x6d, 0x34, 0x21, 0x9b, 0x68 \
-    }                                                \
-  }
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(MozIntlHelper, mozIMozIntlHelper)
 
 MozIntlHelper::MozIntlHelper() = default;
 
 MozIntlHelper::~MozIntlHelper() = default;
@@ -90,28 +82,8 @@ MozIntlHelper::AddDateTimeFormatConstruc
 NS_IMETHODIMP
 MozIntlHelper::AddGetLocaleInfo(JS::Handle<JS::Value> val, JSContext* cx) {
   static const JSFunctionSpec funcs[] = {
       JS_SELF_HOSTED_FN("getLocaleInfo", "Intl_getLocaleInfo", 1, 0),
       JS_FS_END};
 
   return AddFunctions(cx, val, funcs);
 }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(MozIntlHelper)
-NS_DEFINE_NAMED_CID(MOZ_MOZINTLHELPER_CID);
-
-static const Module::CIDEntry kMozIntlHelperCIDs[] = {
-    {&kMOZ_MOZINTLHELPER_CID, false, nullptr, MozIntlHelperConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kMozIntlHelperContracts[] = {
-    {"@mozilla.org/mozintlhelper;1", &kMOZ_MOZINTLHELPER_CID}, {nullptr}};
-
-static const mozilla::Module kMozIntlHelperModule = {mozilla::Module::kVersion,
-                                                     kMozIntlHelperCIDs,
-                                                     kMozIntlHelperContracts,
-                                                     nullptr,
-                                                     nullptr,
-                                                     nullptr,
-                                                     nullptr};
-
-NSMODULE_DEFN(mozMozIntlHelperModule) = &kMozIntlHelperModule;
new file mode 100644
--- /dev/null
+++ b/toolkit/components/mozintl/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': '{b43c96be-2b3a-4dc4-90e9-b06d34219b68}',
+        'contract_ids': ['@mozilla.org/mozintlhelper;1'],
+        'type': 'mozilla::MozIntlHelper',
+        'headers': ['/toolkit/components/mozintl/MozIntlHelper.h'],
+    },
+]
--- a/toolkit/components/mozintl/moz.build
+++ b/toolkit/components/mozintl/moz.build
@@ -20,9 +20,13 @@ SOURCES += [
     'MozIntlHelper.cpp',
 ]
 
 EXTRA_COMPONENTS += [
     'mozIntl.js',
     'mozIntl.manifest',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -1,36 +1,24 @@
 /* -*- 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 "PerfMeasurement.h"
 #include "jsperf.h"
-#include "mozilla/ModuleUtils.h"
 #include "nsMemory.h"
 #include "mozilla/Preferences.h"
 #include "mozJSComponentLoader.h"
 #include "nsZipArchive.h"
 #include "xpc_make_class.h"
 
-#define JSPERF_CONTRACTID "@mozilla.org/jsperf;1"
-
-#define JSPERF_CID                                   \
-  {                                                  \
-    0x421c38e6, 0xaee0, 0x4509, {                    \
-      0xa0, 0x25, 0x13, 0x0f, 0x43, 0x78, 0x03, 0x5a \
-    }                                                \
-  }
-
 namespace mozilla {
 namespace jsperf {
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(Module)
-
 NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable)
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
@@ -79,22 +67,8 @@ Module::Call(nsIXPConnectWrappedNative* 
   loader->FindTargetObject(cx, &targetObj);
 
   *_retval = InitAndSealPerfMeasurementClass(cx, targetObj);
   return NS_OK;
 }
 
 }  // namespace jsperf
 }  // namespace mozilla
-
-NS_DEFINE_NAMED_CID(JSPERF_CID);
-
-static const mozilla::Module::CIDEntry kPerfCIDs[] = {
-    {&kJSPERF_CID, false, nullptr, mozilla::jsperf::ModuleConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kPerfContracts[] = {
-    {JSPERF_CONTRACTID, &kJSPERF_CID}, {nullptr}};
-
-static const mozilla::Module kPerfModule = {mozilla::Module::kVersion,
-                                            kPerfCIDs, kPerfContracts};
-
-NSMODULE_DEFN(jsperf) = &kPerfModule;
new file mode 100644
--- /dev/null
+++ b/toolkit/components/perf/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': '{421c38e6-aee0-4509-a025-130f4378035a}',
+        'contract_ids': ['@mozilla.org/jsperf;1'],
+        'type': 'mozilla::jsperf::Module',
+        'headers': ['/toolkit/components/perf/PerfMeasurement.h'],
+    },
+]
--- a/toolkit/components/perf/moz.build
+++ b/toolkit/components/perf/moz.build
@@ -10,15 +10,19 @@ with Files('**'):
 SOURCES += [
     'PerfMeasurement.cpp',
 ]
 
 EXTRA_JS_MODULES += [
     'PerfMeasurement.jsm',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/js/xpconnect/loader',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
new file mode 100644
--- /dev/null
+++ b/toolkit/components/reflect/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': '{1a817186-357a-47cd-8aea-2850d60e959e}',
+        'contract_ids': ['@mozilla.org/jsreflect;1'],
+        'type': 'mozilla::reflect::Module',
+        'headers': ['/toolkit/components/reflect/reflect.h'],
+    },
+]
--- a/toolkit/components/reflect/moz.build
+++ b/toolkit/components/reflect/moz.build
@@ -10,9 +10,13 @@ with Files('**'):
 SOURCES += [
     'reflect.cpp',
 ]
 
 EXTRA_JS_MODULES += [
     'reflect.jsm',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
--- a/toolkit/components/reflect/reflect.cpp
+++ b/toolkit/components/reflect/reflect.cpp
@@ -1,35 +1,23 @@
 /* -*- 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 "reflect.h"
 #include "jsapi.h"
-#include "mozilla/ModuleUtils.h"
 #include "nsMemory.h"
 #include "nsString.h"
 #include "nsNativeCharsetUtils.h"
 #include "xpc_make_class.h"
 
-#define JSREFLECT_CONTRACTID "@mozilla.org/jsreflect;1"
-
-#define JSREFLECT_CID                                \
-  {                                                  \
-    0x1a817186, 0x357a, 0x47cd, {                    \
-      0x8a, 0xea, 0x28, 0x50, 0xd6, 0x0e, 0x95, 0x9e \
-    }                                                \
-  }
-
 namespace mozilla {
 namespace reflect {
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(Module)
-
 NS_IMPL_ISUPPORTS(Module, nsIXPCScriptable)
 
 Module::Module() = default;
 
 Module::~Module() = default;
 
 #define XPC_MAP_CLASSNAME Module
 #define XPC_MAP_QUOTED_CLASSNAME "Module"
@@ -44,22 +32,8 @@ Module::Call(nsIXPConnectWrappedNative* 
 
   JSAutoRealm ar(cx, global);
   *_retval = JS_InitReflectParse(cx, global);
   return NS_OK;
 }
 
 }  // namespace reflect
 }  // namespace mozilla
-
-NS_DEFINE_NAMED_CID(JSREFLECT_CID);
-
-static const mozilla::Module::CIDEntry kReflectCIDs[] = {
-    {&kJSREFLECT_CID, false, nullptr, mozilla::reflect::ModuleConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kReflectContracts[] = {
-    {JSREFLECT_CONTRACTID, &kJSREFLECT_CID}, {nullptr}};
-
-static const mozilla::Module kReflectModule = {mozilla::Module::kVersion,
-                                               kReflectCIDs, kReflectContracts};
-
-NSMODULE_DEFN(jsreflect) = &kReflectModule;
new file mode 100644
--- /dev/null
+++ b/toolkit/components/remote/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': '{c0773e90-5799-4eff-ad03-3ebcd85624ac}',
+        'contract_ids': ['@mozilla.org/toolkit/remote-service;1'],
+        'type': 'nsRemoteService',
+        'headers': ['/toolkit/components/remote/nsRemoteService.h'],
+    },
+]
--- a/toolkit/components/remote/moz.build
+++ b/toolkit/components/remote/moz.build
@@ -23,11 +23,15 @@ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']
         'nsRemoteService.cpp',
     ]
     if CONFIG['MOZ_ENABLE_DBUS']:
         SOURCES += [
             'nsDBusRemoteService.cpp',
         ]
         CXXFLAGS += CONFIG['MOZ_DBUS_GLIB_CFLAGS']
 
+    XPCOM_MANIFESTS += [
+        'components.conf',
+    ]
+
 FINAL_LIBRARY = 'xul'
 
 CXXFLAGS += CONFIG['TK_CFLAGS']
--- a/toolkit/components/remote/nsRemoteService.cpp
+++ b/toolkit/components/remote/nsRemoteService.cpp
@@ -14,17 +14,16 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 
 #include "nsIServiceManager.h"
 #include "nsIAppShellService.h"
 #include "nsAppShellCID.h"
 #include "nsInterfaceHashtable.h"
-#include "mozilla/ModuleUtils.h"
 #include "nsGTKToolkit.h"
 #include "nsICommandLineRunner.h"
 #include "nsCommandLine.h"
 #include "nsString.h"
 #include "nsIFile.h"
 
 NS_IMPL_ISUPPORTS(nsRemoteService, nsIRemoteService, nsIObserver)
 
@@ -177,32 +176,8 @@ const char* nsRemoteService::HandleComma
   rv = cmdline->Run();
 
   if (NS_ERROR_ABORT == rv) return "500 command not parseable";
 
   if (NS_FAILED(rv)) return "509 internal error";
 
   return "200 executed command";
 }
-
-// {C0773E90-5799-4eff-AD03-3EBCD85624AC}
-#define NS_REMOTESERVICE_CID                        \
-  {                                                 \
-    0xc0773e90, 0x5799, 0x4eff, {                   \
-      0xad, 0x3, 0x3e, 0xbc, 0xd8, 0x56, 0x24, 0xac \
-    }                                               \
-  }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsRemoteService)
-NS_DEFINE_NAMED_CID(NS_REMOTESERVICE_CID);
-
-static const mozilla::Module::CIDEntry kRemoteCIDs[] = {
-    {&kNS_REMOTESERVICE_CID, false, nullptr, nsRemoteServiceConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kRemoteContracts[] = {
-    {"@mozilla.org/toolkit/remote-service;1", &kNS_REMOTESERVICE_CID},
-    {nullptr}};
-
-static const mozilla::Module kRemoteModule = {mozilla::Module::kVersion,
-                                              kRemoteCIDs, kRemoteContracts};
-
-NSMODULE_DEFN(RemoteServiceModule) = &kRemoteModule;
new file mode 100644
--- /dev/null
+++ b/toolkit/components/satchel/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': '{895db6c7-dbdf-40ea-9f64-b175033243dc}',
+        'contract_ids': [
+            '@mozilla.org/autocomplete/search;1?name=form-history',
+            '@mozilla.org/satchel/form-fill-controller;1',
+        ],
+        'type': 'nsFormFillController',
+        'headers': ['/toolkit/components/satchel/nsFormFillController.h'],
+    },
+]
--- a/toolkit/components/satchel/moz.build
+++ b/toolkit/components/satchel/moz.build
@@ -35,11 +35,15 @@ EXTRA_COMPONENTS += [
 ]
 
 EXTRA_JS_MODULES += [
     'AutoCompletePopup.jsm',
     'FormHistory.jsm',
     'nsFormAutoCompleteResult.jsm',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
 
 JAR_MANIFESTS += ['jar.mn']
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -29,17 +29,16 @@
 #include "nsPIDOMWindow.h"
 #include "nsIWebNavigation.h"
 #include "nsIContentViewer.h"
 #include "mozilla/dom/Document.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsRect.h"
 #include "nsILoginManager.h"
-#include "mozilla/ModuleUtils.h"
 #include "nsToolkitCompsCID.h"
 #include "nsEmbedCID.h"
 #include "nsContentUtils.h"
 #include "nsGenericHTMLElement.h"
 #include "nsILoadContext.h"
 #include "nsIFrame.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsFocusManager.h"
@@ -1343,28 +1342,8 @@ int32_t nsFormFillController::GetIndexOf
   treeItem->GetParent(getter_AddRefs(parentItem));
   if (parentItem) {
     nsCOMPtr<nsIDocShell> parentShell = do_QueryInterface(parentItem);
     return GetIndexOfDocShell(parentShell);
   }
 
   return -1;
 }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController)
-
-NS_DEFINE_NAMED_CID(NS_FORMFILLCONTROLLER_CID);
-
-static const mozilla::Module::CIDEntry kSatchelCIDs[] = {
-    {&kNS_FORMFILLCONTROLLER_CID, false, nullptr,
-     nsFormFillControllerConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kSatchelContracts[] = {
-    {"@mozilla.org/satchel/form-fill-controller;1",
-     &kNS_FORMFILLCONTROLLER_CID},
-    {NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID, &kNS_FORMFILLCONTROLLER_CID},
-    {nullptr}};
-
-static const mozilla::Module kSatchelModule = {mozilla::Module::kVersion,
-                                               kSatchelCIDs, kSatchelContracts};
-
-NSMODULE_DEFN(satchel) = &kSatchelModule;
--- a/toolkit/components/telemetry/core/Telemetry.cpp
+++ b/toolkit/components/telemetry/core/Telemetry.cpp
@@ -22,16 +22,17 @@
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "js/GCAPI.h"
 #include "mozilla/dom/ToJSValue.h"
 #include "mozilla/dom/Promise.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/BackgroundHangMonitor.h"
+#include "mozilla/Components.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/FStream.h"
 #include "mozilla/IOInterposer.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MathAlgorithms.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/MemoryTelemetry.h"
 #include "mozilla/ModuleUtils.h"
@@ -1540,45 +1541,16 @@ bool TelemetryImpl::CanRecordExtended() 
   return NS_SUCCEEDED(rv) && canRecordExtended;
 }
 
 bool TelemetryImpl::CanRecordReleaseData() { return CanRecordBase(); }
 
 bool TelemetryImpl::CanRecordPrereleaseData() { return CanRecordExtended(); }
 
 NS_IMPL_ISUPPORTS(TelemetryImpl, nsITelemetry, nsIMemoryReporter)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelemetry,
-                                         TelemetryImpl::CreateTelemetryInstance)
-
-#define NS_TELEMETRY_CID                             \
-  {                                                  \
-    0xaea477f2, 0xb3a2, 0x469c, {                    \
-      0xaa, 0x29, 0x0a, 0x82, 0xd1, 0x32, 0xb8, 0x29 \
-    }                                                \
-  }
-NS_DEFINE_NAMED_CID(NS_TELEMETRY_CID);
-
-const Module::CIDEntry kTelemetryCIDs[] = {
-    {&kNS_TELEMETRY_CID, false, nullptr, nsITelemetryConstructor,
-     Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS},
-    {nullptr}};
-
-const Module::ContractIDEntry kTelemetryContracts[] = {
-    {"@mozilla.org/base/telemetry;1", &kNS_TELEMETRY_CID,
-     Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS},
-    {nullptr}};
-
-const Module kTelemetryModule = {Module::kVersion,
-                                 kTelemetryCIDs,
-                                 kTelemetryContracts,
-                                 nullptr,
-                                 nullptr,
-                                 nullptr,
-                                 TelemetryImpl::ShutdownTelemetry,
-                                 Module::ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS};
 
 NS_IMETHODIMP
 TelemetryImpl::GetFileIOReports(JSContext* cx, JS::MutableHandleValue ret) {
   if (sTelemetryIOObserver) {
     JS::Rooted<JSObject*> obj(cx, JS_NewPlainObject(cx));
     if (!obj) {
       return NS_ERROR_FAILURE;
     }
@@ -1828,18 +1800,16 @@ TelemetryImpl::GetAllStores(JSContext* a
 }  // namespace
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // EXTERNALLY VISIBLE FUNCTIONS in no name space
 // These are NOT listed in Telemetry.h
 
-NSMODULE_DEFN(nsTelemetryModule) = &kTelemetryModule;
-
 /**
  * The XRE_TelemetryAdd function is to be used by embedding applications
  * that can't use mozilla::Telemetry::Accumulate() directly.
  */
 void XRE_TelemetryAccumulate(int aID, uint32_t aSample) {
   mozilla::Telemetry::Accumulate((mozilla::Telemetry::HistogramID)aID, aSample);
 }
 
@@ -2138,10 +2108,18 @@ void RecordEvent(mozilla::Telemetry::Eve
                  const mozilla::Maybe<nsTArray<EventExtraEntry>>& aExtra) {
   TelemetryEvent::RecordEventNative(aId, aValue, aExtra);
 }
 
 void SetEventRecordingEnabled(const nsACString& aCategory, bool aEnabled) {
   TelemetryEvent::SetEventRecordingEnabled(aCategory, aEnabled);
 }
 
+void ShutdownTelemetry() {
+  TelemetryImpl::ShutdownTelemetry();
+}
+
 }  // namespace Telemetry
 }  // namespace mozilla
+
+NS_IMPL_COMPONENT_FACTORY(nsITelemetry) {
+  return TelemetryImpl::CreateTelemetryInstance().downcast<nsISupports>();
+}
--- a/toolkit/components/telemetry/core/Telemetry.h
+++ b/toolkit/components/telemetry/core/Telemetry.h
@@ -39,16 +39,21 @@ struct ChildEventData;
 struct EventExtraEntry;
 
 /**
  * Initialize the Telemetry service on the main thread at startup.
  */
 void Init();
 
 /**
+ * Shutdown the Telemetry service.
+ */
+void ShutdownTelemetry();
+
+/**
  * Adds sample to a histogram defined in TelemetryHistogramEnums.h
  *
  * @param id - histogram id
  * @param sample - value to record.
  */
 void Accumulate(HistogramID id, uint32_t sample);
 
 /**
new file mode 100644
--- /dev/null
+++ b/toolkit/components/telemetry/core/components.conf
@@ -0,0 +1,19 @@
+# -*- 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/Telemetry.h']
+
+UnloadFunc = 'mozilla::Telemetry::ShutdownTelemetry'
+
+Classes = [
+    {
+        'cid': '{aea477f2-b3a2-469c-aa29-0a82d132b829}',
+        'contract_ids': ['@mozilla.org/base/telemetry;1'],
+        'singleton': True,
+        'type': 'nsITelemetry',
+        'processes': ProcessSelector.ALLOW_IN_GPU_VR_AND_SOCKET_PROCESS,
+    },
+]
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -88,16 +88,20 @@ if CONFIG['OS_ARCH'] == 'WINNT':
     ]
 
 # KeyedStackCapturer entirely relies on profiler to be enabled.
 if CONFIG['MOZ_GECKO_PROFILER']:
     SOURCES += [
       'other/KeyedStackCapturer.cpp'
     ]
 
+XPCOM_MANIFESTS += [
+    'core/components.conf',
+]
+
 EXTRA_COMPONENTS += [
     'TelemetryStartup.js',
     'TelemetryStartup.manifest'
 ]
 
 EXTRA_JS_MODULES += [
     'app/TelemetryArchive.jsm',
     'app/TelemetryController.jsm',
new file mode 100644
--- /dev/null
+++ b/toolkit/components/thumbnails/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': '{5a4ae9b5-f475-48ae-9dce-0b4c1d347884}',
+        'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-page-thumb'],
+        'type': 'PageThumbsProtocol',
+        'headers': ['/toolkit/components/thumbnails/PageThumbsProtocol.h'],
+    },
+]
--- a/toolkit/components/thumbnails/moz.build
+++ b/toolkit/components/thumbnails/moz.build
@@ -18,25 +18,28 @@ EXTRA_COMPONENTS += [
 EXTRA_JS_MODULES += [
     'BackgroundPageThumbs.jsm',
     'PageThumbs.jsm',
     'PageThumbsWorker.js',
     'PageThumbUtils.jsm',
 ]
 
 UNIFIED_SOURCES += [
-    'nsPageThumbsModule.cpp',
     'PageThumbsProtocol.cpp'
 ]
 
 XPIDL_SOURCES += [
     'nsIPageThumbsStorageService.idl',
 ]
 
 LOCAL_INCLUDES += [
     '/netwerk/base'
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 XPIDL_MODULE = 'thumbnails'
 
 FINAL_LIBRARY = 'xul'
 
 JAR_MANIFESTS += ['jar.mn']
deleted file mode 100644
--- a/toolkit/components/thumbnails/nsPageThumbsModule.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "mozilla/ModuleUtils.h"
-#include "nsIClassInfoImpl.h"
-
-#include "PageThumbsProtocol.h"
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(PageThumbsProtocol)
-NS_DEFINE_NAMED_CID(PAGETHUMBSPROTOCOL_CID);
-
-const mozilla::Module::CIDEntry kPageThumbsCIDs[] = {
-    {&kPAGETHUMBSPROTOCOL_CID, false, nullptr, PageThumbsProtocolConstructor},
-    {nullptr}};
-
-const mozilla::Module::ContractIDEntry kPageThumbsContracts[] = {
-    {NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-page-thumb",
-     &kPAGETHUMBSPROTOCOL_CID},
-    {nullptr}};
-
-const mozilla::Module kPageThumbsModule = {
-    mozilla::Module::kVersion, kPageThumbsCIDs, kPageThumbsContracts};
-
-NSMODULE_DEFN(nsPageThumbsModule) = &kPageThumbsModule;
new file mode 100644
--- /dev/null
+++ b/toolkit/system/gnome/components.conf
@@ -0,0 +1,45 @@
+# -*- 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/.
+
+InitFunc = 'mozilla::InitGType'
+
+Headers = [
+    '/toolkit/system/gnome/nsGnomeModule.h',
+]
+
+Classes = [
+    {
+        'cid': '{e3a1f3c9-3ae1-4b40-a5e0-7b457fc9a9ad}',
+        'contract_ids': ['@mozilla.org/gio-service;1'],
+        'type': 'nsGIOService',
+        'headers': ['/toolkit/system/gnome/nsGIOService.h'],
+    },
+    {
+        'cid': '{bfd4a9d8-d886-4161-81ef-8868da114170}',
+        'contract_ids': ['@mozilla.org/gsettings-service;1'],
+        'type': 'nsGSettingsService',
+        'headers': ['/toolkit/system/gnome/nsGSettingsService.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{84e11f80-ca55-11dd-ad8b-0800200c9a66}',
+        'contract_ids': ['@mozilla.org/system-alerts-service;1'],
+        'type': 'nsSystemAlertsService',
+        'headers': ['/toolkit/system/gnome/nsSystemAlertsService.h'],
+        'init_method': 'Init',
+    },
+]
+
+if defined('MOZ_ENABLE_GCONF'):
+    Classes += [
+        {
+            'cid': '{d96d5985-a13a-4bdc-9386-ef348d7a97a1}',
+            'contract_ids': ['@mozilla.org/gnome-gconf-service;1'],
+            'type': 'nsGConfService',
+            'headers': ['/toolkit/system/gnome/nsGConfService.h'],
+            'init_method': 'Init',
+        },
+    ]
--- a/toolkit/system/gnome/moz.build
+++ b/toolkit/system/gnome/moz.build
@@ -18,16 +18,20 @@ if CONFIG['MOZ_ENABLE_GCONF']:
         'nsGConfService.cpp',
     ]
 
 SOURCES += [
     'nsGIOService.cpp',
     'nsGSettingsService.cpp',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/toolkit/components/build/',
 ]
 
 CXXFLAGS += CONFIG['MOZ_GCONF_CFLAGS']
 CXXFLAGS += CONFIG['GLIB_CFLAGS']
--- a/toolkit/system/gnome/nsGConfService.h
+++ b/toolkit/system/gnome/nsGConfService.h
@@ -2,25 +2,22 @@
 /* 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 nsGConfService_h_
 #define nsGConfService_h_
 
 #include "nsIGConfService.h"
-#include "gconf/gconf-client.h"
 #include "mozilla/Attributes.h"
 
-#define NS_GCONFSERVICE_CID                          \
-  {                                                  \
-    0xd96d5985, 0xa13a, 0x4bdc, {                    \
-      0x93, 0x86, 0xef, 0x34, 0x8d, 0x7a, 0x97, 0xa1 \
-    }                                                \
-  }
+extern "C" {
+  struct _GConfClient;
+  typedef struct _GConfClient GConfClient;
+}
 
 class nsGConfService final : public nsIGConfService {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIGCONFSERVICE
 
   nsGConfService() : mClient(nullptr) {}
   nsresult Init();
--- a/toolkit/system/gnome/nsGnomeModule.cpp
+++ b/toolkit/system/gnome/nsGnomeModule.cpp
@@ -1,60 +1,15 @@
 /* -*- 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 "nsToolkitCompsCID.h"
-#include "mozilla/ModuleUtils.h"
+#include "nsGnomeModule.h"
 
 #include <glib-object.h>
 
-#ifdef MOZ_ENABLE_GCONF
-#  include "nsGConfService.h"
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGConfService, Init)
-#endif
-#include "nsGIOService.h"
-#include "nsGSettingsService.h"
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsGIOService)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGSettingsService, Init)
-#include "nsSystemAlertsService.h"
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemAlertsService, Init)
-
-#ifdef MOZ_ENABLE_GCONF
-NS_DEFINE_NAMED_CID(NS_GCONFSERVICE_CID);
-#endif
-NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_SYSTEMALERTSSERVICE_CID);
-
-static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
-#ifdef MOZ_ENABLE_GCONF
-    {&kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor},
-#endif
-    {&kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor},
-    {&kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor},
-    {&kNS_SYSTEMALERTSSERVICE_CID, false, nullptr,
-     nsSystemAlertsServiceConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
-#ifdef MOZ_ENABLE_GCONF
-    {NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID},
-#endif
-    {NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID},
-    {NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID},
-    {NS_SYSTEMALERTSERVICE_CONTRACTID, &kNS_SYSTEMALERTSSERVICE_CID},
-    {nullptr}};
-
-static nsresult InitGType() {
+namespace mozilla {
+nsresult InitGType() {
   g_type_init();
   return NS_OK;
 }
-
-static const mozilla::Module kGnomeModule = {mozilla::Module::kVersion,
-                                             kGnomeCIDs,
-                                             kGnomeContracts,
-                                             nullptr,
-                                             nullptr,
-                                             InitGType};
-
-NSMODULE_DEFN(mozgnome) = &kGnomeModule;
+}  // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/toolkit/system/gnome/nsGnomeModule.h
@@ -0,0 +1,10 @@
+/* -*- 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 "nscore.h"
+
+namespace mozilla {
+nsresult InitGType();
+}  // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/toolkit/system/unixproxy/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': '{0fa3158c-d5a7-43de-9181-a285e74cf1d4}',
+        'contract_ids': ['@mozilla.org/system-proxy-settings;1'],
+        'type': 'nsUnixSystemProxySettings',
+    },
+]
--- a/toolkit/system/unixproxy/moz.build
+++ b/toolkit/system/unixproxy/moz.build
@@ -12,9 +12,13 @@ if CONFIG['MOZ_ENABLE_LIBPROXY']:
     SOURCES += [
         'nsLibProxySettings.cpp',
     ]
 else:
     SOURCES += [
         'nsUnixSystemProxySettings.cpp',
     ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 FINAL_LIBRARY = 'xul'
--- a/toolkit/system/unixproxy/nsLibProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
@@ -1,15 +1,15 @@
 /* -*- 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 "nsISystemProxySettings.h"
-#include "mozilla/ModuleUtils.h"
+#include "mozilla/Components.h"
 #include "nsIServiceManager.h"
 #include "nsIURI.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsNetCID.h"
 #include "nspr.h"
 
 extern "C" {
@@ -17,17 +17,16 @@ extern "C" {
 }
 
 class nsUnixSystemProxySettings : public nsISystemProxySettings {
  public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISYSTEMPROXYSETTINGS
 
   nsUnixSystemProxySettings() { mProxyFactory = nullptr; }
-  nsresult Init();
 
  private:
   ~nsUnixSystemProxySettings() {
     if (mProxyFactory) px_proxy_factory_free(mProxyFactory);
   }
 
   pxProxyFactory *mProxyFactory;
 };
@@ -35,18 +34,16 @@ class nsUnixSystemProxySettings : public
 NS_IMPL_ISUPPORTS(nsUnixSystemProxySettings, nsISystemProxySettings)
 
 NS_IMETHODIMP
 nsUnixSystemProxySettings::GetMainThreadOnly(bool *aMainThreadOnly) {
   *aMainThreadOnly = false;
   return NS_OK;
 }
 
-nsresult nsUnixSystemProxySettings::Init() { return NS_OK; }
-
 nsresult nsUnixSystemProxySettings::GetPACURI(nsACString &aResult) {
   // Make sure we return an empty result.
   aResult.Truncate();
   return NS_OK;
 }
 
 nsresult nsUnixSystemProxySettings::GetProxyForURI(const nsACString &aSpec,
                                                    const nsACString &aScheme,
@@ -99,32 +96,11 @@ nsresult nsUnixSystemProxySettings::GetP
 
     c++;
   }
 
   free(proxyArray);
   return NS_OK;
 }
 
-/* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */
-#define NS_UNIXSYSTEMPROXYSERVICE_CID                \
-  {                                                  \
-    0x0fa3158c, 0xd5a7, 0x43de, {                    \
-      0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 \
-    }                                                \
-  }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
-NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
-
-static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
-    {&kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr,
-     nsUnixSystemProxySettingsConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
-    {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID},
-    {nullptr}};
-
-static const mozilla::Module kUnixProxyModule = {
-    mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts};
-
-NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
+NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
+  return do_AddRef(new nsUnixSystemProxySettings()).downcast<nsISupports>();
+}
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
@@ -1,38 +1,40 @@
 /* -*- 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 "nsISystemProxySettings.h"
-#include "mozilla/ModuleUtils.h"
+#include "mozilla/Components.h"
 #include "nsIServiceManager.h"
 #include "nsIGConfService.h"
 #include "nsIURI.h"
 #include "nsReadableUtils.h"
 #include "nsArrayUtils.h"
 #include "prnetdb.h"
 #include "prenv.h"
 #include "nsPrintfCString.h"
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIGSettingsService.h"
 #include "nsInterfaceHashtable.h"
 #include "mozilla/Attributes.h"
 #include "nsIURI.h"
 
+using namespace mozilla;
+
 class nsUnixSystemProxySettings final : public nsISystemProxySettings {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISYSTEMPROXYSETTINGS
 
   nsUnixSystemProxySettings() : mSchemeProxySettings(4) {}
-  nsresult Init();
+  void Init();
 
  private:
   ~nsUnixSystemProxySettings() = default;
 
   nsCOMPtr<nsIGConfService> mGConf;
   nsCOMPtr<nsIGSettingsService> mGSettings;
   nsCOMPtr<nsIGSettingsCollection> mProxySettings;
   nsInterfaceHashtable<nsCStringHashKey, nsIGSettingsCollection>
@@ -54,28 +56,26 @@ NS_IMPL_ISUPPORTS(nsUnixSystemProxySetti
 NS_IMETHODIMP
 nsUnixSystemProxySettings::GetMainThreadOnly(bool* aMainThreadOnly) {
   // dbus prevents us from being threadsafe, but this routine should not block
   // anyhow
   *aMainThreadOnly = true;
   return NS_OK;
 }
 
-nsresult nsUnixSystemProxySettings::Init() {
+void nsUnixSystemProxySettings::Init() {
   mGSettings = do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
   if (mGSettings) {
     mGSettings->GetCollectionForSchema(
         NS_LITERAL_CSTRING("org.gnome.system.proxy"),
         getter_AddRefs(mProxySettings));
   }
   if (!mProxySettings) {
     mGConf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
   }
-
-  return NS_OK;
 }
 
 bool nsUnixSystemProxySettings::IsProxyMode(const char* aMode) {
   nsAutoCString mode;
   return NS_SUCCEEDED(mGConf->GetString(
              NS_LITERAL_CSTRING("/system/proxy/mode"), mode)) &&
          mode.EqualsASCII(aMode);
 }
@@ -494,32 +494,13 @@ nsresult nsUnixSystemProxySettings::GetP
     nsresult rv = GetProxyFromGSettings(aScheme, aHost, aPort, aResult);
     if (NS_SUCCEEDED(rv)) return rv;
   }
   if (mGConf) return GetProxyFromGConf(aScheme, aHost, aPort, aResult);
 
   return GetProxyFromEnvironment(aScheme, aHost, aPort, aResult);
 }
 
-/* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */
-#define NS_UNIXSYSTEMPROXYSERVICE_CID                \
-  {                                                  \
-    0x0fa3158c, 0xd5a7, 0x43de, {                    \
-      0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 \
-    }                                                \
-  }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
-NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
-
-static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
-    {&kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr,
-     nsUnixSystemProxySettingsConstructor},
-    {nullptr}};
-
-static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
-    {NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID},
-    {nullptr}};
-
-static const mozilla::Module kUnixProxyModule = {
-    mozilla::Module::kVersion, kUnixProxyCIDs, kUnixProxyContracts};
-
-NSMODULE_DEFN(nsUnixProxyModule) = &kUnixProxyModule;
+NS_IMPL_COMPONENT_FACTORY(nsUnixSystemProxySettings) {
+  auto result = MakeRefPtr<nsUnixSystemProxySettings>();
+  result->Init();
+  return result.forget().downcast<nsISupports>();
+}