Bug 1478124: Part 8c - Update Layout module to use a static component manifest. r=Ehsan
☠☠ backed out by 1e042fc7de3d ☠ ☠
authorKris Maglione <maglione.k@gmail.com>
Wed, 23 Jan 2019 15:45:56 -0800
changeset 455930 21f4fda0315963e42bae8784c63116f00ee0fa92
parent 455929 b0444e0bc801f828b49f9953a73498cf5ff5024b
child 455931 496aaf774697f817a689ee0d59f2f866fdb16801
push id35463
push usershindli@mozilla.com
push dateTue, 29 Jan 2019 21:38:17 +0000
treeherdermozilla-central@4440fbf71c72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1478124
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 1478124: Part 8c - Update Layout module to use a static component manifest. r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D15041
dom/presentation/provider/MulticastDNSDeviceProvider.cpp
dom/presentation/provider/MulticastDNSDeviceProvider.h
js/xpconnect/src/XPCModule.h
js/xpconnect/src/components.conf
js/xpconnect/src/moz.build
layout/build/components.conf
layout/build/moz.build
layout/build/nsLayoutModule.cpp
layout/build/nsLayoutModule.h
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp
+++ b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp
@@ -104,16 +104,17 @@ NS_IMPL_ISUPPORTS(DNSServiceWrappedListe
                   nsIDNSRegistrationListener, nsIDNSServiceResolveListener,
                   nsIPresentationControlServerListener)
 
 NS_IMPL_ISUPPORTS(MulticastDNSDeviceProvider, nsIPresentationDeviceProvider,
                   nsIDNSServiceDiscoveryListener, nsIDNSRegistrationListener,
                   nsIDNSServiceResolveListener,
                   nsIPresentationControlServerListener, nsIObserver)
 
