summaryrefslogtreecommitdiffstats
path: root/layout/build
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /layout/build
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/build')
-rw-r--r--layout/build/components.conf495
-rw-r--r--layout/build/moz.build77
-rw-r--r--layout/build/nsContentDLF.cpp327
-rw-r--r--layout/build/nsContentDLF.h92
-rw-r--r--layout/build/nsLayoutCID.h105
-rw-r--r--layout/build/nsLayoutModule.cpp248
-rw-r--r--layout/build/nsLayoutModule.h39
-rw-r--r--layout/build/nsLayoutStatics.cpp411
-rw-r--r--layout/build/nsLayoutStatics.h56
9 files changed, 1850 insertions, 0 deletions
diff --git a/layout/build/components.conf b/layout/build/components.conf
new file mode 100644
index 0000000000..c52a33d97f
--- /dev/null
+++ b/layout/build/components.conf
@@ -0,0 +1,495 @@
+# -*- 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.wap.xhtml+xml',
+ 'application/x-javascript',
+ 'application/x-view-source',
+ 'application/xhtml+xml',
+ 'application/xml',
+ 'image/svg+xml',
+ 'text/cache-manifest',
+ 'text/css',
+ 'text/ecmascript',
+ 'text/html',
+ 'text/javascript',
+ 'text/json',
+ 'text/plain',
+ 'text/rdf',
+ 'text/vtt',
+ 'text/xml',
+
+ 'image/apng',
+ 'image/bmp',
+ 'image/gif',
+ 'image/icon',
+ 'image/jpeg',
+ 'image/jpg',
+ 'image/pjpeg',
+ 'image/png',
+ 'image/vnd.microsoft.icon',
+ 'image/x-icon',
+ 'image/x-ms-bmp',
+ 'image/x-png',
+]
+
+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'],
+ },
+ {
+ 'js_name': 'cpmm',
+ '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': {
+ 'name': content_types,
+ 'backgroundtasks': BackgroundTasksSelector.ALL_TASKS,
+ }
+ },
+ },
+ {
+ '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'],
+ },
+ {
+ 'js_name': 'DOMRequest',
+ 'cid': '{3160e271-138d-4cc7-9d63-6429f16957c7}',
+ 'contract_ids': ['@mozilla.org/dom/dom-request-service;1'],
+ 'interfaces': ['nsIDOMRequestService'],
+ 'singleton': True,
+ 'type': 'mozilla::dom::DOMRequestService',
+ 'headers': ['mozilla/dom/DOMRequest.h'],
+ 'constructor': 'mozilla::dom::DOMRequestService::FactoryCreate',
+ },
+ {
+ 'js_name': 'domStorageManager',
+ 'cid': '{656db07c-aa80-49e4-bce8-e431baae697d}',
+ 'contract_ids': ['@mozilla.org/dom/localStorage-manager;1'],
+ 'interfaces': ['nsIDOMStorageManager', 'nsILocalStorageManager'],
+ 'legacy_constructor': 'LocalStorageManagerConstructor',
+ },
+ {
+ 'cid': '{64e4bf03-773e-408e-939a-e11652fdfd28}',
+ 'contract_ids': ['@mozilla.org/dom/sessionStorage-manager;1'],
+ 'legacy_constructor': 'SessionStorageManagerConstructor',
+ },
+ {
+ 'js_name': 'qms',
+ 'cid': '{5a75c25a-5e7e-4d90-8f7c-07eb15cc0aa8}',
+ 'contract_ids': ['@mozilla.org/dom/quota-manager-service;1'],
+ 'interfaces': ['nsIQuotaManagerService'],
+ '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',
+ },
+ {
+ 'js_name': 'els',
+ 'cid': '{baa34652-f1f1-4185-b224-244ee82a413a}',
+ 'contract_ids': ['@mozilla.org/eventlistenerservice;1'],
+ 'interfaces': ['nsIEventListenerService'],
+ 'type': 'nsIEventListenerService',
+ },
+ {
+ 'cid': '{e8ee88b0-5571-4086-a45b-39a716906bdb}',
+ 'contract_ids': [],
+ 'type': 'ExpandedPrincipal::Deserializer',
+ 'headers': ['/caps/ExpandedPrincipal.h'],
+ },
+ {
+ 'js_name': 'focus',
+ 'cid': '{cf7fd51f-aba2-44c1-9ff0-11f7508efcd4}',
+ 'contract_ids': ['@mozilla.org/focus-manager;1'],
+ 'interfaces': ['nsIFocusManager'],
+ '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/Geolocation.h'],
+ 'constructor': 'mozilla::dom::Geolocation::NonWindowSingleton',
+ },
+ {
+ 'js_name': 'mm',
+ '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': {
+ 'name': '@mozilla.org/mixedcontentblocker;1',
+ 'backgroundtasks': BackgroundTasksSelector.ALL_TASKS,
+ },
+ 'net-channel-event-sinks': {
+ 'name': '@mozilla.org/mixedcontentblocker;1',
+ 'backgroundtasks': BackgroundTasksSelector.ALL_TASKS,
+ },
+ },
+ },
+ {
+ 'cid': '{041a129f-10ce-4bda-a60d-e027a26d5ed0}',
+ 'contract_ids': ['@mozilla.org/referrer-info;1'],
+ 'type': 'mozilla::dom::ReferrerInfo',
+ 'headers': ['mozilla/dom/ReferrerInfo.h'],
+ },
+ {
+ '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'],
+ 'type': 'nsJSProtocolHandler',
+ 'headers': ['nsJSProtocolHandler.h'],
+ 'protocol_config': {
+ 'scheme': 'javascript',
+ 'flags': [
+ 'URI_NORELATIVE',
+ 'URI_NOAUTH',
+ 'URI_INHERITS_SECURITY_CONTEXT',
+ 'URI_LOADABLE_BY_ANYONE',
+ 'URI_NON_PERSISTABLE',
+ 'URI_OPENING_EXECUTES_SCRIPT',
+ ],
+ },
+ },
+ {
+ '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': '{bd066e5f-146f-4472-8331-7bfd05b1ed90}',
+ 'contract_ids': [],
+ 'type': 'mozilla::NullPrincipal::Deserializer',
+ 'headers': ['/caps/NullPrincipal.h'],
+ },
+ {
+ 'js_name': 'ppmm',
+ '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': '{653e0e4d-3ee4-45fa-b272-97c20bc01eb8}',
+ 'contract_ids': [],
+ 'type': 'mozilla::ContentPrincipal::Deserializer',
+ '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'],
+ },
+ {
+ 'js_name': 'scriptSecurityManager',
+ 'cid': '{7ee2a4c0-4b93-17d3-ba18-0060b0f199a2}',
+ 'contract_ids': ['@mozilla.org/scriptsecuritymanager;1'],
+ 'interfaces': ['nsIScriptSecurityManager'],
+ 'legacy_constructor': 'Construct_nsIScriptSecurityManager',
+ },
+ {
+ 'name': 'ServiceWorkerManager',
+ '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'],
+ },
+ {
+ 'name': 'ThirdPartyUtil',
+ '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',
+ },
+ {
+ 'cid': '{abfbb785-5a44-49cf-88db-2f300bf727c9}',
+ 'contract_ids': ['@mozilla.org/eventsourceevent/service;1'],
+ 'singleton': True,
+ 'type': 'mozilla::dom::EventSourceEventService',
+ 'headers': ['mozilla/dom/EventSourceEventService.h'],
+ 'constructor': 'mozilla::dom::EventSourceEventService::GetOrCreate',
+ },
+]
+
+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',
+ },
+ {
+ 'cid': '{0ff5ce56-5b09-4db8-adc6-8266af95f864}',
+ 'contract_ids': ['@mozilla.org/webspeech/service;1?name=online'],
+ 'type': 'mozilla::OnlineSpeechRecognitionService',
+ 'headers': ['mozilla/dom/OnlineSpeechRecognitionService.h'],
+ },
+ ]
+
+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 buildconfig.substs['MOZ_WIDGET_TOOLKIT'] == 'android':
+ Classes += [
+ {
+ 'cid': '{1f15dbc8-bfaa-45de-8a46-08e2e26326b0}',
+ 'contract_ids': ['@mozilla.org/widget/hapticfeedback;1'],
+ 'type': 'nsHapticFeedback',
+ 'headers': ['/dom/system/android/nsHapticFeedback.h'],
+ },
+ ]
diff --git a/layout/build/moz.build b/layout/build/moz.build
new file mode 100644
index 0000000000..b2059e396e
--- /dev/null
+++ b/layout/build/moz.build
@@ -0,0 +1,77 @@
+# -*- 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/.
+
+EXPORTS += [
+ "nsContentDLF.h",
+ "nsLayoutCID.h",
+ "nsLayoutStatics.h",
+]
+
+UNIFIED_SOURCES += [
+ "nsContentDLF.cpp",
+ "nsLayoutModule.cpp",
+ "nsLayoutStatics.cpp",
+]
+
+include("/ipc/chromium/chromium-config.mozbuild")
+
+LOCAL_INCLUDES += [
+ "!/security/rlbox",
+ "../base",
+ "../forms",
+ "../generic",
+ "../inspector",
+ "../mathml",
+ "../painting",
+ "../style",
+ "../tables",
+ "../xul",
+ "/caps",
+ "/docshell/base",
+ "/dom/audiochannel",
+ "/dom/base",
+ "/dom/bindings",
+ "/dom/canvas",
+ "/dom/filesystem",
+ "/dom/geolocation",
+ "/dom/html",
+ "/dom/jsurl",
+ "/dom/media",
+ "/dom/storage",
+ "/dom/xslt/base",
+ "/dom/xslt/xml",
+ "/dom/xslt/xpath",
+ "/dom/xslt/xslt",
+ "/dom/xul",
+ "/editor/composer",
+ "/js/xpconnect/loader",
+ "/js/xpconnect/src",
+ "/netwerk/base",
+ "/netwerk/cookie",
+ "/parser/htmlparser",
+ "/toolkit/components/sessionstore",
+ "/view",
+]
+
+if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
+ LOCAL_INCLUDES += [
+ "/dom/system/windows",
+ ]
+elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
+ LOCAL_INCLUDES += [
+ "/dom/system/mac",
+ ]
+elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android":
+ LOCAL_INCLUDES += [
+ "/dom/system",
+ "/dom/system/android",
+ ]
+
+XPCOM_MANIFESTS += [
+ "components.conf",
+]
+
+FINAL_LIBRARY = "xul"
diff --git a/layout/build/nsContentDLF.cpp b/layout/build/nsContentDLF.cpp
new file mode 100644
index 0000000000..866621d722
--- /dev/null
+++ b/layout/build/nsContentDLF.cpp
@@ -0,0 +1,327 @@
+/* -*- 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 "nsContentDLF.h"
+
+#include "mozilla/Encoding.h"
+
+#include "nsCOMPtr.h"
+#include "nsDocShell.h"
+#include "nsGenericHTMLElement.h"
+#include "nsGkAtoms.h"
+#include "nsIContentViewer.h"
+#include "nsIDocumentLoaderFactory.h"
+#include "mozilla/dom/Document.h"
+#include "nsNodeInfoManager.h"
+#include "nsString.h"
+#include "nsContentCID.h"
+#include "nsNetUtil.h"
+#include "nsCRT.h"
+#include "nsIViewSourceChannel.h"
+#include "nsContentUtils.h"
+#include "imgLoader.h"
+#include "nsCharsetSource.h"
+#include "nsMimeTypes.h"
+#include "DecoderTraits.h"
+
+// Factory code for creating variations on html documents
+
+#undef NOISY_REGISTRY
+
+using mozilla::dom::Document;
+
+already_AddRefed<nsIContentViewer> NS_NewContentViewer();
+
+static const char* const gHTMLTypes[] = {TEXT_HTML, VIEWSOURCE_CONTENT_TYPE,
+ APPLICATION_XHTML_XML,
+ APPLICATION_WAPXHTML_XML, 0};
+
+static const char* const gXMLTypes[] = {TEXT_XML,
+ APPLICATION_XML,
+ APPLICATION_MATHML_XML,
+ APPLICATION_RDF_XML,
+ TEXT_RDF,
+ 0};
+
+static const char* const gSVGTypes[] = {IMAGE_SVG_XML, 0};
+
+static bool IsTypeInList(const nsACString& aType, const char* const aList[]) {
+ int32_t typeIndex;
+ for (typeIndex = 0; aList[typeIndex]; ++typeIndex) {
+ if (aType.Equals(aList[typeIndex])) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+nsresult NS_NewContentDocumentLoaderFactory(
+ nsIDocumentLoaderFactory** aResult) {
+ MOZ_ASSERT(aResult, "null OUT ptr");
+ if (!aResult) {
+ return NS_ERROR_NULL_POINTER;
+ }
+ RefPtr<nsContentDLF> it = new nsContentDLF();
+ it.forget(aResult);
+ return NS_OK;
+}
+
+nsContentDLF::nsContentDLF() = default;
+
+nsContentDLF::~nsContentDLF() = default;
+
+NS_IMPL_ISUPPORTS(nsContentDLF, nsIDocumentLoaderFactory)
+
+NS_IMETHODIMP
+nsContentDLF::CreateInstance(const char* aCommand, nsIChannel* aChannel,
+ nsILoadGroup* aLoadGroup,
+ const nsACString& aContentType,
+ nsIDocShell* aContainer, nsISupports* aExtraInfo,
+ nsIStreamListener** aDocListener,
+ nsIContentViewer** aDocViewer) {
+ // Make a copy of aContentType, because we're possibly going to change it.
+ nsAutoCString contentType(aContentType);
+
+ // Are we viewing source?
+ nsCOMPtr<nsIViewSourceChannel> viewSourceChannel =
+ do_QueryInterface(aChannel);
+ if (viewSourceChannel) {
+ aCommand = "view-source";
+
+ // The parser freaks out when it sees the content-type that a
+ // view-source channel normally returns. Get the actual content
+ // type of the data. If it's known, use it; otherwise use
+ // text/plain.
+ nsAutoCString type;
+ mozilla::Unused << viewSourceChannel->GetOriginalContentType(type);
+ bool knownType = (!type.EqualsLiteral(VIEWSOURCE_CONTENT_TYPE) &&
+ IsTypeInList(type, gHTMLTypes)) ||
+ nsContentUtils::IsPlainTextType(type) ||
+ IsTypeInList(type, gXMLTypes) ||
+ IsTypeInList(type, gSVGTypes) ||
+ IsTypeInList(type, gXMLTypes);
+
+ if (knownType) {
+ viewSourceChannel->SetContentType(type);
+ } else if (IsImageContentType(type)) {
+ // If it's an image, we want to display it the same way we normally would.
+ contentType = type;
+ } else {
+ viewSourceChannel->SetContentType(nsLiteralCString(TEXT_PLAIN));
+ }
+ } else if (aContentType.EqualsLiteral(VIEWSOURCE_CONTENT_TYPE)) {
+ aChannel->SetContentType(nsLiteralCString(TEXT_PLAIN));
+ contentType = TEXT_PLAIN;
+ }
+
+ nsresult rv;
+ bool imageDocument = false;
+ // Try html or plaintext; both use the same document CID
+ if (IsTypeInList(contentType, gHTMLTypes) ||
+ nsContentUtils::IsPlainTextType(contentType)) {
+ rv = CreateDocument(
+ aCommand, aChannel, aLoadGroup, aContainer,
+ []() -> already_AddRefed<Document> {
+ RefPtr<Document> doc;
+ nsresult rv = NS_NewHTMLDocument(getter_AddRefs(doc));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ return doc.forget();
+ },
+ aDocListener, aDocViewer);
+ } // Try XML
+ else if (IsTypeInList(contentType, gXMLTypes)) {
+ rv = CreateDocument(
+ aCommand, aChannel, aLoadGroup, aContainer,
+ []() -> already_AddRefed<Document> {
+ RefPtr<Document> doc;
+ nsresult rv = NS_NewXMLDocument(getter_AddRefs(doc));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ return doc.forget();
+ },
+ aDocListener, aDocViewer);
+ } // Try SVG
+ else if (IsTypeInList(contentType, gSVGTypes)) {
+ rv = CreateDocument(
+ aCommand, aChannel, aLoadGroup, aContainer,
+ []() -> already_AddRefed<Document> {
+ RefPtr<Document> doc;
+ nsresult rv = NS_NewSVGDocument(getter_AddRefs(doc));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ return doc.forget();
+ },
+ aDocListener, aDocViewer);
+ } else if (mozilla::DecoderTraits::ShouldHandleMediaType(
+ contentType.get(),
+ /* DecoderDoctorDiagnostics* */ nullptr)) {
+ rv = CreateDocument(
+ aCommand, aChannel, aLoadGroup, aContainer,
+ []() -> already_AddRefed<Document> {
+ RefPtr<Document> doc;
+ nsresult rv = NS_NewVideoDocument(getter_AddRefs(doc));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ return doc.forget();
+ },
+ aDocListener, aDocViewer);
+ } // Try image types
+ else if (IsImageContentType(contentType)) {
+ imageDocument = true;
+ rv = CreateDocument(
+ aCommand, aChannel, aLoadGroup, aContainer,
+ []() -> already_AddRefed<Document> {
+ RefPtr<Document> doc;
+ nsresult rv = NS_NewImageDocument(getter_AddRefs(doc));
+ NS_ENSURE_SUCCESS(rv, nullptr);
+ return doc.forget();
+ },
+ aDocListener, aDocViewer);
+ } else {
+ // If we get here, then we weren't able to create anything. Sorry!
+ return NS_ERROR_FAILURE;
+ }
+
+ if (NS_SUCCEEDED(rv) && !imageDocument) {
+ Document* doc = (*aDocViewer)->GetDocument();
+ MOZ_ASSERT(doc);
+ doc->MakeBrowsingContextNonSynthetic();
+ }
+
+ return rv;
+}
+
+NS_IMETHODIMP
+nsContentDLF::CreateInstanceForDocument(nsISupports* aContainer,
+ Document* aDocument,
+ const char* aCommand,
+ nsIContentViewer** aContentViewer) {
+ MOZ_ASSERT(aDocument);
+
+ nsCOMPtr<nsIContentViewer> contentViewer = NS_NewContentViewer();
+
+ // Bind the document to the Content Viewer
+ contentViewer->LoadStart(aDocument);
+ contentViewer.forget(aContentViewer);
+ return NS_OK;
+}
+
+/* static */
+already_AddRefed<Document> nsContentDLF::CreateBlankDocument(
+ nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal,
+ nsIPrincipal* aPartitionedPrincipal, nsDocShell* aContainer) {
+ // create a new blank HTML document
+ RefPtr<Document> blankDoc;
+ mozilla::Unused << NS_NewHTMLDocument(getter_AddRefs(blankDoc));
+
+ if (!blankDoc) {
+ return nullptr;
+ }
+
+ // initialize
+ nsCOMPtr<nsIURI> uri;
+ NS_NewURI(getter_AddRefs(uri), "about:blank"_ns);
+ if (!uri) {
+ return nullptr;
+ }
+ blankDoc->ResetToURI(uri, aLoadGroup, aPrincipal, aPartitionedPrincipal);
+ blankDoc->SetContainer(aContainer);
+
+ // add some simple content structure
+ nsNodeInfoManager* nim = blankDoc->NodeInfoManager();
+
+ RefPtr<mozilla::dom::NodeInfo> htmlNodeInfo;
+
+ // generate an html html element
+ htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::html, 0, kNameSpaceID_XHTML,
+ nsINode::ELEMENT_NODE);
+ nsCOMPtr<nsIContent> htmlElement =
+ NS_NewHTMLHtmlElement(htmlNodeInfo.forget());
+
+ // generate an html head element
+ htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::head, 0, kNameSpaceID_XHTML,
+ nsINode::ELEMENT_NODE);
+ nsCOMPtr<nsIContent> headElement =
+ NS_NewHTMLHeadElement(htmlNodeInfo.forget());
+
+ // generate an html body elemment
+ htmlNodeInfo = nim->GetNodeInfo(nsGkAtoms::body, 0, kNameSpaceID_XHTML,
+ nsINode::ELEMENT_NODE);
+ nsCOMPtr<nsIContent> bodyElement =
+ NS_NewHTMLBodyElement(htmlNodeInfo.forget());
+
+ // blat in the structure
+ NS_ASSERTION(blankDoc->GetChildCount() == 0, "Shouldn't have children");
+ if (!htmlElement || !headElement || !bodyElement) {
+ return nullptr;
+ }
+
+ mozilla::IgnoredErrorResult rv;
+ blankDoc->AppendChildTo(htmlElement, false, rv);
+ if (rv.Failed()) {
+ return nullptr;
+ }
+
+ htmlElement->AppendChildTo(headElement, false, rv);
+ if (rv.Failed()) {
+ return nullptr;
+ }
+
+ // XXXbz Why not notifying here?
+ htmlElement->AppendChildTo(bodyElement, false, rv);
+ if (rv.Failed()) {
+ return nullptr;
+ }
+
+ // add a nice bow
+ blankDoc->SetDocumentCharacterSetSource(kCharsetFromDocTypeDefault);
+ blankDoc->SetDocumentCharacterSet(UTF_8_ENCODING);
+ return blankDoc.forget();
+}
+
+nsresult nsContentDLF::CreateDocument(
+ const char* aCommand, nsIChannel* aChannel, nsILoadGroup* aLoadGroup,
+ nsIDocShell* aContainer, nsContentDLF::DocumentCreator aDocumentCreator,
+ nsIStreamListener** aDocListener, nsIContentViewer** aContentViewer) {
+ MOZ_ASSERT(aDocumentCreator);
+
+ nsresult rv = NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsIURI> aURL;
+ rv = aChannel->GetURI(getter_AddRefs(aURL));
+ if (NS_FAILED(rv)) return rv;
+
+#ifdef NOISY_CREATE_DOC
+ if (nullptr != aURL) {
+ nsAutoString tmp;
+ aURL->ToString(tmp);
+ fputs(NS_LossyConvertUTF16toASCII(tmp).get(), stdout);
+ printf(": creating document\n");
+ }
+#endif
+
+ // Create the document
+ RefPtr<Document> doc = aDocumentCreator();
+ NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
+
+ // Create the content viewer XXX: could reuse content viewer here!
+ nsCOMPtr<nsIContentViewer> contentViewer = NS_NewContentViewer();
+
+ doc->SetContainer(static_cast<nsDocShell*>(aContainer));
+
+ // Initialize the document to begin loading the data. An
+ // nsIStreamListener connected to the parser is returned in
+ // aDocListener.
+ rv = doc->StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer,
+ aDocListener, true);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ // Bind the document to the Content Viewer
+ contentViewer->LoadStart(doc);
+ contentViewer.forget(aContentViewer);
+ return NS_OK;
+}
+
+bool nsContentDLF::IsImageContentType(const nsACString& aContentType) {
+ return imgLoader::SupportImageWithMimeType(aContentType);
+}
diff --git a/layout/build/nsContentDLF.h b/layout/build/nsContentDLF.h
new file mode 100644
index 0000000000..16449738af
--- /dev/null
+++ b/layout/build/nsContentDLF.h
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsContentDLF_h__
+#define nsContentDLF_h__
+
+#include "nsIDocumentLoaderFactory.h"
+#include "nsMimeTypes.h"
+
+class nsDocShell;
+class nsIChannel;
+class nsIContentViewer;
+class nsILoadGroup;
+class nsIStreamListener;
+
+#define CONTENT_DLF_CONTRACTID "@mozilla.org/content/document-loader-factory;1"
+#define PLUGIN_DLF_CONTRACTID \
+ "@mozilla.org/content/plugin/document-loader-factory;1"
+
+class nsContentDLF final : public nsIDocumentLoaderFactory {
+ protected:
+ virtual ~nsContentDLF();
+
+ public:
+ nsContentDLF();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIDOCUMENTLOADERFACTORY
+
+ nsresult InitUAStyleSheet();
+
+ typedef already_AddRefed<mozilla::dom::Document> (*DocumentCreator)();
+ nsresult CreateDocument(const char* aCommand, nsIChannel* aChannel,
+ nsILoadGroup* aLoadGroup, nsIDocShell* aContainer,
+ DocumentCreator aDocumentCreator,
+ nsIStreamListener** aDocListener,
+ nsIContentViewer** aContentViewer);
+
+ /**
+ * Create a blank document using the given loadgroup and given
+ * principal. aPrincipal is allowed to be null, in which case the
+ * new document will get the about:blank content principal.
+ */
+ static already_AddRefed<mozilla::dom::Document> CreateBlankDocument(
+ nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal,
+ nsIPrincipal* aPartitionedPrincipal, nsDocShell* aContainer);
+
+ private:
+ static nsresult EnsureUAStyleSheet();
+ static bool IsImageContentType(const nsACString&);
+};
+
+nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
+
+// clang-format off
+#ifdef MOZ_WEBM
+#define CONTENTDLF_WEBM_CATEGORIES \
+ { "Gecko-Content-Viewers", VIDEO_WEBM, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", AUDIO_WEBM, "@mozilla.org/content/document-loader-factory;1" },
+#else
+#define CONTENTDLF_WEBM_CATEGORIES
+#endif
+
+#define CONTENTDLF_CATEGORIES \
+ { "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_XJAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_XHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_RDF_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_RDF, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", VIEWSOURCE_CONTENT_TYPE, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", IMAGE_SVG_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_MATHML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", TEXT_VTT, "@mozilla.org/content/document-loader-factory;1" }, \
+ { "Gecko-Content-Viewers", APPLICATION_WAPXHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
+ CONTENTDLF_WEBM_CATEGORIES
+// clang-format on
+
+#endif
diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h
new file mode 100644
index 0000000000..9805225fd2
--- /dev/null
+++ b/layout/build/nsLayoutCID.h
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsLayoutCID_h__
+#define nsLayoutCID_h__
+
+// {1691E1F4-EE41-11d4-9885-00C04FA0CF4B}
+#define NS_FRAMETRAVERSAL_CID \
+ { \
+ 0x1691e1f4, 0xee41, 0x11d4, { \
+ 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b \
+ } \
+ }
+
+/* a6cf90f9-15b3-11d2-932e-00805f8add32 */
+#define NS_LAYOUT_DEBUGGER_CID \
+ { \
+ 0xa6cf90f9, 0x15b3, 0x11d2, { \
+ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 \
+ } \
+ }
+
+// {2fe88332-31c6-4829-b247-a07d8a73e80f}
+#define NS_CANVASRENDERINGCONTEXTWEBGL_CID \
+ { \
+ 0x2fe88332, 0x31c6, 0x4829, { \
+ 0xb2, 0x47, 0xa0, 0x7d, 0x8a, 0x7e, 0xe8, 0x0fe \
+ } \
+ }
+
+// {ae2793c0-2ba3-4adb-9c5e-c23525812c64}
+#define NS_SDBCONNECTION_CID \
+ { \
+ 0xae2793c0, 0x2ba3, 0x4adb, { \
+ 0x9c, 0x5e, 0xc2, 0x35, 0x25, 0x81, 0x2c, 0x64 \
+ } \
+ }
+
+// {656DB07C-AA80-49e4-BCE8-E431BAAE697D}
+#define NS_DOMLOCALSTORAGEMANAGER_CID \
+ { \
+ 0x656db07c, 0xaa80, 0x49e4, { \
+ 0xbc, 0xe8, 0xe4, 0x31, 0xba, 0xae, 0x69, 0x7d \
+ } \
+ }
+
+// {93ad72a6-02cd-4716-9626-d47d5ec275ec}
+#define NS_DOMJSON_CID \
+ { \
+ 0x93ad72a6, 0x02cd, 0x4716, { \
+ 0x96, 0x26, 0xd4, 0x7d, 0x5e, 0xc2, 0x75, 0xec \
+ } \
+ }
+
+// {CF7FD51F-ABA2-44C1-9FF0-11F7508EFCD4}
+#define NS_FOCUSMANAGER_CID \
+ { \
+ 0xcf7fd51f, 0xaba2, 0x44c1, { \
+ 0x9f, 0xf0, 0x11, 0xf7, 0x50, 0x8e, 0xfc, 0xd4 \
+ } \
+ }
+
+// {3160e271-138d-4cc7-9d63-6429f16957c7}
+#define DOMREQUEST_SERVICE_CID \
+ { \
+ 0x3160e271, 0x138d, 0x4cc7, { \
+ 0x9d, 0x63, 0x64, 0x29, 0xf1, 0x69, 0x57, 0xc7 \
+ } \
+ }
+
+// {5a75c25a-5e7e-4d90-8f7c-07eb15cc0aa8}
+#define QUOTAMANAGER_SERVICE_CID \
+ { \
+ 0x5a75c25a, 0x5e7e, 0x4d90, { \
+ 0x8f, 0x7c, 0x07, 0xeb, 0x15, 0xcc, 0x0a, 0xa8 \
+ } \
+ }
+
+// {c74bde32-bcc7-4840-8430-c733351b212a}
+#define SERVICEWORKERMANAGER_CID \
+ { \
+ 0xc74bde32, 0xbcc7, 0x4840, { \
+ 0x84, 0x30, 0xc7, 0x33, 0x35, 0x1b, 0x21, 0x2a \
+ } \
+ }
+
+// {69da374a-fda3-4a93-9fbc-d9304f66a7fe}
+#define STORAGEACTIVITYSERVICE_CID \
+ { \
+ 0x69da374a, 0xfda3, 0x4a93, { \
+ 0x9f, 0xbc, 0xd9, 0x30, 0x4f, 0x66, 0xa7, 0xfe \
+ } \
+ }
+
+#define NOTIFICATIONTELEMETRYSERVICE_CID \
+ { \
+ 0x5995b782, 0x6a0e, 0x4066, { \
+ 0xaa, 0xc5, 0x27, 0x6f, 0x0a, 0x9a, 0xd8, 0xcf \
+ } \
+ }
+
+#endif /* nsLayoutCID_h__ */
diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp
new file mode 100644
index 0000000000..22530ccf3e
--- /dev/null
+++ b/layout/build/nsLayoutModule.cpp
@@ -0,0 +1,248 @@
+/* -*- 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 "nsLayoutModule.h"
+
+#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 "nsIContentSerializer.h"
+#include "nsIContentViewer.h"
+#include "nsPlainTextSerializer.h"
+#include "nsXMLContentSerializer.h"
+#include "nsXHTMLContentSerializer.h"
+#include "nsIFrameTraversal.h"
+#include "nsLayoutCID.h"
+#include "nsFocusManager.h"
+#include "ThirdPartyUtil.h"
+#include "gfxPlatform.h"
+#include "mozilla/gfx/gfxVars.h"
+#include "mozilla/dom/quota/QuotaManagerService.h"
+
+#include "nsIEventListenerService.h"
+
+// view stuff
+#include "nsContentCreatorFunctions.h"
+
+#include "mozilla/dom/LocalStorageCommon.h"
+#include "mozilla/dom/LocalStorageManager.h"
+#include "mozilla/dom/LocalStorageManager2.h"
+#include "mozilla/dom/SessionStorageManager.h"
+
+#ifdef MOZ_WEBSPEECH
+# include "mozilla/dom/nsSynthVoiceRegistry.h"
+# include "mozilla/dom/OnlineSpeechRecognitionService.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 \
+ } \
+ }
+
+#include "nsScriptSecurityManager.h"
+#include "nsNetCID.h"
+#if defined(MOZ_WIDGET_ANDROID)
+# include "nsHapticFeedback.h"
+#endif
+#include "nsParserUtils.h"
+
+class nsIDocumentLoaderFactory;
+
+#define PRODUCT_NAME "Gecko"
+
+#include "inDeepTreeWalker.h"
+
+static void Shutdown();
+
+#include "mozilla/dom/nsContentSecurityManager.h"
+
+using namespace mozilla;
+using namespace mozilla::dom;
+using namespace mozilla::net;
+
+//-----------------------------------------------------------------------------
+
+static bool gInitialized = false;
+
+// Perform our one-time intialization for this module
+
+void nsLayoutModuleInitialize() {
+ if (gInitialized) {
+ MOZ_CRASH("Recursive layout module initialization");
+ }
+
+ static_assert(sizeof(uintptr_t) == sizeof(void*),
+ "Eeek! You'll need to adjust the size of uintptr_t to the "
+ "size of a pointer on your platform.");
+
+ gInitialized = true;
+
+ if (NS_FAILED(xpcModuleCtor())) {
+ MOZ_CRASH("xpcModuleCtor failed");
+ }
+
+ if (NS_FAILED(nsLayoutStatics::Initialize())) {
+ Shutdown();
+ MOZ_CRASH("nsLayoutStatics::Initialize failed");
+ }
+}
+
+// Shutdown this module, releasing all of the module resources
+
+// static
+void Shutdown() {
+ MOZ_ASSERT(gInitialized, "module not initialized");
+ if (!gInitialized) return;
+
+ gInitialized = false;
+
+ nsLayoutStatics::Release();
+}
+
+nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
+
+already_AddRefed<nsIContentViewer> NS_NewContentViewer();
+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_) \
+ nsresult ctor_(REFNSIID aIID, void** aResult) { \
+ *aResult = nullptr; \
+ iface_* inst; \
+ nsresult rv = func_(&inst); \
+ if (NS_SUCCEEDED(rv)) { \
+ rv = inst->QueryInterface(aIID, aResult); \
+ NS_RELEASE(inst); \
+ } \
+ return rv; \
+ }
+
+#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_(); }
+
+MAKE_GENERIC_CTOR(nsIFrameTraversal, NS_CreateFrameTraversal)
+
+MAKE_GENERIC_CTOR2(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_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)
+
+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(REFNSIID aIID, void** aResult) { \
+ nsresult rv; \
+ \
+ *aResult = nullptr; \
+ \
+ _InstanceClass* inst = new _InstanceClass(); \
+ if (nullptr == inst) { \
+ rv = NS_ERROR_OUT_OF_MEMORY; \
+ return rv; \
+ } \
+ rv = inst->QueryInterface(aIID, aResult); \
+ \
+ return rv; \
+ }
+
+#ifdef ACCESSIBILITY
+# include "xpcAccessibilityService.h"
+
+MAKE_GENERIC_CTOR(nsIAccessibilityService, NS_GetAccessibilityService)
+#endif
+
+nsresult Construct_nsIScriptSecurityManager(REFNSIID aIID, void** aResult) {
+ if (!aResult) return NS_ERROR_NULL_POINTER;
+ *aResult = nullptr;
+ 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;
+}
+
+nsresult LocalStorageManagerConstructor(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);
+}
+
+nsresult SessionStorageManagerConstructor(REFNSIID aIID, void** aResult) {
+ RefPtr<SessionStorageManager> manager = new SessionStorageManager(nullptr);
+ return manager->QueryInterface(aIID, aResult);
+}
+
+void nsLayoutModuleDtor() {
+ if (XRE_GetProcessType() == GeckoProcessType_GPU ||
+ XRE_GetProcessType() == GeckoProcessType_VR ||
+ XRE_GetProcessType() == GeckoProcessType_RDD) {
+ return;
+ }
+
+ 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();
+}
diff --git a/layout/build/nsLayoutModule.h b/layout/build/nsLayoutModule.h
new file mode 100644
index 0000000000..67003186d0
--- /dev/null
+++ b/layout/build/nsLayoutModule.h
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsLayoutModule_h
+#define nsLayoutModule_h
+
+#include "nscore.h"
+#include "nsID.h"
+#include "mozilla/AlreadyAddRefed.h"
+
+class nsIPresentationService;
+class nsISupports;
+
+// 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(const nsID& aIID, void** aResult);
+nsresult CreateHTMLContentSerializer(const nsID& aIID, void** aResult);
+nsresult CreateXHTMLContentSerializer(const nsID& aIID, void** aResult);
+nsresult CreatePlainTextSerializer(const nsID& aIID, void** aResult);
+nsresult CreateContentPolicy(const nsID& aIID, void** aResult);
+nsresult CreateGlobalMessageManager(const nsID& aIID, void** aResult);
+nsresult CreateParentMessageManager(const nsID& aIID, void** aResult);
+nsresult CreateChildMessageManager(const nsID& aIID, void** aResult);
+
+nsresult Construct_nsIScriptSecurityManager(const nsIID& aIID, void** aResult);
+nsresult LocalStorageManagerConstructor(const nsIID& aIID, void** aResult);
+nsresult SessionStorageManagerConstructor(const nsIID& aIID, void** aResult);
+
+already_AddRefed<nsIPresentationService> NS_CreatePresentationService();
+
+#endif // nsLayoutModule_h
diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp
new file mode 100644
index 0000000000..1b6f45818c
--- /dev/null
+++ b/layout/build/nsLayoutStatics.cpp
@@ -0,0 +1,411 @@
+/* -*- 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 "base/basictypes.h"
+
+#include "nsLayoutStatics.h"
+#include "nscore.h"
+
+#include "mozilla/intl/AppDateTimeFormat.h"
+#include "MediaManager.h"
+#include "mozilla/dom/ServiceWorkerRegistrar.h"
+#include "nsAttrValue.h"
+#include "nsColorNames.h"
+#include "nsComputedDOMStyle.h"
+#include "nsContentDLF.h"
+#include "nsContentUtils.h"
+#include "nsCSSAnonBoxes.h"
+#include "mozilla/css/ErrorReporter.h"
+#include "nsCSSProps.h"
+#include "nsCSSPseudoElements.h"
+#include "nsCSSRendering.h"
+#include "nsGenericHTMLFrameElement.h"
+#include "mozilla/dom/Attr.h"
+#include "mozilla/dom/PopupBlocker.h"
+#include "nsIFrame.h"
+#include "nsFrameState.h"
+#include "nsGlobalWindow.h"
+#include "nsGkAtoms.h"
+#include "nsImageFrame.h"
+#include "mozilla/GlobalStyleSheetCache.h"
+#include "nsRegion.h"
+#include "nsRepeatService.h"
+#include "nsFloatManager.h"
+#include "nsTextControlFrame.h"
+#include "txMozillaXSLTProcessor.h"
+#include "nsTreeSanitizer.h"
+#include "nsCellMap.h"
+#include "nsTextFrame.h"
+#include "nsCCUncollectableMarker.h"
+#include "nsTextFragment.h"
+#include "nsCORSListenerProxy.h"
+#include "nsHtml5Module.h"
+#include "nsHTMLTags.h"
+#include "nsFocusManager.h"
+#include "mozilla/dom/HTMLDNSPrefetch.h"
+#include "mozilla/dom/HTMLInputElement.h"
+#include "mozilla/dom/SVGElementFactory.h"
+#include "nsLanguageAtomService.h"
+#include "nsMathMLAtoms.h"
+#include "nsMathMLOperators.h"
+#include "Navigator.h"
+#include "StorageObserver.h"
+#include "CacheObserver.h"
+#include "DisplayItemClip.h"
+#include "HitTestInfo.h"
+#include "ActiveLayerTracker.h"
+#include "AnimationCommon.h"
+#include "LayerAnimationInfo.h"
+#include "mozilla/TimelineConsumers.h"
+
+#include "AudioChannelService.h"
+#include "mozilla/dom/PromiseDebugging.h"
+#include "mozilla/dom/nsMixedContentBlocker.h"
+
+#include "nsXULPopupManager.h"
+#include "nsXULContentUtils.h"
+#include "nsXULPrototypeCache.h"
+#include "nsXULTooltipListener.h"
+
+#include "mozilla/dom/UIDirectionManager.h"
+
+#include "CubebUtils.h"
+#include "WebAudioUtils.h"
+
+#include "nsError.h"
+
+#include "nsJSEnvironment.h"
+#include "nsContentSink.h"
+#include "nsFrameMessageManager.h"
+#include "nsDOMMutationObserver.h"
+#include "nsHyphenationManager.h"
+#include "nsWindowMemoryReporter.h"
+#include "mozilla/dom/ContentParent.h"
+#include "mozilla/ProcessPriorityManager.h"
+#include "mozilla/PermissionManager.h"
+#include "mozilla/dom/CustomElementRegistry.h"
+#include "mozilla/EventDispatcher.h"
+#include "mozilla/IMEStateManager.h"
+#ifndef MOZ_WIDGET_ANDROID
+# include "mozilla/Viaduct.h"
+#endif
+#include "mozilla/dom/HTMLVideoElement.h"
+#include "ThirdPartyUtil.h"
+#include "TouchManager.h"
+#include "DecoderDoctorLogger.h"
+#include "MediaDecoder.h"
+#include "mozilla/ClearSiteData.h"
+#include "mozilla/EditorController.h"
+#include "mozilla/HTMLEditorController.h"
+#include "mozilla/ServoBindings.h"
+#include "mozilla/StaticPresData.h"
+#include "mozilla/dom/AbstractRange.h"
+#include "mozilla/dom/Document.h"
+#include "mozilla/dom/WebIDLGlobalNameHash.h"
+#include "mozilla/dom/U2FTokenManager.h"
+#include "mozilla/dom/WebAuthnController.h"
+#ifdef OS_WIN
+# include "mozilla/dom/WinWebAuthnManager.h"
+#endif
+#include "mozilla/dom/PointerEventHandler.h"
+#include "mozilla/dom/RemoteWorkerService.h"
+#include "mozilla/dom/BlobURLProtocolHandler.h"
+#include "mozilla/dom/ReportingHeader.h"
+#include "mozilla/dom/BrowserParent.h"
+#include "mozilla/dom/MIDIPlatformService.h"
+#include "mozilla/dom/quota/ActorsParent.h"
+#include "mozilla/dom/localstorage/ActorsParent.h"
+#include "mozilla/net/UrlClassifierFeatureFactory.h"
+#include "mozilla/RemoteLazyInputStreamStorage.h"
+#include "nsLayoutUtils.h"
+#include "nsThreadManager.h"
+#include "mozilla/css/ImageLoader.h"
+#include "gfxUserFontSet.h"
+#include "RestoreTabContentObserver.h"
+#include "mozilla/intl/nsComplexBreaker.h"
+
+#include "nsRLBoxExpatDriver.h"
+#include "RLBoxWOFF2Types.h"
+
+using namespace mozilla;
+using namespace mozilla::net;
+using namespace mozilla::dom;
+using namespace mozilla::dom::ipc;
+using namespace mozilla::dom::quota;
+
+nsrefcnt nsLayoutStatics::sLayoutStaticRefcnt = 0;
+
+nsresult nsLayoutStatics::Initialize() {
+ NS_ASSERTION(sLayoutStaticRefcnt == 0, "nsLayoutStatics isn't zero!");
+
+ sLayoutStaticRefcnt = 1;
+ NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt, "nsLayoutStatics",
+ 1);
+
+ nsresult rv;
+
+ ContentParent::StartUp();
+
+ nsCSSProps::AddRefTable();
+ nsColorNames::AddRefTable();
+
+#ifdef DEBUG
+ nsCSSPseudoElements::AssertAtoms();
+ nsCSSAnonBoxes::AssertAtoms();
+ DebugVerifyFrameStateBits();
+#endif
+
+ StartupJSEnvironment();
+
+ nsGlobalWindowInner::Init();
+ nsGlobalWindowOuter::Init();
+
+ rv = nsContentUtils::Init();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize nsContentUtils");
+ return rv;
+ }
+
+ nsAttrValue::Init();
+
+ rv = nsTextFragment::Init();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize nsTextFragment");
+ return rv;
+ }
+
+ nsCellMap::Init();
+
+ StaticPresData::Init();
+ nsCSSRendering::Init();
+ css::ImageLoader::Init();
+
+ rv = HTMLDNSPrefetch::Initialize();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize HTML DNS prefetch");
+ return rv;
+ }
+
+ nsMathMLOperators::AddRefTable();
+
+#ifdef DEBUG
+ nsIFrame::DisplayReflowStartup();
+#endif
+ Attr::Initialize();
+
+ PopupBlocker::Initialize();
+
+ rv = txMozillaXSLTProcessor::Startup();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize txMozillaXSLTProcessor");
+ return rv;
+ }
+
+ rv = StorageObserver::Init();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize StorageObserver");
+ return rv;
+ }
+
+ rv = nsCCUncollectableMarker::Init();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize nsCCUncollectableMarker");
+ return rv;
+ }
+
+ rv = nsXULPopupManager::Init();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize nsXULPopupManager");
+ return rv;
+ }
+
+ rv = nsFocusManager::Init();
+ if (NS_FAILED(rv)) {
+ NS_ERROR("Could not initialize nsFocusManager");
+ return rv;
+ }
+
+ DecoderDoctorLogger::Init();
+ MediaManager::StartupInit();
+ CubebUtils::InitLibrary();
+
+ nsHtml5Module::InitializeStatics();
+ nsLayoutUtils::Initialize();
+ PointerEventHandler::InitializeStatics();
+ TouchManager::InitializeStatics();
+
+ nsWindowMemoryReporter::Init();
+
+ SVGElementFactory::Init();
+
+ ProcessPriorityManager::Init();
+
+ UIDirectionManager::Initialize();
+
+ CacheObserver::Init();
+
+ IMEStateManager::Init();
+
+ ServiceWorkerRegistrar::Initialize();
+
+ MediaDecoder::InitStatics();
+
+ PromiseDebugging::Init();
+
+ if (XRE_IsParentProcess() || XRE_IsContentProcess()) {
+ InitializeServo();
+ }
+
+ // This must be initialized on the main-thread.
+ mozilla::RemoteLazyInputStreamStorage::Initialize();
+
+ mozilla::dom::U2FTokenManager::Initialize();
+ mozilla::dom::WebAuthnController::Initialize();
+
+#ifdef OS_WIN
+ mozilla::dom::WinWebAuthnManager::Initialize();
+#endif
+
+ if (XRE_IsParentProcess()) {
+ // On content process we initialize these components when PContentChild is
+ // fully initialized.
+ mozilla::dom::RemoteWorkerService::Initialize();
+ }
+
+ ClearSiteData::Initialize();
+
+ // Reporting API.
+ ReportingHeader::Initialize();
+
+ if (XRE_IsParentProcess()) {
+ InitializeQuotaManager();
+ InitializeLocalStorage();
+ }
+
+ ThirdPartyUtil::Startup();
+
+ RestoreTabContentObserver::Initialize();
+
+ ComplexBreaker::Initialize();
+
+ RLBoxExpatSandboxPool::Initialize();
+
+ RLBoxWOFF2SandboxPool::Initalize();
+
+ if (XRE_IsParentProcess()) {
+ MIDIPlatformService::InitStatics();
+ }
+
+#ifndef MOZ_WIDGET_ANDROID
+ if (XRE_IsParentProcess()) {
+ InitializeViaduct();
+ }
+#endif
+
+ return NS_OK;
+}
+
+void nsLayoutStatics::Shutdown() {
+ // Don't need to shutdown nsWindowMemoryReporter, that will be done by the
+ // memory reporter manager.
+
+ if (XRE_IsParentProcess() || XRE_IsContentProcess()) {
+ ShutdownServo();
+ }
+
+ mozilla::dom::AbstractRange::Shutdown();
+ Document::Shutdown();
+ nsMessageManagerScriptExecutor::Shutdown();
+ nsFocusManager::Shutdown();
+ nsXULPopupManager::Shutdown();
+ UIDirectionManager::Shutdown();
+ StorageObserver::Shutdown();
+ txMozillaXSLTProcessor::Shutdown();
+ Attr::Shutdown();
+ PopupBlocker::Shutdown();
+ IMEStateManager::Shutdown();
+ EditorController::Shutdown();
+ HTMLEditorController::Shutdown();
+ HTMLDNSPrefetch::Shutdown();
+ nsCSSRendering::Shutdown();
+ StaticPresData::Shutdown();
+ nsLanguageAtomService::Shutdown();
+#ifdef DEBUG
+ nsIFrame::DisplayReflowShutdown();
+#endif
+ nsCellMap::Shutdown();
+ ActiveLayerTracker::Shutdown();
+
+ // Release all of our atoms
+ nsColorNames::ReleaseTable();
+ nsCSSProps::ReleaseTable();
+ nsRepeatService::Shutdown();
+
+ nsXULContentUtils::Finish();
+ nsXULPrototypeCache::ReleaseGlobals();
+
+ SVGElementFactory::Shutdown();
+ nsMathMLOperators::ReleaseTable();
+
+ nsFloatManager::Shutdown();
+ nsImageFrame::ReleaseGlobals();
+
+ mozilla::css::ErrorReporter::ReleaseGlobals();
+
+ nsTextFragment::Shutdown();
+
+ nsAttrValue::Shutdown();
+ nsContentUtils::Shutdown();
+ nsMixedContentBlocker::Shutdown();
+ GlobalStyleSheetCache::Shutdown();
+
+ ShutdownJSEnvironment();
+ nsGlobalWindowInner::ShutDown();
+ nsGlobalWindowOuter::ShutDown();
+
+ CubebUtils::ShutdownLibrary();
+ WebAudioUtils::Shutdown();
+
+ nsCORSListenerProxy::Shutdown();
+
+ PointerEventHandler::ReleaseStatics();
+
+ TouchManager::ReleaseStatics();
+
+ nsTreeSanitizer::ReleaseStatics();
+
+ nsHtml5Module::ReleaseStatics();
+
+ mozilla::EventDispatcher::Shutdown();
+
+ HTMLInputElement::DestroyUploadLastDir();
+
+ nsLayoutUtils::Shutdown();
+
+ nsHyphenationManager::Shutdown();
+ nsDOMMutationObserver::Shutdown();
+
+ mozilla::intl::AppDateTimeFormat::Shutdown();
+
+ ContentParent::ShutDown();
+
+ DisplayItemClip::Shutdown();
+ HitTestInfo::Shutdown();
+
+ CacheObserver::Shutdown();
+
+ PromiseDebugging::Shutdown();
+
+ BlobURLProtocolHandler::RemoveDataEntries();
+
+ css::ImageLoader::Shutdown();
+
+ mozilla::net::UrlClassifierFeatureFactory::Shutdown();
+
+ RestoreTabContentObserver::Shutdown();
+
+ ComplexBreaker::Shutdown();
+}
diff --git a/layout/build/nsLayoutStatics.h b/layout/build/nsLayoutStatics.h
new file mode 100644
index 0000000000..984f7c984e
--- /dev/null
+++ b/layout/build/nsLayoutStatics.h
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef nsLayoutStatics_h__
+#define nsLayoutStatics_h__
+
+#include "nscore.h"
+#include "MainThreadUtils.h"
+#include "nsISupportsImpl.h"
+#include "nsDebug.h"
+
+// This isn't really a class, it's a namespace for static methods.
+// Documents and other objects can hold a reference to the layout static
+// objects so that they last past the xpcom-shutdown notification.
+
+class nsLayoutStatics {
+ public:
+ // Called by the layout module constructor. This call performs an AddRef()
+ // internally.
+ static nsresult Initialize();
+
+ static void AddRef() {
+ NS_ASSERTION(NS_IsMainThread(),
+ "nsLayoutStatics reference counting must be on main thread");
+
+ NS_ASSERTION(sLayoutStaticRefcnt,
+ "nsLayoutStatics already dropped to zero!");
+
+ ++sLayoutStaticRefcnt;
+ NS_LOG_ADDREF(&sLayoutStaticRefcnt, sLayoutStaticRefcnt, "nsLayoutStatics",
+ 1);
+ }
+ static void Release() {
+ NS_ASSERTION(NS_IsMainThread(),
+ "nsLayoutStatics reference counting must be on main thread");
+
+ --sLayoutStaticRefcnt;
+ NS_LOG_RELEASE(&sLayoutStaticRefcnt, sLayoutStaticRefcnt,
+ "nsLayoutStatics");
+
+ if (!sLayoutStaticRefcnt) Shutdown();
+ }
+
+ private:
+ // not to be called!
+ nsLayoutStatics();
+
+ static void Shutdown();
+
+ static nsrefcnt sLayoutStaticRefcnt;
+};
+
+#endif // nsLayoutStatics_h__