+MulticastDNSDeviceProvider::MulticastDNSDeviceProvider() {}
 MulticastDNSDeviceProvider::~MulticastDNSDeviceProvider() { Uninit(); }
 
 nsresult MulticastDNSDeviceProvider::Init() {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (mInitialized) {
     return NS_OK;
   }
--- a/dom/presentation/provider/MulticastDNSDeviceProvider.h
+++ b/dom/presentation/provider/MulticastDNSDeviceProvider.h
@@ -40,17 +40,17 @@ class MulticastDNSDeviceProvider final
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPRESENTATIONDEVICEPROVIDER
   NS_DECL_NSIDNSSERVICEDISCOVERYLISTENER
   NS_DECL_NSIDNSREGISTRATIONLISTENER
   NS_DECL_NSIDNSSERVICERESOLVELISTENER
   NS_DECL_NSIPRESENTATIONCONTROLSERVERLISTENER
   NS_DECL_NSIOBSERVER
 
-  explicit MulticastDNSDeviceProvider() = default;
+  explicit MulticastDNSDeviceProvider();
   nsresult Init();
   nsresult Uninit();
 
  private:
   enum class DeviceState : uint32_t { eUnknown, eActive };
 
   class Device final : public nsIPresentationDevice {
    public:
--- a/js/xpconnect/src/XPCModule.h
+++ b/js/xpconnect/src/XPCModule.h
@@ -1,37 +1,25 @@
 /* -*- 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 "xpcprivate.h"
-#include "mozilla/ModuleUtils.h"
 #include "mozJSSubScriptLoader.h"
 
 /* Module implementation for the xpconnect library. */
 
 #define XPCVARIANT_CONTRACTID "@mozilla.org/xpcvariant;1"
 
 // {FE4F7592-C1FC-4662-AC83-538841318803}
 #define SCRIPTABLE_INTERFACES_CID                   \
   {                                                 \
     0xfe4f7592, 0xc1fc, 0x4662, {                   \
       0xac, 0x83, 0x53, 0x88, 0x41, 0x31, 0x88, 0x3 \
     }                                               \
   }
 
 #define MOZJSSUBSCRIPTLOADER_CONTRACTID "@mozilla.org/moz/jssubscript-loader;1"
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(mozJSSubScriptLoader)
-
-NS_DEFINE_NAMED_CID(MOZ_JSSUBSCRIPTLOADER_CID);
-
-#define XPCONNECT_CIDENTRIES                    \
-  {&kMOZ_JSSUBSCRIPTLOADER_CID, false, nullptr, \
-   mozJSSubScriptLoaderConstructor},
-
-#define XPCONNECT_CONTRACTS \
-  {MOZJSSUBSCRIPTLOADER_CONTRACTID, &kMOZ_JSSUBSCRIPTLOADER_CID},
-
 nsresult xpcModuleCtor();
 void xpcModuleDtor();
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/src/components.conf
@@ -0,0 +1,14 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+Classes = [
+    {
+        'cid': '{929814d6-1dd2-11b2-8e08-82fa0a339b00}',
+        'contract_ids': ['@mozilla.org/moz/jssubscript-loader;1'],
+        'type': 'mozJSSubScriptLoader',
+        'headers': ['/js/xpconnect/loader/mozJSSubScriptLoader.h'],
+    },
+]
--- a/js/xpconnect/src/moz.build
+++ b/js/xpconnect/src/moz.build
@@ -39,16 +39,20 @@ UNIFIED_SOURCES += [
     'XPCWrappedNative.cpp',
     'XPCWrappedNativeInfo.cpp',
     'XPCWrappedNativeJSOps.cpp',
     'XPCWrappedNativeProto.cpp',
     'XPCWrappedNativeScope.cpp',
     'XPCWrapper.cpp',
 ]
 
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
+
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../loader',
     '../wrappers',
     '/caps',
new file mode 100644
--- /dev/null
+++ b/layout/build/components.conf
@@ -0,0 +1,458 @@
+# -*- 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 = [
+    '/layout/build/nsLayoutModule.h',
+]
+
+UnloadFunc = 'nsLayoutModuleDtor'
+
+# This module's unload function needs to be called as late as possible.
+Priority = 100
+
+content_types = [
+    'application/ecmascript',
+    'application/javascript',
+    'application/json',
+    'application/mathml+xml',
+    'application/rdf+xml',
+    'application/vnd.mozilla.xul+xml',
+    'application/vnd.wap.xhtml+xml',
+    'application/x-javascript',
+    'application/x-view-source',
+    'application/xhtml+xml',
+    'application/xml',
+    'image/svg+xml',
+    'mozilla.application/cached-xul',
+    'text/cache-manifest',
+    'text/css',
+    'text/ecmascript',
+    'text/html',
+    'text/javascript',
+    'text/json',
+    'text/plain',
+    'text/rdf',
+    'text/vtt',
+    'text/xml',
+]
+
+if defined('MOZ_WEBM'):
+    content_types += [
+        "audio/webm",
+        "video/webm",
+    ]
+
+Classes = [
+    {
+        'cid': '{1691e1f4-ee41-11d4-9885-00c04fa0cf4b}',
+        'type': 'nsIFrameTraversal',
+    },
+    {
+        'cid': '{574ce83e-fe9f-4095-b85c-7909abbf7c37}',
+        'type': 'nsJSURI::Mutator',
+        'headers': ['nsJSProtocolHandler.h'],
+    },
+    {
+        'cid': '{58f089ee-512a-42d2-a935-d0c874128930}',
+        'type': 'nsJSURI::Mutator',
+        'headers': ['nsJSProtocolHandler.h'],
+    },
+    {
+        'cid': '{972d8d8f-f0da-11d4-9885-00c04fa0cf4b}',
+        'type': 'nsIContentViewer',
+    },
+    {
+        'cid': '{bbe50ef2-80eb-469d-b70d-02858275389f}',
+        'type': 'mozilla::dom::BlobURL::Mutator',
+        'headers': ['mozilla/dom/BlobURL.h'],
+    },
+    {
+        'cid': '{f5475c51-59a7-4757-b3d9-e211a9410872}',
+        'type': 'mozilla::dom::BlobURL::Mutator',
+        'headers': ['mozilla/dom/BlobURL.h'],
+    },
+    {
+        'cid': '{fe0ff7c3-8e97-448b-9a8a-86afdb9fbbb6}',
+        'contract_ids': ['@mozilla.org/childprocessmessagemanager;1'],
+        'legacy_constructor': 'CreateChildMessageManager',
+    },
+    {
+        'cid': '{fc886801-e768-11d4-9885-00c04fa0cf4b}',
+        'contract_ids': ['@mozilla.org/content/document-loader-factory;1'],
+        'type': 'nsIDocumentLoaderFactory',
+        'categories': {'Gecko-Content-Viewers': content_types},
+    },
+    {
+        'cid': '{0ddf4df8-4dbb-4133-8b79-9afb966514f5}',
+        'contract_ids': ['@mozilla.org/content/plugin/document-loader-factory;1'],
+        'type': 'nsIDocumentLoaderFactory',
+    },
+    {
+        'cid': '{3b55e72e-ab7e-431b-89c0-3b06a8b14016}',
+        'contract_ids': ['@mozilla.org/content/style-sheet-service;1'],
+        'type': 'nsStyleSheetService',
+        'headers': ['nsStyleSheetService.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{cdcc1ab8-3cea-4e6c-a294-a651fa35227f}',
+        'contract_ids': ['@mozilla.org/contentsecuritymanager;1'],
+        'type': 'nsContentSecurityManager',
+        'headers': ['mozilla/dom/nsContentSecurityManager.h'],
+    },
+    {
+        'cid': '{09d9ed1a-e5d4-4004-bfe0-27ceb923d9ac}',
+        'contract_ids': ['@mozilla.org/cspcontext;1'],
+        'type': 'nsCSPContext',
+        'headers': ['mozilla/dom/nsCSPContext.h'],
+    },
+    {
+        'cid': '{8d2f40b2-4875-4c95-97d9-3f7dca2cb460}',
+        'contract_ids': ['@mozilla.org/cspservice;1'],
+        'type': 'CSPService',
+        'headers': ['mozilla/dom/nsCSPService.h'],
+        'categories': {'content-policy': 'CSPService', 'net-channel-event-sinks': 'CSPService'},
+    },
+    {
+        'cid': '{1147d32c-215b-4014-b180-07fe7aedf915}',
+        'contract_ids': ['@mozilla.org/data-document-content-policy;1'],
+        'type': 'nsDataDocumentContentPolicy',
+        'headers': ['/dom/base/nsDataDocumentContentPolicy.h'],
+        'categories': {'content-policy': '@mozilla.org/data-document-content-policy;1'},
+    },
+    {
+        'cid': '{ecba5203-77da-465a-865e-78b7af10d8f7}',
+        'contract_ids': ['@mozilla.org/devicesensors;1'],
+        'type': 'nsDeviceSensors',
+        'headers': ['nsDeviceSensors.h'],
+    },
+    {
+        'cid': '{38bd0634-0fd4-46f0-b85f-13ced889eeec}',
+        'contract_ids': ['@mozilla.org/docshell/structured-clone-container;1'],
+        'type': 'nsStructuredCloneContainer',
+        'headers': ['nsStructuredCloneContainer.h'],
+    },
+    {
+        'cid': '{3160e271-138d-4cc7-9d63-6429f16957c7}',
+        'contract_ids': ['@mozilla.org/dom/dom-request-service;1'],
+        'singleton': True,
+        'type': 'mozilla::dom::DOMRequestService',
+        'headers': ['mozilla/dom/DOMRequest.h'],
+        'constructor': 'mozilla::dom::DOMRequestService::FactoryCreate',
+    },
+    {
+        'cid': '{656db07c-aa80-49e4-bce8-e431baae697d}',
+        'contract_ids': ['@mozilla.org/dom/localStorage-manager;1'],
+        'legacy_constructor': 'LocalStorageManagerConstructor',
+    },
+    {
+        'cid': '{5a75c25a-5e7e-4d90-8f7c-07eb15cc0aa8}',
+        'contract_ids': ['@mozilla.org/dom/quota-manager-service;1'],
+        'singleton': True,
+        'type': 'mozilla::dom::quota::QuotaManagerService',
+        'headers': ['mozilla/dom/quota/QuotaManagerService.h'],
+        'constructor': 'mozilla::dom::quota::QuotaManagerService::FactoryCreate',
+        'categories': {'idle-daily': 'QuotaManagerService'},
+    },
+    {
+        'cid': '{ae2793c0-2ba3-4adb-9c5e-c23525812c64}',
+        'contract_ids': ['@mozilla.org/dom/sdb-connection;1'],
+        'legacy_constructor': 'mozilla::dom::SDBConnection::Create',
+        'headers': ['mozilla/dom/SDBConnection.h'],
+    },
+    {
+        'cid': '{62ec8731-55ad-4246-b2ea-f26c1fe19d2d}',
+        'contract_ids': ['@mozilla.org/dom/workers/workerdebuggermanager;1'],
+        'singleton': True,
+        'type': 'mozilla::dom::WorkerDebuggerManager',
+        'headers': ['mozilla/dom/WorkerDebuggerManager.h'],
+        'constructor': 'mozilla::dom::WorkerDebuggerManager::GetInstance',
+    },
+    {
+        'cid': '{baa34652-f1f1-4185-b224-244ee82a413a}',
+        'contract_ids': ['@mozilla.org/eventlistenerservice;1'],
+        'type': 'nsIEventListenerService',
+    },
+    {
+        'cid': '{e8ee88b0-5571-4086-a45b-39a716906bdb}',
+        'contract_ids': ['@mozilla.org/expandedprincipal;1'],
+        'type': 'ExpandedPrincipal',
+        'headers': ['/caps/ExpandedPrincipal.h'],
+    },
+    {
+        'cid': '{cf7fd51f-aba2-44c1-9ff0-11f7508efcd4}',
+        'contract_ids': ['@mozilla.org/focus-manager;1'],
+        'type': 'nsIFocusManager',
+    },
+    {
+        'cid': '{7b121f7e-ebe4-43ab-9410-dc9087a1dba6}',
+        'contract_ids': ['@mozilla.org/gecko-media-plugin-service;1'],
+        'singleton': True,
+        'type': 'mozilla::gmp::GeckoMediaPluginService',
+        'headers': ['GMPService.h'],
+        'constructor': 'mozilla::gmp::GeckoMediaPluginService::GetGeckoMediaPluginService',
+    },
+    {
+        'cid': '{01e1c3ff-094a-d048-44b4-62d29c7b4f39}',
+        'contract_ids': ['@mozilla.org/geolocation;1'],
+        'singleton': True,
+        'type': 'mozilla::dom::Geolocation',
+        'headers': ['/dom/geolocation/nsGeolocation.h'],
+        'constructor': 'mozilla::dom::Geolocation::NonWindowSingleton',
+    },
+    {
+        'cid': '{130b016f-fad7-4526-bc7f-827dabf79265}',
+        'contract_ids': ['@mozilla.org/globalmessagemanager;1'],
+        'legacy_constructor': 'CreateGlobalMessageManager',
+    },
+    {
+        'cid': '{bfcb82c2-5611-4318-90d6-baf4a7864252}',
+        'contract_ids': ['@mozilla.org/inspector/deep-tree-walker;1'],
+        'type': 'inDeepTreeWalker',
+        'headers': ['/layout/inspector/inDeepTreeWalker.h'],
+    },
+    {
+        'cid': '{0e3afd3d-eb60-4c2b-963b-56d7c439f124}',
+        'contract_ids': ['@mozilla.org/layout/content-policy;1'],
+        'legacy_constructor': 'CreateContentPolicy',
+    },
+    {
+        'cid': '{4aef38b7-6364-4e23-a5e7-12f837fbbd9c}',
+        'contract_ids': [
+            '@mozilla.org/layout/contentserializer;1?mimetype=application/vnd.mozilla.xul+xml',
+            '@mozilla.org/layout/contentserializer;1?mimetype=application/xml',
+            '@mozilla.org/layout/contentserializer;1?mimetype=image/svg+xml',
+            '@mozilla.org/layout/contentserializer;1?mimetype=text/xml',
+        ],
+        'type': 'nsIContentSerializer',
+        'legacy_constructor': 'CreateXMLContentSerializer',
+    },
+    {
+        'cid': '{e7c2aaf5-c11a-4954-9dbf-e28edec1fd91}',
+        'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=application/xhtml+xml'],
+        'legacy_constructor': 'CreateXHTMLContentSerializer',
+    },
+    {
+        'cid': '{9d3f70da-86e9-11d4-95ec-00b0d03e37b7}',
+        'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=text/html'],
+        'type': 'nsIContentSerializer',
+        'legacy_constructor': 'CreateHTMLContentSerializer',
+    },
+    {
+        'cid': '{6030f7ef-32ed-46a7-9a63-6a5d3f90445f}',
+        'contract_ids': ['@mozilla.org/layout/contentserializer;1?mimetype=text/plain'],
+        'legacy_constructor': 'CreatePlainTextSerializer',
+    },
+    {
+        'cid': '{abc622ea-9655-4123-80d9-22621bdd5465}',
+        'contract_ids': ['@mozilla.org/mediaManagerService;1'],
+        'singleton': True,
+        'type': 'nsIMediaManagerService',
+        'headers': ['mozilla/MediaManager.h'],
+        'constructor': 'mozilla::MediaManager::GetInstance',
+    },
+    {
+        'cid': '{daf1461b-bf29-4f88-8d0e-4bcdf332c862}',
+        'contract_ids': ['@mozilla.org/mixedcontentblocker;1'],
+        'type': 'nsMixedContentBlocker',
+        'headers': ['mozilla/dom/nsMixedContentBlocker.h'],
+        'categories': {
+            'content-policy': '@mozilla.org/mixedcontentblocker;1',
+            'net-channel-event-sinks': '@mozilla.org/mixedcontentblocker;1',
+        },
+    },
+    {
+        'cid': '{4bbe1b96-8956-457f-a03f-9c27435f2afa}',
+        'contract_ids': ['@mozilla.org/net/osfileconstantsservice;1'],
+        'singleton': True,
+        'type': 'mozilla::OSFileConstantsService',
+        'headers': ['mozilla/OSFileConstants.h'],
+        'constructor': 'mozilla::OSFileConstantsService::GetOrCreate',
+    },
+    {
+        'cid': '{bfc310d2-38a0-11d3-8cd3-0060b0fc14a3}',
+        'contract_ids': ['@mozilla.org/network/protocol;1?name=javascript'],
+        'legacy_constructor': 'nsJSProtocolHandler::Create',
+        'headers': ['nsJSProtocolHandler.h'],
+    },
+    {
+        'cid': '{ac9e3e82-bfbd-4f26-941e-f58c8ee178c1}',
+        'contract_ids': ['@mozilla.org/no-data-protocol-content-policy;1'],
+        'type': 'nsNoDataProtocolContentPolicy',
+        'headers': ['/dom/base/nsNoDataProtocolContentPolicy.h'],
+        'categories': {'content-policy': '@mozilla.org/no-data-protocol-content-policy;1'},
+    },
+    {
+        'cid': '{5995b782-6a0e-4066-aac5-276f0a9ad8cf}',
+        'contract_ids': ['@mozilla.org/notificationTelemetryService;1'],
+        'type': 'mozilla::dom::NotificationTelemetryService',
+        'headers': ['mozilla/dom/Notification.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{bd066e5f-146f-4472-8331-7bfd05b1ed90}',
+        'contract_ids': ['@mozilla.org/nullprincipal;1'],
+        'type': 'mozilla::NullPrincipal',
+        'headers': ['/caps/NullPrincipal.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{2a058404-fb85-44ec-8cfd-e8cbdc988dc1}',
+        'contract_ids': ['@mozilla.org/parentprocessmessagemanager;1'],
+        'legacy_constructor': 'CreateParentMessageManager',
+    },
+    {
+        'cid': '{af7b24cb-893f-41bb-961f-5a69388e27c3}',
+        'contract_ids': ['@mozilla.org/parserutils;1'],
+        'type': 'nsParserUtils',
+        'headers': ['nsParserUtils.h'],
+    },
+    {
+        'cid': '{e1e79dec-4085-4994-ac5b-744b016697e6}',
+        'contract_ids': ['@mozilla.org/presentation-device/manager;1'],
+        'type': 'mozilla::dom::PresentationDeviceManager',
+        'headers': ['mozilla/dom/PresentationDeviceManager.h'],
+        'categories': {'profile-after-change': 'PresentationDeviceManager'},
+    },
+    {
+        'cid': '{1d9bb10c-c0ab-4fe8-9e4f-4058b8519832}',
+        'contract_ids': ['@mozilla.org/presentation/presentationservice;1'],
+        'singleton': True,
+        'type': 'nsIPresentationService',
+        'constructor': 'NS_CreatePresentationService',
+        'headers': ['nsIPresentationService.h', '/layout/build/nsLayoutModule.h'],
+        'categories': {'profile-after-change': 'PresentationService'},
+    },
+    {
+        'cid': '{c9d023f4-6228-4c07-8b1d-9c19573faa27}',
+        'contract_ids': ['@mozilla.org/presentation/presentationtcpsessiontransport;1'],
+        'type': 'mozilla::dom::PresentationTCPSessionTransport',
+        'headers': ['mozilla/dom/PresentationTCPSessionTransport.h'],
+    },
+    {
+        'cid': '{653e0e4d-3ee4-45fa-b272-97c20bc01eb8}',
+        'contract_ids': ['@mozilla.org/principal;1'],
+        'type': 'mozilla::ContentPrincipal',
+        'headers': ['/caps/ContentPrincipal.h'],
+    },
+    {
+        'cid': '{2fc2d3e3-020f-404e-b06a-6ecf3ea2334a}',
+        'contract_ids': ['@mozilla.org/push/Notifier;1'],
+        'type': 'mozilla::dom::PushNotifier',
+        'headers': ['mozilla/dom/PushNotifier.h'],
+    },
+    {
+        'cid': '{f68037ec-2790-44c5-8e5f-df5da58b93a7}',
+        'contract_ids': ['@mozilla.org/scriptable-content-iterator;1'],
+        'type': 'ScriptableContentIterator',
+        'headers': ['mozilla/ScriptableContentIterator.h'],
+    },
+    {
+        'cid': '{1950539a-90f0-4d22-b5af-71329c68fa35}',
+        'contract_ids': ['@mozilla.org/scripterror;1'],
+        'type': 'nsScriptError',
+        'headers': ['/dom/bindings/nsScriptError.h'],
+    },
+    {
+        'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}',
+        'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'],
+        'legacy_constructor': 'Construct_nsIScriptSecurityManager',
+    },
+    {
+        'cid': '{c74bde32-bcc7-4840-8430-c733351b212a}',
+        'contract_ids': ['@mozilla.org/serviceworkers/manager;1'],
+        'singleton': True,
+        'type': 'mozilla::dom::ServiceWorkerManager',
+        'headers': ['mozilla/dom/ServiceWorkerManager.h'],
+        'constructor': 'mozilla::dom::ServiceWorkerManager::GetInstance',
+    },
+    {
+        'cid': '{69da374a-fda3-4a93-9fbc-d9304f66a7fe}',
+        'contract_ids': ['@mozilla.org/storage/activity-service;1'],
+        'singleton': True,
+        'type': 'mozilla::dom::StorageActivityService',
+        'headers': ['mozilla/StaticPtr.h', 'mozilla/dom/StorageActivityService.h'],
+        'constructor': 'mozilla::dom::StorageActivityService::GetOrCreate',
+    },
+    {
+        'cid': '{4a6212db-accb-11d3-b765-0060b0b6cecb}',
+        'contract_ids': ['@mozilla.org/systemprincipal;1'],
+        'singleton': True,
+        'type': 'nsIPrincipal',
+        'headers': ['nsScriptSecurityManager.h', '/caps/SystemPrincipal.h'],
+        'constructor': 'nsScriptSecurityManager::SystemPrincipalSingletonConstructor',
+    },
+    {
+        'cid': '{caaab47f-1e31-478e-8919-970904e9cb72}',
+        'contract_ids': ['@mozilla.org/text-input-processor;1'],
+        'type': 'mozilla::TextInputProcessor',
+        'headers': ['mozilla/TextInputProcessor.h'],
+    },
+    {
+        'cid': '{08c6cc8b-cfb0-421d-b1f7-683ff2989681}',
+        'contract_ids': ['@mozilla.org/thirdpartyutil;1'],
+        'type': 'ThirdPartyUtil',
+        'headers': ['/dom/base/ThirdPartyUtil.h'],
+        'init_method': 'Init',
+    },
+    {
+        'cid': '{31689828-da66-49a6-870c-df62b83fe789}',
+        'contract_ids': ['@mozilla.org/websocketevent/service;1'],
+        'singleton': True,
+        'type': 'mozilla::net::WebSocketEventService',
+        'headers': ['mozilla/net/WebSocketEventService.h'],
+        'constructor': 'mozilla::net::WebSocketEventService::GetOrCreate',
+    },
+]
+
+if defined('DEBUG'):
+    Classes += [
+        {
+            'cid': '{NS_LAYOUT_DEBUGGER_CID}',
+            'type': 'nsILayoutDebugger',
+        },
+    ]
+
+if defined('MOZ_WEBSPEECH'):
+    Classes += [
+        {
+            'cid': '{7090524d-5574-4492-a77f-d8d558ced59d}',
+            'contract_ids': ['@mozilla.org/synth-voice-registry;1'],
+            'singleton': True,
+            'type': 'mozilla::dom::nsSynthVoiceRegistry',
+            'headers': ['mozilla/dom/nsSynthVoiceRegistry.h'],
+            'constructor': 'mozilla::dom::nsSynthVoiceRegistry::GetInstanceForService',
+        },
+    ]
+
+if defined('MOZ_WEBSPEECH_TEST_BACKEND'):
+    Classes += [
+        {
+            'cid': '{48c345e7-9929-4f9a-a563-f478222dabcd}',
+            'contract_ids': ['@mozilla.org/webspeech/service;1?name=fake'],
+            'type': 'mozilla::FakeSpeechRecognitionService',
+            'headers': ['mozilla/dom/FakeSpeechRecognitionService.h'],
+        },
+    ]
+
+if defined('ACCESSIBILITY'):
+    Classes += [
+        {
+            'cid': '{3b265b69-f813-48ff-880d-d88d101af404}',
+            'contract_ids': ['@mozilla.org/accessibilityService;1'],
+            'type': 'nsIAccessibilityService',
+        },
+    ]
+
+if defined('ANDROID'):
+    Classes += [
+        {
+            'cid': '{1f15dbc8-bfaa-45de-8a46-08e2e26326b0}',
+            'contract_ids': ['@mozilla.org/widget/hapticfeedback;1'],
+            'type': 'nsHapticFeedback',
+            'headers': ['/dom/system/android/nsHapticFeedback.h'],
+        },
+    ]
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -66,18 +66,16 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'co
         '/dom/system/mac',
     ]
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     LOCAL_INCLUDES += [
         '/dom/system',
         '/dom/system/android',
     ]
 
-if CONFIG['MOZ_WEBSPEECH']:
-    LOCAL_INCLUDES += [
-        '/dom/media/webspeech/recognition',
-        '/dom/media/webspeech/synth',
-    ]
+XPCOM_MANIFESTS += [
+    'components.conf',
+]
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -2,225 +2,94 @@
 /* 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 "base/basictypes.h"
 
 #include "XPCModule.h"
+#include "mozilla/Components.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsImageModule.h"
 #include "nsLayoutStatics.h"
 #include "nsContentCID.h"
 #include "nsContentDLF.h"
 #include "nsContentPolicyUtils.h"
 #include "nsDataDocumentContentPolicy.h"
 #include "nsNoDataProtocolContentPolicy.h"
 #include "nsDOMCID.h"
 #include "nsFrameMessageManager.h"
 #include "nsHTMLContentSerializer.h"
 #include "nsHTMLParts.h"
-#include "nsIComponentManager.h"
 #include "nsIContentSerializer.h"
 #include "nsIContentViewer.h"
-#include "nsIController.h"
-#include "nsIControllers.h"
-#include "nsIFactory.h"
-#include "nsIIdleService.h"
-#include "nsHTMLStyleSheet.h"
 #include "nsILayoutDebugger.h"
-#include "nsNameSpaceManager.h"
-#include "nsIObserver.h"
-#include "nsIObserverService.h"
-#include "nsIScriptError.h"
-#include "nsCaret.h"
 #include "nsPlainTextSerializer.h"
 #include "nsXMLContentSerializer.h"
 #include "nsXHTMLContentSerializer.h"
-#include "nsContentAreaDragDrop.h"
 #include "nsIFrameTraversal.h"
 #include "nsLayoutCID.h"
-#include "nsStyleSheetService.h"
 #include "nsFocusManager.h"
 #include "ThirdPartyUtil.h"
-#include "nsStructuredCloneContainer.h"
 #include "gfxPlatform.h"
 #include "mozilla/gfx/gfxVars.h"
+#include "mozilla/dom/quota/QuotaManagerService.h"
 
 #include "nsIEventListenerService.h"
 #include "nsIMessageManager.h"
 
-// Transformiix stuff
-#include "mozilla/dom/XPathEvaluator.h"
-
 // view stuff
 #include "nsContentCreatorFunctions.h"
 
-#include "nsGlobalWindowCommands.h"
-#include "nsJSProtocolHandler.h"
-#include "nsIControllerContext.h"
-#include "nsZipArchive.h"
-#include "mozilla/Attributes.h"
-#include "mozilla/dom/BlobURL.h"
-#include "mozilla/dom/DOMRequest.h"
-#include "mozilla/dom/SDBConnection.h"
 #include "mozilla/dom/LocalStorageCommon.h"
 #include "mozilla/dom/LocalStorageManager.h"
 #include "mozilla/dom/LocalStorageManager2.h"
-#include "mozilla/dom/quota/QuotaManagerService.h"
-#include "mozilla/dom/ServiceWorkerManager.h"
-#include "mozilla/dom/StorageActivityService.h"
-#include "mozilla/dom/WorkerDebuggerManager.h"
-#include "mozilla/dom/Notification.h"
-#include "mozilla/OSFileConstants.h"
 
-#ifdef MOZ_WEBSPEECH_TEST_BACKEND
-#  include "mozilla/dom/FakeSpeechRecognitionService.h"
-#endif
 #ifdef MOZ_WEBSPEECH
 #  include "mozilla/dom/nsSynthVoiceRegistry.h"
 #endif
 
 #include "mozilla/dom/PushNotifier.h"
 using mozilla::dom::PushNotifier;
 #define PUSHNOTIFIER_CID                             \
   {                                                  \
     0x2fc2d3e3, 0x020f, 0x404e, {                    \
       0xb0, 0x6a, 0x6e, 0xcf, 0x3e, 0xa2, 0x33, 0x4a \
     }                                                \
   }
 
-// Editor stuff
-#include "mozilla/EditorController.h"  //CID
-
 #include "nsScriptSecurityManager.h"
-#include "ExpandedPrincipal.h"
-#include "mozilla/ContentPrincipal.h"
-#include "mozilla/NullPrincipal.h"
-#include "mozilla/SystemPrincipal.h"
 #include "nsNetCID.h"
 #if defined(MOZ_WIDGET_ANDROID)
 #  include "nsHapticFeedback.h"
 #endif
 #include "nsParserUtils.h"
 
-#include "nsHTMLCanvasFrame.h"
-
 class nsIDocumentLoaderFactory;
 
 #define PRODUCT_NAME "Gecko"
 
 /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
 #define NS_PLUGINDOCLOADERFACTORY_CID                \
   {                                                  \
     0x0ddf4df8, 0x4dbb, 0x4133, {                    \
       0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 \
     }                                                \
   }
 
 #include "inDeepTreeWalker.h"
 
 static void Shutdown();
 
-#include "nsGeolocation.h"
-#include "nsDeviceSensors.h"
 #include "mozilla/dom/nsContentSecurityManager.h"
-#include "mozilla/dom/nsCSPService.h"
-#include "mozilla/dom/nsCSPContext.h"
-#include "nsIMediaManager.h"
-#include "mozilla/dom/nsMixedContentBlocker.h"
-
-#include "mozilla/net/WebSocketEventService.h"
-
-#include "nsIPresentationService.h"
-
-#include "MediaManager.h"
-
-#include "GMPService.h"
-
-#include "mozilla/dom/PresentationDeviceManager.h"
-#include "mozilla/dom/PresentationTCPSessionTransport.h"
-
-#include "nsScriptError.h"
-#include "nsBaseCommandController.h"
-#include "nsControllerCommandTable.h"
-
-#include "mozilla/TextInputProcessor.h"
-#include "mozilla/ScriptableContentIterator.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::net;
-using mozilla::dom::quota::QuotaManagerService;
-using mozilla::gmp::GeckoMediaPluginService;
-
-#define NS_HAPTICFEEDBACK_CID                        \
-  {                                                  \
-    0x1f15dbc8, 0xbfaa, 0x45de, {                    \
-      0x8a, 0x46, 0x08, 0xe2, 0xe2, 0x63, 0x26, 0xb0 \
-    }                                                \
-  }
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserUtils)
-
-// PresentationDeviceManager
-/* e1e79dec-4085-4994-ac5b-744b016697e6 */
-#define PRESENTATION_DEVICE_MANAGER_CID              \
-  {                                                  \
-    0xe1e79dec, 0x4085, 0x4994, {                    \
-      0xac, 0x5b, 0x74, 0x4b, 0x01, 0x66, 0x97, 0xe6 \
-    }                                                \
-  }
-
-#define PRESENTATION_TCP_SESSION_TRANSPORT_CID       \
-  {                                                  \
-    0xc9d023f4, 0x6228, 0x4c07, {                    \
-      0x8b, 0x1d, 0x9c, 0x19, 0x57, 0x3f, 0xaa, 0x27 \
-    }                                                \
-  }
-
-already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
-
-// Factory Constructor
-typedef mozilla::dom::BlobURL::Mutator BlobURLMutator;
-NS_GENERIC_FACTORY_CONSTRUCTOR(BlobURLMutator)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService,
-                                         DOMRequestService::FactoryCreate)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(QuotaManagerService,
-                                         QuotaManagerService::FactoryCreate)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ServiceWorkerManager,
-                                         ServiceWorkerManager::GetInstance)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WorkerDebuggerManager,
-                                         WorkerDebuggerManager::GetInstance)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(StorageActivityService,
-                                         StorageActivityService::GetOrCreate)
-
-#ifdef MOZ_WEBSPEECH
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
-    nsSynthVoiceRegistry, nsSynthVoiceRegistry::GetInstanceForService)
-#endif
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceSensors)
-
-#if defined(ANDROID)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
-#endif
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
-                                         MediaManager::GetInstance)
-NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationDeviceManager)
-NS_GENERIC_FACTORY_CONSTRUCTOR(TextInputProcessor)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService,
-                                         NS_CreatePresentationService)
-NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NotificationTelemetryService, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR(PushNotifier)
-NS_GENERIC_FACTORY_CONSTRUCTOR(ScriptableContentIterator)
 
 //-----------------------------------------------------------------------------
 
 static bool gInitialized = false;
 
 // Perform our one-time intialization for this module
 
 void nsLayoutModuleInitialize() {
@@ -266,79 +135,68 @@ already_AddRefed<nsIContentViewer> NS_Ne
 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
 nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
 
 nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
 nsresult NS_NewGlobalMessageManager(nsISupports** aResult);
 nsresult NS_NewParentProcessMessageManager(nsISupports** aResult);
 nsresult NS_NewChildProcessMessageManager(nsISupports** aResult);
 
-#define MAKE_CTOR(ctor_, iface_, func_)                                       \
-  static nsresult ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) { \
-    *aResult = nullptr;                                                       \
-    if (aOuter) return NS_ERROR_NO_AGGREGATION;                               \
-    iface_* inst;                                                             \
-    nsresult rv = func_(&inst);                                               \
-    if (NS_SUCCEEDED(rv)) {                                                   \
-      rv = inst->QueryInterface(aIID, aResult);                               \
-      NS_RELEASE(inst);                                                       \
-    }                                                                         \
-    return rv;                                                                \
+#define MAKE_CTOR(ctor_, iface_, func_)                                \
+  nsresult ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) { \
+    *aResult = nullptr;                                                \
+    if (aOuter) return NS_ERROR_NO_AGGREGATION;                        \
+    iface_* inst;                                                      \
+    nsresult rv = func_(&inst);                                        \
+    if (NS_SUCCEEDED(rv)) {                                            \
+      rv = inst->QueryInterface(aIID, aResult);                        \
+      NS_RELEASE(inst);                                                \
+    }                                                                  \
+    return rv;                                                         \
   }
 
-// As above, but expects
-//   already_AddRefed<nsIFoo> NS_NewFoo();
-// instead of
-//   nsresult NS_NewFoo(nsIFoo**);
-#define MAKE_CTOR2(ctor_, iface_, func_)                                      \
-  static nsresult ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) { \
-    *aResult = nullptr;                                                       \
-    if (aOuter) {                                                             \
-      return NS_ERROR_NO_AGGREGATION;                                         \
-    }                                                                         \
-    nsCOMPtr<iface_> inst = func_();                                          \
-    inst.forget(aResult);                                                     \
-    return NS_OK;                                                             \
+#define MAKE_GENERIC_CTOR(iface_, func_)             \
+  NS_IMPL_COMPONENT_FACTORY(iface_) {                \
+    nsCOMPtr<iface_> inst;                           \
+    if (NS_SUCCEEDED(func_(getter_AddRefs(inst)))) { \
+      return inst.forget();                          \
+    }                                                \
+    return nullptr;                                  \
   }
 
+#define MAKE_GENERIC_CTOR2(iface_, func_) \
+  NS_IMPL_COMPONENT_FACTORY(iface_) { return func_(); }
+
 #ifdef DEBUG
-MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
+MAKE_GENERIC_CTOR(nsILayoutDebugger, NS_NewLayoutDebugger)
 #endif
 
-MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
+MAKE_GENERIC_CTOR(nsIFrameTraversal, NS_CreateFrameTraversal)
 
-NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
+MAKE_GENERIC_CTOR2(nsIContentViewer, NS_NewContentViewer)
 
-MAKE_CTOR2(CreateContentViewer, nsIContentViewer, NS_NewContentViewer)
 MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer,
           NS_NewXMLContentSerializer)
 MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer,
           NS_NewHTMLContentSerializer)
 MAKE_CTOR(CreateXHTMLContentSerializer, nsIContentSerializer,
           NS_NewXHTMLContentSerializer)
 MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer,
           NS_NewPlainTextSerializer)
 MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
-MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory,
-          NS_NewContentDocumentLoaderFactory)
-MAKE_CTOR(CreateEventListenerService, nsIEventListenerService,
-          NS_NewEventListenerService)
+
+MAKE_GENERIC_CTOR(nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
+MAKE_GENERIC_CTOR(nsIEventListenerService, NS_NewEventListenerService)
 MAKE_CTOR(CreateGlobalMessageManager, nsISupports, NS_NewGlobalMessageManager)
 MAKE_CTOR(CreateParentMessageManager, nsISupports,
           NS_NewParentProcessMessageManager)
 MAKE_CTOR(CreateChildMessageManager, nsISupports,
           NS_NewChildProcessMessageManager)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
-MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManager)
 
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init)
-
-typedef nsJSURI::Mutator nsJSURIMutator;
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURIMutator)
+MAKE_GENERIC_CTOR(nsIFocusManager, NS_NewFocusManager)
 
 // views are not refcounted, so this is the same as
 // NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
 #define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass)                  \
   static nsresult _InstanceClass##Constructor(nsISupports* aOuter,             \
                                               REFNSIID aIID, void** aResult) { \
     nsresult rv;                                                               \
                                                                                \
@@ -353,357 +211,73 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURIMu
       rv = NS_ERROR_OUT_OF_MEMORY;                                             \
       return rv;                                                               \
     }                                                                          \
     rv = inst->QueryInterface(aIID, aResult);                                  \
                                                                                \
     return rv;                                                                 \
   }
 
-#define NS_GEOLOCATION_CID                           \
-  {                                                  \
-    0x1E1C3FF, 0x94A, 0xD048, {                      \
-      0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 \
-    }                                                \
-  }
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Geolocation,
-                                         Geolocation::NonWindowSingleton)
-
-#define NS_WEBSOCKETEVENT_SERVICE_CID                \
-  {                                                  \
-    0x31689828, 0xda66, 0x49a6, {                    \
-      0x87, 0x0c, 0xdf, 0x62, 0xb8, 0x3f, 0xe7, 0x89 \
-    }                                                \
-  }
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WebSocketEventService,
-                                         WebSocketEventService::GetOrCreate)
-
-#ifdef MOZ_WEBSPEECH_TEST_BACKEND
-NS_GENERIC_FACTORY_CONSTRUCTOR(FakeSpeechRecognitionService)
-#endif
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentSecurityManager)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSPContext)
-NS_GENERIC_FACTORY_CONSTRUCTOR(CSPService)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsMixedContentBlocker)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(ContentPrincipal)
-NS_GENERIC_FACTORY_CONSTRUCTOR(ExpandedPrincipal)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
-    SystemPrincipal,
-    nsScriptSecurityManager::SystemPrincipalSingletonConstructor)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(NullPrincipal, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer)
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(OSFileConstantsService,
-                                         OSFileConstantsService::GetOrCreate);
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(
-    GeckoMediaPluginService,
-    GeckoMediaPluginService::GetGeckoMediaPluginService)
-
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptError)
-
 #ifdef ACCESSIBILITY
 #  include "xpcAccessibilityService.h"
 
-MAKE_CTOR(CreateA11yService, nsIAccessibilityService,
-          NS_GetAccessibilityService)
+MAKE_GENERIC_CTOR(nsIAccessibilityService, NS_GetAccessibilityService)
 #endif
 
-static nsresult Construct_nsIScriptSecurityManager(nsISupports* aOuter,
-                                                   REFNSIID aIID,
-                                                   void** aResult) {
+nsresult Construct_nsIScriptSecurityManager(nsISupports* aOuter, REFNSIID aIID,
+                                            void** aResult) {
   if (!aResult) return NS_ERROR_NULL_POINTER;
   *aResult = nullptr;
   if (aOuter) return NS_ERROR_NO_AGGREGATION;
   nsScriptSecurityManager* obj =
       nsScriptSecurityManager::GetScriptSecurityManager();
   if (!obj) return NS_ERROR_OUT_OF_MEMORY;
   if (NS_FAILED(obj->QueryInterface(aIID, aResult))) return NS_ERROR_FAILURE;
   return NS_OK;
 }
 
-#ifdef DEBUG
-NS_DEFINE_NAMED_CID(NS_LAYOUT_DEBUGGER_CID);
-#endif
-NS_DEFINE_NAMED_CID(NS_FRAMETRAVERSAL_CID);
-NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID);
-NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
-NS_DEFINE_NAMED_CID(NS_XMLCONTENTSERIALIZER_CID);
-NS_DEFINE_NAMED_CID(NS_XHTMLCONTENTSERIALIZER_CID);
-NS_DEFINE_NAMED_CID(NS_HTMLCONTENTSERIALIZER_CID);
-NS_DEFINE_NAMED_CID(NS_PLAINTEXTSERIALIZER_CID);
-NS_DEFINE_NAMED_CID(NS_PARSERUTILS_CID);
-NS_DEFINE_NAMED_CID(NS_CONTENTPOLICY_CID);
-NS_DEFINE_NAMED_CID(NS_DATADOCUMENTCONTENTPOLICY_CID);
-NS_DEFINE_NAMED_CID(NS_NODATAPROTOCOLCONTENTPOLICY_CID);
-NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
-NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
-NS_DEFINE_NAMED_CID(NS_JSURI_CID);
-NS_DEFINE_NAMED_CID(NS_JSURIMUTATOR_CID);
-NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
-NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID);
-NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURIMUTATOR_CID);
-NS_DEFINE_NAMED_CID(NS_SDBCONNECTION_CID);
-NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
-NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID);
-NS_DEFINE_NAMED_CID(QUOTAMANAGER_SERVICE_CID);
-NS_DEFINE_NAMED_CID(SERVICEWORKERMANAGER_CID);
-NS_DEFINE_NAMED_CID(STORAGEACTIVITYSERVICE_CID);
-NS_DEFINE_NAMED_CID(NOTIFICATIONTELEMETRYSERVICE_CID);
-NS_DEFINE_NAMED_CID(PUSHNOTIFIER_CID);
-NS_DEFINE_NAMED_CID(WORKERDEBUGGERMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
-NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_CONTENTSECURITYMANAGER_CID);
-NS_DEFINE_NAMED_CID(CSPSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_CSPCONTEXT_CID);
-NS_DEFINE_NAMED_CID(NS_MIXEDCONTENTBLOCKER_CID);
-NS_DEFINE_NAMED_CID(NS_EVENTLISTENERSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_GLOBALMESSAGEMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_PARENTPROCESSMESSAGEMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_CHILDPROCESSMESSAGEMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_SCRIPTSECURITYMANAGER_CID);
-NS_DEFINE_NAMED_CID(NS_PRINCIPAL_CID);
-NS_DEFINE_NAMED_CID(NS_EXPANDEDPRINCIPAL_CID);
-NS_DEFINE_NAMED_CID(NS_SYSTEMPRINCIPAL_CID);
-NS_DEFINE_NAMED_CID(NS_NULLPRINCIPAL_CID);
-NS_DEFINE_NAMED_CID(THIRDPARTYUTIL_CID);
-NS_DEFINE_NAMED_CID(NS_STRUCTUREDCLONECONTAINER_CID);
-NS_DEFINE_NAMED_CID(NS_DEVICE_SENSORS_CID);
-#if defined(ANDROID)
-NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID);
-#endif
-NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID);
-NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID);
-#ifdef MOZ_WEBSPEECH_TEST_BACKEND
-NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID);
-#endif
-#ifdef MOZ_WEBSPEECH
-NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID);
-#endif
-
-#ifdef ACCESSIBILITY
-NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
-#endif
-
-NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
-
-NS_DEFINE_NAMED_CID(PRESENTATION_SERVICE_CID);
-NS_DEFINE_NAMED_CID(PRESENTATION_DEVICE_MANAGER_CID);
-NS_DEFINE_NAMED_CID(PRESENTATION_TCP_SESSION_TRANSPORT_CID);
-
-NS_DEFINE_NAMED_CID(TEXT_INPUT_PROCESSOR_CID);
-
-NS_DEFINE_NAMED_CID(NS_SCRIPTERROR_CID);
-
-NS_DEFINE_NAMED_CID(SCRIPTABLE_CONTENT_ITERATOR_CID);
-
-static nsresult LocalStorageManagerConstructor(nsISupports* aOuter,
-                                               REFNSIID aIID, void** aResult) {
+nsresult LocalStorageManagerConstructor(nsISupports* aOuter, REFNSIID aIID,
+                                        void** aResult) {
   if (NextGenLocalStorageEnabled()) {
     RefPtr<LocalStorageManager2> manager = new LocalStorageManager2();
     return manager->QueryInterface(aIID, aResult);
   }
 
   RefPtr<LocalStorageManager> manager = new LocalStorageManager();
   return manager->QueryInterface(aIID, aResult);
 }
 
-static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
+static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
     // clang-format off
-  XPCONNECT_CIDENTRIES
-#ifdef DEBUG
-  { &kNS_LAYOUT_DEBUGGER_CID, false, nullptr, CreateNewLayoutDebugger },
-#endif
-  { &kNS_FRAMETRAVERSAL_CID, false, nullptr, CreateNewFrameTraversal },
-  { &kIN_DEEPTREEWALKER_CID, false, nullptr, inDeepTreeWalkerConstructor },
-  { &kNS_CONTENT_VIEWER_CID, false, nullptr, CreateContentViewer },
-  { &kNS_XMLCONTENTSERIALIZER_CID, false, nullptr, CreateXMLContentSerializer },
-  { &kNS_HTMLCONTENTSERIALIZER_CID, false, nullptr, CreateHTMLContentSerializer },
-  { &kNS_XHTMLCONTENTSERIALIZER_CID, false, nullptr, CreateXHTMLContentSerializer },
-  { &kNS_PLAINTEXTSERIALIZER_CID, false, nullptr, CreatePlainTextSerializer },
-  { &kNS_PARSERUTILS_CID, false, nullptr, nsParserUtilsConstructor },
-  { &kNS_CONTENTPOLICY_CID, false, nullptr, CreateContentPolicy },
-  { &kNS_DATADOCUMENTCONTENTPOLICY_CID, false, nullptr, nsDataDocumentContentPolicyConstructor },
-  { &kNS_NODATAPROTOCOLCONTENTPOLICY_CID, false, nullptr, nsNoDataProtocolContentPolicyConstructor },
-  { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, nullptr, CreateContentDLF },
-  { &kNS_JSPROTOCOLHANDLER_CID, false, nullptr, nsJSProtocolHandler::Create },
-  { &kNS_JSURI_CID, false, nullptr, nsJSURIMutatorConstructor }, // do_CreateInstance returns mutator
-  { &kNS_JSURIMUTATOR_CID, false, nullptr, nsJSURIMutatorConstructor },
-  { &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF },
-  { &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
-  { &kNS_HOSTOBJECTURI_CID, false, nullptr, BlobURLMutatorConstructor }, // do_CreateInstance returns mutator
-  { &kNS_HOSTOBJECTURIMUTATOR_CID, false, nullptr, BlobURLMutatorConstructor },
-  { &kNS_SDBCONNECTION_CID, false, nullptr, SDBConnection::Create },
-  { &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, LocalStorageManagerConstructor },
-  { &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor },
-  { &kQUOTAMANAGER_SERVICE_CID, false, nullptr, QuotaManagerServiceConstructor },
-  { &kSERVICEWORKERMANAGER_CID, false, nullptr, ServiceWorkerManagerConstructor },
-  { &kSTORAGEACTIVITYSERVICE_CID, false, nullptr, StorageActivityServiceConstructor },
-  { &kNOTIFICATIONTELEMETRYSERVICE_CID, false, nullptr, NotificationTelemetryServiceConstructor },
-  { &kPUSHNOTIFIER_CID, false, nullptr, PushNotifierConstructor },
-  { &kWORKERDEBUGGERMANAGER_CID, true, nullptr, WorkerDebuggerManagerConstructor },
-  { &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor },
-  { &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor },
-  { &kNS_FOCUSMANAGER_CID, false, nullptr, CreateFocusManager },
-#ifdef MOZ_WEBSPEECH_TEST_BACKEND
-  { &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID, false, nullptr, FakeSpeechRecognitionServiceConstructor },
-#endif
-#ifdef MOZ_WEBSPEECH
-  { &kNS_SYNTHVOICEREGISTRY_CID, true, nullptr, nsSynthVoiceRegistryConstructor },
-#endif
-  { &kNS_CONTENTSECURITYMANAGER_CID, false, nullptr, nsContentSecurityManagerConstructor },
-  { &kCSPSERVICE_CID, false, nullptr, CSPServiceConstructor },
-  { &kNS_CSPCONTEXT_CID, false, nullptr, nsCSPContextConstructor },
-  { &kNS_MIXEDCONTENTBLOCKER_CID, false, nullptr, nsMixedContentBlockerConstructor },
-  { &kNS_EVENTLISTENERSERVICE_CID, false, nullptr, CreateEventListenerService },
-  { &kNS_GLOBALMESSAGEMANAGER_CID, false, nullptr, CreateGlobalMessageManager },
-  { &kNS_PARENTPROCESSMESSAGEMANAGER_CID, false, nullptr, CreateParentMessageManager },
-  { &kNS_CHILDPROCESSMESSAGEMANAGER_CID, false, nullptr, CreateChildMessageManager },
-  { &kNS_SCRIPTSECURITYMANAGER_CID, false, nullptr, Construct_nsIScriptSecurityManager },
-  { &kNS_PRINCIPAL_CID, false, nullptr, ContentPrincipalConstructor },
-  { &kNS_EXPANDEDPRINCIPAL_CID, false, nullptr, ExpandedPrincipalConstructor },
-  { &kNS_SYSTEMPRINCIPAL_CID, false, nullptr, SystemPrincipalConstructor },
-  { &kNS_NULLPRINCIPAL_CID, false, nullptr, NullPrincipalConstructor },
-  { &kNS_DEVICE_SENSORS_CID, false, nullptr, nsDeviceSensorsConstructor },
-#if defined(ANDROID)
-  { &kNS_HAPTICFEEDBACK_CID, false, nullptr, nsHapticFeedbackConstructor },
-#endif
-  { &kTHIRDPARTYUTIL_CID, false, nullptr, ThirdPartyUtilConstructor },
-  { &kNS_STRUCTUREDCLONECONTAINER_CID, false, nullptr, nsStructuredCloneContainerConstructor },
-  { &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor },
-  { &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor },
-  { &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor },
-#ifdef ACCESSIBILITY
-  { &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
-#endif
-  { &kPRESENTATION_SERVICE_CID, false, nullptr, nsIPresentationServiceConstructor },
-  { &kPRESENTATION_DEVICE_MANAGER_CID, false, nullptr, PresentationDeviceManagerConstructor },
-  { &kPRESENTATION_TCP_SESSION_TRANSPORT_CID, false, nullptr, PresentationTCPSessionTransportConstructor },
-  { &kTEXT_INPUT_PROCESSOR_CID, false, nullptr, TextInputProcessorConstructor },
-  { &kNS_SCRIPTERROR_CID, false, nullptr, nsScriptErrorConstructor },
-  { &kSCRIPTABLE_CONTENT_ITERATOR_CID, false, nullptr, ScriptableContentIteratorConstructor },
-  { nullptr }
+  { "clear-origin-attributes-data", "QuotaManagerService", "service," QUOTAMANAGER_SERVICE_CONTRACTID },
+    {nullptr}
     // clang-format on
 };
 
-static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
-    // clang-format off
-  XPCONNECT_CONTRACTS
-  { "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml", &kNS_XMLCONTENTSERIALIZER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml", &kNS_XMLCONTENTSERIALIZER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml", &kNS_XHTMLCONTENTSERIALIZER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml", &kNS_XMLCONTENTSERIALIZER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html", &kNS_HTMLCONTENTSERIALIZER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml", &kNS_XMLCONTENTSERIALIZER_CID },
-  { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain", &kNS_PLAINTEXTSERIALIZER_CID },
-  { NS_PARSERUTILS_CONTRACTID, &kNS_PARSERUTILS_CID },
-  { NS_CONTENTPOLICY_CONTRACTID, &kNS_CONTENTPOLICY_CID },
-  { NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, &kNS_DATADOCUMENTCONTENTPOLICY_CID },
-  { NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, &kNS_NODATAPROTOCOLCONTENTPOLICY_CID },
-  { CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID },
-  { NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID },
-  { PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
-  { NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
-  { NS_SDBCONNECTION_CONTRACTID, &kNS_SDBCONNECTION_CID },
-  { "@mozilla.org/dom/localStorage-manager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
-  { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID },
-  { QUOTAMANAGER_SERVICE_CONTRACTID, &kQUOTAMANAGER_SERVICE_CID },
-  { SERVICEWORKERMANAGER_CONTRACTID, &kSERVICEWORKERMANAGER_CID },
-  { STORAGE_ACTIVITY_SERVICE_CONTRACTID, &kSTORAGEACTIVITYSERVICE_CID },
-  { NOTIFICATIONTELEMETRYSERVICE_CONTRACTID, &kNOTIFICATIONTELEMETRYSERVICE_CID },
-  { PUSHNOTIFIER_CONTRACTID, &kPUSHNOTIFIER_CID },
-  { WORKERDEBUGGERMANAGER_CONTRACTID, &kWORKERDEBUGGERMANAGER_CID },
-  { "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID },
-  { "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID },
-  { "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
-#ifdef MOZ_WEBSPEECH_TEST_BACKEND
-  { NS_SPEECH_RECOGNITION_SERVICE_CONTRACTID_PREFIX "fake", &kNS_FAKE_SPEECH_RECOGNITION_SERVICE_CID },
-#endif
-#ifdef MOZ_WEBSPEECH
-  { NS_SYNTHVOICEREGISTRY_CONTRACTID, &kNS_SYNTHVOICEREGISTRY_CID },
-#endif
-  { NS_CONTENTSECURITYMANAGER_CONTRACTID, &kNS_CONTENTSECURITYMANAGER_CID },
-  { CSPSERVICE_CONTRACTID, &kCSPSERVICE_CID },
-  { NS_CSPCONTEXT_CONTRACTID, &kNS_CSPCONTEXT_CID },
-  { NS_MIXEDCONTENTBLOCKER_CONTRACTID, &kNS_MIXEDCONTENTBLOCKER_CID },
-  { NS_EVENTLISTENERSERVICE_CONTRACTID, &kNS_EVENTLISTENERSERVICE_CID },
-  { NS_GLOBALMESSAGEMANAGER_CONTRACTID, &kNS_GLOBALMESSAGEMANAGER_CID },
-  { NS_PARENTPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_PARENTPROCESSMESSAGEMANAGER_CID },
-  { NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_CHILDPROCESSMESSAGEMANAGER_CID },
-  { NS_SCRIPTSECURITYMANAGER_CONTRACTID, &kNS_SCRIPTSECURITYMANAGER_CID },
-  { NS_PRINCIPAL_CONTRACTID, &kNS_PRINCIPAL_CID },
-  { NS_EXPANDEDPRINCIPAL_CONTRACTID, &kNS_EXPANDEDPRINCIPAL_CID },
-  { NS_SYSTEMPRINCIPAL_CONTRACTID, &kNS_SYSTEMPRINCIPAL_CID },
-  { NS_NULLPRINCIPAL_CONTRACTID, &kNS_NULLPRINCIPAL_CID },
-  { NS_DEVICE_SENSORS_CONTRACTID, &kNS_DEVICE_SENSORS_CID },
-#if defined(ANDROID)
-  { "@mozilla.org/widget/hapticfeedback;1", &kNS_HAPTICFEEDBACK_CID },
-#endif
-  { THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID },
-  { NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID },
-  { OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID },
-  { MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID },
-#ifdef ACCESSIBILITY
-  { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
-#endif
-  { "@mozilla.org/gecko-media-plugin-service;1",  &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
-  { PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID },
-  { PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_CID },
-  { PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID, &kPRESENTATION_TCP_SESSION_TRANSPORT_CID },
-  { "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID },
-  { NS_SCRIPTERROR_CONTRACTID, &kNS_SCRIPTERROR_CID },
-  { "@mozilla.org/scriptable-content-iterator;1", &kSCRIPTABLE_CONTENT_ITERATOR_CID },
-  { nullptr }
-};
+void nsLayoutModuleDtor() {
+  if (XRE_GetProcessType() == GeckoProcessType_GPU ||
+      XRE_GetProcessType() == GeckoProcessType_VR ||
+      XRE_GetProcessType() == GeckoProcessType_RDD) {
+    return;
+  }
 
-static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
-  { "content-policy", NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID },
-  { "content-policy", NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID },
-  { "content-policy", "CSPService", CSPSERVICE_CONTRACTID },
-  { "content-policy", NS_MIXEDCONTENTBLOCKER_CONTRACTID, NS_MIXEDCONTENTBLOCKER_CONTRACTID },
-  { "net-channel-event-sinks", "CSPService", CSPSERVICE_CONTRACTID },
-  { "net-channel-event-sinks", NS_MIXEDCONTENTBLOCKER_CONTRACTID, NS_MIXEDCONTENTBLOCKER_CONTRACTID },
-  { "app-startup", "Script Security Manager", "service," NS_SCRIPTSECURITYMANAGER_CONTRACTID },
-  { "app-startup", "Push Notifier", "service," PUSHNOTIFIER_CONTRACTID },
-  { "clear-origin-attributes-data", "QuotaManagerService", "service," QUOTAMANAGER_SERVICE_CONTRACTID },
-  { OBSERVER_TOPIC_IDLE_DAILY, "QuotaManagerService", QUOTAMANAGER_SERVICE_CONTRACTID },
-  CONTENTDLF_CATEGORIES
-  { "profile-after-change", "PresentationDeviceManager", PRESENTATION_DEVICE_MANAGER_CONTRACTID },
-  { "profile-after-change", "PresentationService", PRESENTATION_SERVICE_CONTRACTID },
-  { "profile-after-change", "Notification Telemetry Service", NOTIFICATIONTELEMETRYSERVICE_CONTRACTID },
-  { nullptr }
-    // clang-format on
-};
-
-static nsresult Initialize() {
-  // nsLayoutModuleInitialize should be called first.
-  MOZ_RELEASE_ASSERT(gInitialized);
-  return NS_OK;
-}
-
-static void LayoutModuleDtor() {
   Shutdown();
   nsContentUtils::XPCOMShutdown();
 
   // Layout depends heavily on gfx and imagelib, so we want to make sure that
   // these modules are shut down after all the layout cleanup runs.
   mozilla::image::ShutdownModule();
   gfxPlatform::Shutdown();
   gfx::gfxVars::Shutdown();
 
   nsScriptSecurityManager::Shutdown();
   xpcModuleDtor();
 }
 
-static const mozilla::Module kLayoutModule = {
-    mozilla::Module::kVersion, kLayoutCIDs, kLayoutContracts,
-    kLayoutCategories,         nullptr,     Initialize,
-    LayoutModuleDtor};
+static const mozilla::Module kLayoutModule = {mozilla::Module::kVersion,
+                                              nullptr,
+                                              nullptr,
+                                              kLayoutCategories,
+                                              nullptr,
+                                              nullptr,
+                                              nullptr};
 
 NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;
--- a/layout/build/nsLayoutModule.h
+++ b/layout/build/nsLayoutModule.h
@@ -4,14 +4,42 @@
  * 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 nsLayoutModule_h
 #define nsLayoutModule_h
 
 #include "nscore.h"
 
+class nsIPresentationService;
+
 // This function initializes various layout statics, as well as XPConnect.
 // It should be called only once, and before the first time any XPCOM module in
 // nsLayoutModule is used.
 void nsLayoutModuleInitialize();
 
+void nsLayoutModuleDtor();
+
+nsresult CreateXMLContentSerializer(nsISupports* aOuter, const nsID& aIID,
+                                    void** aResult);
+nsresult CreateHTMLContentSerializer(nsISupports* aOuter, const nsID& aIID,
+                                     void** aResult);
+nsresult CreateXHTMLContentSerializer(nsISupports* aOuter, const nsID& aIID,
+                                      void** aResult);
+nsresult CreatePlainTextSerializer(nsISupports* aOuter, const nsID& aIID,
+                                   void** aResult);
+nsresult CreateContentPolicy(nsISupports* aOuter, const nsID& aIID,
+                             void** aResult);
+nsresult CreateGlobalMessageManager(nsISupports* aOuter, const nsID& aIID,
+                                    void** aResult);
+nsresult CreateParentMessageManager(nsISupports* aOuter, const nsID& aIID,
+                                    void** aResult);
+nsresult CreateChildMessageManager(nsISupports* aOuter, const nsID& aIID,
+                                   void** aResult);
+
+nsresult Construct_nsIScriptSecurityManager(nsISupports* aOuter,
+                                            const nsIID& aIID, void** aResult);
+nsresult LocalStorageManagerConstructor(nsISupports* aOuter, const nsIID& aIID,
+                                        void** aResult);
+
+already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
+
 #endif  // nsLayoutModule_h