nsLayoutModule.cpp 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "base/basictypes.h"
  6. #include "XPCModule.h"
  7. #include "mozilla/ModuleUtils.h"
  8. #include "nsImageModule.h"
  9. #include "nsLayoutStatics.h"
  10. #include "nsContentCID.h"
  11. #include "nsContentDLF.h"
  12. #include "nsContentPolicyUtils.h"
  13. #include "nsDataDocumentContentPolicy.h"
  14. #include "nsNoDataProtocolContentPolicy.h"
  15. #include "nsDOMCID.h"
  16. #include "nsHTMLContentSerializer.h"
  17. #include "nsHTMLParts.h"
  18. #include "nsIComponentManager.h"
  19. #include "nsIContentIterator.h"
  20. #include "nsIContentSerializer.h"
  21. #include "nsIContentViewer.h"
  22. #include "nsIController.h"
  23. #include "nsIControllers.h"
  24. #include "nsIDOMDOMImplementation.h"
  25. #include "nsIDocument.h"
  26. #include "nsIDocumentEncoder.h"
  27. #include "nsIFactory.h"
  28. #include "nsIFrameUtil.h"
  29. #include "nsIIdleService.h"
  30. #include "nsHTMLStyleSheet.h"
  31. #include "nsILayoutDebugger.h"
  32. #include "nsNameSpaceManager.h"
  33. #include "nsIObserver.h"
  34. #include "nsIObserverService.h"
  35. #include "nsIScriptNameSpaceManager.h"
  36. #include "nsIScriptError.h"
  37. #include "nsISelection.h"
  38. #include "nsCaret.h"
  39. #include "nsPlainTextSerializer.h"
  40. #include "nsXMLContentSerializer.h"
  41. #include "nsXHTMLContentSerializer.h"
  42. #include "nsRuleNode.h"
  43. #include "nsContentAreaDragDrop.h"
  44. #include "nsContentList.h"
  45. #include "nsBox.h"
  46. #include "nsIFrameTraversal.h"
  47. #include "nsLayoutCID.h"
  48. #include "nsStyleSheetService.h"
  49. #include "nsFocusManager.h"
  50. #include "ThirdPartyUtil.h"
  51. #include "nsStructuredCloneContainer.h"
  52. #include "gfxPlatform.h"
  53. #include "mozilla/gfx/gfxVars.h"
  54. #include "nsIEventListenerService.h"
  55. #include "nsIMessageManager.h"
  56. // Transformiix stuff
  57. #include "mozilla/dom/XPathEvaluator.h"
  58. #include "txMozillaXSLTProcessor.h"
  59. #include "txNodeSetAdaptor.h"
  60. #include "mozilla/dom/DOMParser.h"
  61. #include "mozilla/dom/XMLHttpRequestMainThread.h"
  62. #include "nsDOMSerializer.h"
  63. // view stuff
  64. #include "nsContentCreatorFunctions.h"
  65. #include "mozilla/dom/FormData.h"
  66. #include "nsHostObjectURI.h"
  67. #include "nsGlobalWindowCommands.h"
  68. #include "nsIControllerCommandTable.h"
  69. #include "nsJSProtocolHandler.h"
  70. #include "nsScriptNameSpaceManager.h"
  71. #include "nsIControllerContext.h"
  72. #include "DOMStorageManager.h"
  73. #include "nsJSON.h"
  74. #include "nsZipArchive.h"
  75. #include "mozIApplicationClearPrivateDataParams.h"
  76. #include "mozilla/Attributes.h"
  77. #include "mozilla/dom/DOMException.h"
  78. #include "mozilla/dom/DOMRequest.h"
  79. #include "mozilla/dom/network/UDPSocketChild.h"
  80. #include "mozilla/dom/quota/QuotaManagerService.h"
  81. #include "mozilla/dom/workers/ServiceWorkerManager.h"
  82. #include "mozilla/dom/workers/WorkerDebuggerManager.h"
  83. #include "mozilla/dom/Notification.h"
  84. #include "mozilla/OSFileConstants.h"
  85. #include "mozilla/Services.h"
  86. #ifdef MOZ_WEBSPEECH
  87. #include "mozilla/dom/nsSynthVoiceRegistry.h"
  88. #endif
  89. #include "mozilla/dom/PushNotifier.h"
  90. using mozilla::dom::PushNotifier;
  91. #define PUSHNOTIFIER_CID \
  92. { 0x2fc2d3e3, 0x020f, 0x404e, { 0xb0, 0x6a, 0x6e, 0xcf, 0x3e, 0xa2, 0x33, 0x4a } }
  93. #include "AudioChannelAgent.h"
  94. using mozilla::dom::AudioChannelAgent;
  95. // Editor stuff
  96. #include "nsEditorCID.h"
  97. #include "mozilla/EditorController.h" //CID
  98. #include "mozilla/HTMLEditor.h"
  99. #include "nsTextServicesDocument.h"
  100. #include "nsTextServicesCID.h"
  101. #include "nsScriptSecurityManager.h"
  102. #include "nsPrincipal.h"
  103. #include "nsSystemPrincipal.h"
  104. #include "nsNullPrincipal.h"
  105. #include "nsNetCID.h"
  106. #include "nsParserUtils.h"
  107. #include "nsHTMLCanvasFrame.h"
  108. #include "nsIDOMWebGLRenderingContext.h"
  109. class nsIDocumentLoaderFactory;
  110. #define PRODUCT_NAME "Gecko"
  111. /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
  112. #define NS_PLUGINDOCLOADERFACTORY_CID \
  113. { 0x0ddf4df8, 0x4dbb, 0x4133, { 0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 } }
  114. #define NS_WINDOWCOMMANDTABLE_CID \
  115. { /* 0DE2FBFA-6B7F-11D7-BBBA-0003938A9D96 */ \
  116. 0x0DE2FBFA, 0x6B7F, 0x11D7, {0xBB, 0xBA, 0x00, 0x03, 0x93, 0x8A, 0x9D, 0x96} }
  117. #include "nsIBoxObject.h"
  118. #ifdef MOZ_XUL
  119. #include "inDOMView.h"
  120. #endif /* MOZ_XUL */
  121. #include "inDeepTreeWalker.h"
  122. #include "inCSSValueSearch.h"
  123. #include "inDOMUtils.h"
  124. #ifdef MOZ_XUL
  125. #include "nsIXULDocument.h"
  126. #include "nsIXULSortService.h"
  127. nsresult
  128. NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
  129. nsresult
  130. NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
  131. #endif
  132. static void Shutdown();
  133. #include "nsGeolocation.h"
  134. #include "nsDeviceSensors.h"
  135. #include "mozilla/dom/nsContentSecurityManager.h"
  136. #include "mozilla/dom/nsCSPService.h"
  137. #include "mozilla/dom/nsCSPContext.h"
  138. #include "nsIPowerManagerService.h"
  139. #include "nsIMediaManager.h"
  140. #include "mozilla/dom/nsMixedContentBlocker.h"
  141. #include "AudioChannelService.h"
  142. #include "mozilla/net/WebSocketEventService.h"
  143. #include "mozilla/dom/power/PowerManagerService.h"
  144. #include "mozilla/dom/time/TimeService.h"
  145. #include "StreamingProtocolService.h"
  146. #include "MediaManager.h"
  147. #include "GMPService.h"
  148. #include "nsScriptError.h"
  149. #include "mozilla/TextInputProcessor.h"
  150. using namespace mozilla;
  151. using namespace mozilla::dom;
  152. using mozilla::dom::power::PowerManagerService;
  153. using mozilla::dom::quota::QuotaManagerService;
  154. using mozilla::dom::workers::ServiceWorkerManager;
  155. using mozilla::dom::workers::WorkerDebuggerManager;
  156. using mozilla::dom::UDPSocketChild;
  157. using mozilla::dom::time::TimeService;
  158. using mozilla::net::StreamingProtocolControllerService;
  159. using mozilla::gmp::GeckoMediaPluginService;
  160. #define NS_EDITORCOMMANDTABLE_CID \
  161. { 0x4f5e62b8, 0xd659, 0x4156, \
  162. { 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 } }
  163. #define NS_EDITINGCOMMANDTABLE_CID \
  164. { 0xcb38a746, 0xbeb8, 0x43f3, \
  165. { 0x94, 0x29, 0x77, 0x96, 0xe1, 0xa9, 0x3f, 0xb4 } }
  166. #define NS_HAPTICFEEDBACK_CID \
  167. { 0x1f15dbc8, 0xbfaa, 0x45de, \
  168. { 0x8a, 0x46, 0x08, 0xe2, 0xe2, 0x63, 0x26, 0xb0 } }
  169. NS_GENERIC_FACTORY_CONSTRUCTOR(TextEditor)
  170. NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserUtils)
  171. NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextServicesDocument)
  172. NS_GENERIC_FACTORY_CONSTRUCTOR(HTMLEditor)
  173. // Transformiix
  174. /* 5d5d92cd-6bf8-11d9-bf4a-000a95dc234c */
  175. #define TRANSFORMIIX_NODESET_CID \
  176. { 0x5d5d92cd, 0x6bf8, 0x11d9, { 0xbf, 0x4a, 0x0, 0x0a, 0x95, 0xdc, 0x23, 0x4c } }
  177. #define TRANSFORMIIX_NODESET_CONTRACTID \
  178. "@mozilla.org/transformiix-nodeset;1"
  179. // Factory Constructor
  180. NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor)
  181. NS_GENERIC_FACTORY_CONSTRUCTOR(XPathEvaluator)
  182. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
  183. NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
  184. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(XMLHttpRequestMainThread, Init)
  185. NS_GENERIC_FACTORY_CONSTRUCTOR(FormData)
  186. NS_GENERIC_FACTORY_CONSTRUCTOR(nsHostObjectURI)
  187. NS_GENERIC_FACTORY_CONSTRUCTOR(DOMParser)
  188. NS_GENERIC_FACTORY_CONSTRUCTOR(Exception)
  189. NS_GENERIC_FACTORY_CONSTRUCTOR(DOMSessionStorageManager)
  190. NS_GENERIC_FACTORY_CONSTRUCTOR(DOMLocalStorageManager)
  191. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService,
  192. DOMRequestService::FactoryCreate)
  193. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(QuotaManagerService,
  194. QuotaManagerService::FactoryCreate)
  195. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ServiceWorkerManager,
  196. ServiceWorkerManager::GetInstance)
  197. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WorkerDebuggerManager,
  198. WorkerDebuggerManager::GetInstance)
  199. #ifdef MOZ_WEBSPEECH
  200. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsSynthVoiceRegistry,
  201. nsSynthVoiceRegistry::GetInstanceForService)
  202. #endif
  203. NS_GENERIC_FACTORY_CONSTRUCTOR(AudioChannelAgent)
  204. NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceSensors)
  205. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
  206. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
  207. PowerManagerService::GetInstance)
  208. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITimeService,
  209. TimeService::GetInstance)
  210. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIStreamingProtocolControllerService,
  211. StreamingProtocolControllerService::GetInstance)
  212. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
  213. MediaManager::GetInstance)
  214. NS_GENERIC_FACTORY_CONSTRUCTOR(TextInputProcessor)
  215. NS_GENERIC_FACTORY_CONSTRUCTOR(PushNotifier)
  216. //-----------------------------------------------------------------------------
  217. static bool gInitialized = false;
  218. // Perform our one-time intialization for this module
  219. // static
  220. nsresult
  221. Initialize()
  222. {
  223. if (gInitialized) {
  224. NS_RUNTIMEABORT("Recursive layout module initialization");
  225. return NS_ERROR_FAILURE;
  226. }
  227. if (XRE_GetProcessType() == GeckoProcessType_GPU) {
  228. // We mark the layout module as being available in the GPU process so that
  229. // XPCOM's component manager initializes the power manager service, which
  230. // is needed for nsAppShell. However, we don't actually need anything in
  231. // the layout module itself.
  232. return NS_OK;
  233. }
  234. static_assert(sizeof(uintptr_t) == sizeof(void*),
  235. "Eeek! You'll need to adjust the size of uintptr_t to the "
  236. "size of a pointer on your platform.");
  237. gInitialized = true;
  238. nsresult rv;
  239. rv = xpcModuleCtor();
  240. if (NS_FAILED(rv))
  241. return rv;
  242. rv = nsLayoutStatics::Initialize();
  243. if (NS_FAILED(rv)) {
  244. Shutdown();
  245. return rv;
  246. }
  247. #ifdef DEBUG
  248. nsStyleContext::AssertStyleStructMaxDifferenceValid();
  249. #endif
  250. return NS_OK;
  251. }
  252. // Shutdown this module, releasing all of the module resources
  253. // static
  254. void
  255. Shutdown()
  256. {
  257. NS_PRECONDITION(gInitialized, "module not initialized");
  258. if (!gInitialized)
  259. return;
  260. gInitialized = false;
  261. nsLayoutStatics::Release();
  262. }
  263. #ifdef DEBUG
  264. nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
  265. nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
  266. #endif
  267. nsresult NS_NewBoxObject(nsIBoxObject** aResult);
  268. #ifdef MOZ_XUL
  269. nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
  270. nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
  271. nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
  272. nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
  273. nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
  274. nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
  275. #endif
  276. nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
  277. nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
  278. nsresult NS_NewDomSelection(nsISelection** aResult);
  279. already_AddRefed<nsIContentViewer> NS_NewContentViewer();
  280. nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
  281. nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
  282. nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
  283. nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
  284. nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
  285. nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
  286. nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
  287. nsresult NS_NewGlobalMessageManager(nsIMessageBroadcaster** aResult);
  288. nsresult NS_NewParentProcessMessageManager(nsIMessageBroadcaster** aResult);
  289. nsresult NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult);
  290. nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
  291. #define MAKE_CTOR(ctor_, iface_, func_) \
  292. static nsresult \
  293. ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
  294. { \
  295. *aResult = nullptr; \
  296. if (aOuter) \
  297. return NS_ERROR_NO_AGGREGATION; \
  298. iface_* inst; \
  299. nsresult rv = func_(&inst); \
  300. if (NS_SUCCEEDED(rv)) { \
  301. rv = inst->QueryInterface(aIID, aResult); \
  302. NS_RELEASE(inst); \
  303. } \
  304. return rv; \
  305. }
  306. // As above, but expects
  307. // already_AddRefed<nsIFoo> NS_NewFoo();
  308. // instead of
  309. // nsresult NS_NewFoo(nsIFoo**);
  310. #define MAKE_CTOR2(ctor_, iface_, func_) \
  311. static nsresult \
  312. ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
  313. { \
  314. *aResult = nullptr; \
  315. if (aOuter) { \
  316. return NS_ERROR_NO_AGGREGATION; \
  317. } \
  318. nsCOMPtr<iface_> inst = func_(); \
  319. inst.forget(aResult); \
  320. return NS_OK; \
  321. }
  322. #ifdef DEBUG
  323. MAKE_CTOR(CreateNewFrameUtil, nsIFrameUtil, NS_NewFrameUtil)
  324. MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
  325. #endif
  326. MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
  327. MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
  328. #ifdef MOZ_XUL
  329. MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject)
  330. MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
  331. MAKE_CTOR(CreateNewPopupBoxObject, nsIBoxObject, NS_NewPopupBoxObject)
  332. MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject)
  333. MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
  334. MAKE_CTOR(CreateNewContainerBoxObject, nsIBoxObject, NS_NewContainerBoxObject)
  335. #endif // MOZ_XUL
  336. #ifdef MOZ_XUL
  337. NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMView)
  338. #endif
  339. NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
  340. NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
  341. NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
  342. MAKE_CTOR2(CreateContentViewer, nsIContentViewer, NS_NewContentViewer)
  343. MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
  344. MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
  345. MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
  346. MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
  347. MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
  348. MAKE_CTOR2(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
  349. MAKE_CTOR2(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
  350. MAKE_CTOR2(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
  351. MAKE_CTOR(CreateTextEncoder, nsIDocumentEncoder, NS_NewTextEncoder)
  352. MAKE_CTOR(CreateHTMLCopyTextEncoder, nsIDocumentEncoder, NS_NewHTMLCopyTextEncoder)
  353. MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer, NS_NewXMLContentSerializer)
  354. MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer, NS_NewHTMLContentSerializer)
  355. MAKE_CTOR(CreateXHTMLContentSerializer, nsIContentSerializer, NS_NewXHTMLContentSerializer)
  356. MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer)
  357. MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
  358. #ifdef MOZ_XUL
  359. MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
  360. // NS_NewXULContentBuilder
  361. // NS_NewXULTreeBuilder
  362. MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
  363. // NS_NewXULControllers
  364. #endif
  365. MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
  366. MAKE_CTOR(CreateEventListenerService, nsIEventListenerService, NS_NewEventListenerService)
  367. MAKE_CTOR(CreateGlobalMessageManager, nsIMessageBroadcaster, NS_NewGlobalMessageManager)
  368. MAKE_CTOR(CreateParentMessageManager, nsIMessageBroadcaster, NS_NewParentProcessMessageManager)
  369. MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender, NS_NewChildProcessMessageManager)
  370. NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
  371. NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
  372. MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)
  373. MAKE_CTOR(CreateVideoDocument, nsIDocument, NS_NewVideoDocument)
  374. MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManager)
  375. MAKE_CTOR(CreateCanvasRenderingContextWebGL, nsIDOMWebGLRenderingContext, NS_NewCanvasRenderingContextWebGL)
  376. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init)
  377. NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURI)
  378. // views are not refcounted, so this is the same as
  379. // NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
  380. #define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \
  381. static nsresult \
  382. _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
  383. void **aResult) \
  384. { \
  385. nsresult rv; \
  386. \
  387. *aResult = nullptr; \
  388. if (nullptr != aOuter) { \
  389. rv = NS_ERROR_NO_AGGREGATION; \
  390. return rv; \
  391. } \
  392. \
  393. _InstanceClass * inst = new _InstanceClass(); \
  394. if (nullptr == inst) { \
  395. rv = NS_ERROR_OUT_OF_MEMORY; \
  396. return rv; \
  397. } \
  398. rv = inst->QueryInterface(aIID, aResult); \
  399. \
  400. return rv; \
  401. } \
  402. #define NS_GEOLOCATION_CID \
  403. { 0x1E1C3FF, 0x94A, 0xD048, { 0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 } }
  404. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(Geolocation, Init)
  405. #define NS_GEOLOCATION_SERVICE_CID \
  406. { 0x404d02a, 0x1CA, 0xAAAB, { 0x47, 0x62, 0x94, 0x4b, 0x1b, 0xf2, 0xf7, 0xb5 } }
  407. #define NS_AUDIOCHANNEL_SERVICE_CID \
  408. { 0xf712e983, 0x048a, 0x443f, { 0x88, 0x02, 0xfc, 0xc3, 0xd9, 0x27, 0xce, 0xac }}
  409. #define NS_WEBSOCKETEVENT_SERVICE_CID \
  410. { 0x31689828, 0xda66, 0x49a6, { 0x87, 0x0c, 0xdf, 0x62, 0xb8, 0x3f, 0xe7, 0x89 }}
  411. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocationService, nsGeolocationService::GetGeolocationService)
  412. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(AudioChannelService, AudioChannelService::GetOrCreate)
  413. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(WebSocketEventService, WebSocketEventService::GetOrCreate)
  414. NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentSecurityManager)
  415. NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSPContext)
  416. NS_GENERIC_FACTORY_CONSTRUCTOR(CSPService)
  417. NS_GENERIC_FACTORY_CONSTRUCTOR(nsMixedContentBlocker)
  418. NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrincipal)
  419. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsSystemPrincipal,
  420. nsScriptSecurityManager::SystemPrincipalSingletonConstructor)
  421. NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNullPrincipal, Init)
  422. NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer)
  423. NS_GENERIC_FACTORY_CONSTRUCTOR(OSFileConstantsService)
  424. NS_GENERIC_FACTORY_CONSTRUCTOR(UDPSocketChild)
  425. NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(GeckoMediaPluginService, GeckoMediaPluginService::GetGeckoMediaPluginService)
  426. NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptError)
  427. #ifdef ACCESSIBILITY
  428. #include "xpcAccessibilityService.h"
  429. MAKE_CTOR(CreateA11yService, nsIAccessibilityService, NS_GetAccessibilityService)
  430. #endif
  431. static nsresult
  432. Construct_nsIScriptSecurityManager(nsISupports *aOuter, REFNSIID aIID,
  433. void **aResult)
  434. {
  435. if (!aResult)
  436. return NS_ERROR_NULL_POINTER;
  437. *aResult = nullptr;
  438. if (aOuter)
  439. return NS_ERROR_NO_AGGREGATION;
  440. nsScriptSecurityManager *obj = nsScriptSecurityManager::GetScriptSecurityManager();
  441. if (!obj)
  442. return NS_ERROR_OUT_OF_MEMORY;
  443. if (NS_FAILED(obj->QueryInterface(aIID, aResult)))
  444. return NS_ERROR_FAILURE;
  445. return NS_OK;
  446. }
  447. #ifdef DEBUG
  448. NS_DEFINE_NAMED_CID(NS_FRAME_UTIL_CID);
  449. NS_DEFINE_NAMED_CID(NS_LAYOUT_DEBUGGER_CID);
  450. #endif
  451. NS_DEFINE_NAMED_CID(NS_FRAMETRAVERSAL_CID);
  452. NS_DEFINE_NAMED_CID(NS_BOXOBJECT_CID);
  453. #ifdef MOZ_XUL
  454. NS_DEFINE_NAMED_CID(NS_LISTBOXOBJECT_CID);
  455. NS_DEFINE_NAMED_CID(NS_MENUBOXOBJECT_CID);
  456. NS_DEFINE_NAMED_CID(NS_POPUPBOXOBJECT_CID);
  457. NS_DEFINE_NAMED_CID(NS_CONTAINERBOXOBJECT_CID);
  458. NS_DEFINE_NAMED_CID(NS_SCROLLBOXOBJECT_CID);
  459. NS_DEFINE_NAMED_CID(NS_TREEBOXOBJECT_CID);
  460. #endif // MOZ_XUL
  461. #ifdef MOZ_XUL
  462. NS_DEFINE_NAMED_CID(IN_DOMVIEW_CID);
  463. #endif
  464. NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID);
  465. NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CID);
  466. NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
  467. NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
  468. NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
  469. NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
  470. NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
  471. NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
  472. NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
  473. NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
  474. NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
  475. NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
  476. NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXTWEBGL_CID);
  477. NS_DEFINE_NAMED_CID(NS_TEXT_ENCODER_CID);
  478. NS_DEFINE_NAMED_CID(NS_HTMLCOPY_TEXT_ENCODER_CID);
  479. NS_DEFINE_NAMED_CID(NS_XMLCONTENTSERIALIZER_CID);
  480. NS_DEFINE_NAMED_CID(NS_XHTMLCONTENTSERIALIZER_CID);
  481. NS_DEFINE_NAMED_CID(NS_HTMLCONTENTSERIALIZER_CID);
  482. NS_DEFINE_NAMED_CID(NS_PLAINTEXTSERIALIZER_CID);
  483. NS_DEFINE_NAMED_CID(NS_PARSERUTILS_CID);
  484. NS_DEFINE_NAMED_CID(NS_SCRIPTABLEUNESCAPEHTML_CID);
  485. NS_DEFINE_NAMED_CID(NS_CONTENTPOLICY_CID);
  486. NS_DEFINE_NAMED_CID(NS_DATADOCUMENTCONTENTPOLICY_CID);
  487. NS_DEFINE_NAMED_CID(NS_NODATAPROTOCOLCONTENTPOLICY_CID);
  488. NS_DEFINE_NAMED_CID(NS_XULCONTROLLERS_CID);
  489. #ifdef MOZ_XUL
  490. NS_DEFINE_NAMED_CID(NS_XULSORTSERVICE_CID);
  491. NS_DEFINE_NAMED_CID(NS_XULTEMPLATEBUILDER_CID);
  492. NS_DEFINE_NAMED_CID(NS_XULTREEBUILDER_CID);
  493. NS_DEFINE_NAMED_CID(NS_XULDOCUMENT_CID);
  494. #endif
  495. NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
  496. NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
  497. NS_DEFINE_NAMED_CID(NS_JSURI_CID);
  498. NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID);
  499. NS_DEFINE_NAMED_CID(NS_WINDOWCONTROLLER_CID);
  500. NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
  501. NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
  502. NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
  503. NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
  504. NS_DEFINE_NAMED_CID(TRANSFORMIIX_XSLT_PROCESSOR_CID);
  505. NS_DEFINE_NAMED_CID(TRANSFORMIIX_XPATH_EVALUATOR_CID);
  506. NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
  507. NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
  508. NS_DEFINE_NAMED_CID(NS_FORMDATA_CID);
  509. NS_DEFINE_NAMED_CID(NS_HOSTOBJECTURI_CID);
  510. NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CID);
  511. NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
  512. NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID);
  513. NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
  514. NS_DEFINE_NAMED_CID(NS_DOMJSON_CID);
  515. NS_DEFINE_NAMED_CID(NS_TEXTEDITOR_CID);
  516. NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID);
  517. NS_DEFINE_NAMED_CID(QUOTAMANAGER_SERVICE_CID);
  518. NS_DEFINE_NAMED_CID(SERVICEWORKERMANAGER_CID);
  519. NS_DEFINE_NAMED_CID(PUSHNOTIFIER_CID);
  520. NS_DEFINE_NAMED_CID(WORKERDEBUGGERMANAGER_CID);
  521. NS_DEFINE_NAMED_CID(NS_AUDIOCHANNELAGENT_CID);
  522. NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_CID);
  523. NS_DEFINE_NAMED_CID(NS_EDITORCONTROLLER_CID);
  524. NS_DEFINE_NAMED_CID(NS_EDITINGCONTROLLER_CID);
  525. NS_DEFINE_NAMED_CID(NS_EDITORCOMMANDTABLE_CID);
  526. NS_DEFINE_NAMED_CID(NS_EDITINGCOMMANDTABLE_CID);
  527. NS_DEFINE_NAMED_CID(NS_TEXTSERVICESDOCUMENT_CID);
  528. NS_DEFINE_NAMED_CID(NS_GEOLOCATION_SERVICE_CID);
  529. NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
  530. NS_DEFINE_NAMED_CID(NS_AUDIOCHANNEL_SERVICE_CID);
  531. NS_DEFINE_NAMED_CID(NS_WEBSOCKETEVENT_SERVICE_CID);
  532. NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
  533. NS_DEFINE_NAMED_CID(NS_CONTENTSECURITYMANAGER_CID);
  534. NS_DEFINE_NAMED_CID(CSPSERVICE_CID);
  535. NS_DEFINE_NAMED_CID(NS_CSPCONTEXT_CID);
  536. NS_DEFINE_NAMED_CID(NS_MIXEDCONTENTBLOCKER_CID);
  537. NS_DEFINE_NAMED_CID(NS_EVENTLISTENERSERVICE_CID);
  538. NS_DEFINE_NAMED_CID(NS_GLOBALMESSAGEMANAGER_CID);
  539. NS_DEFINE_NAMED_CID(NS_PARENTPROCESSMESSAGEMANAGER_CID);
  540. NS_DEFINE_NAMED_CID(NS_CHILDPROCESSMESSAGEMANAGER_CID);
  541. NS_DEFINE_NAMED_CID(NS_SCRIPTSECURITYMANAGER_CID);
  542. NS_DEFINE_NAMED_CID(NS_PRINCIPAL_CID);
  543. NS_DEFINE_NAMED_CID(NS_SYSTEMPRINCIPAL_CID);
  544. NS_DEFINE_NAMED_CID(NS_NULLPRINCIPAL_CID);
  545. NS_DEFINE_NAMED_CID(THIRDPARTYUTIL_CID);
  546. NS_DEFINE_NAMED_CID(NS_STRUCTUREDCLONECONTAINER_CID);
  547. NS_DEFINE_NAMED_CID(NS_DEVICE_SENSORS_CID);
  548. NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
  549. NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID);
  550. NS_DEFINE_NAMED_CID(UDPSOCKETCHILD_CID);
  551. NS_DEFINE_NAMED_CID(NS_TIMESERVICE_CID);
  552. NS_DEFINE_NAMED_CID(NS_MEDIASTREAMCONTROLLERSERVICE_CID);
  553. NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID);
  554. #ifdef MOZ_WEBSPEECH
  555. NS_DEFINE_NAMED_CID(NS_SYNTHVOICEREGISTRY_CID);
  556. #endif
  557. #ifdef ACCESSIBILITY
  558. NS_DEFINE_NAMED_CID(NS_ACCESSIBILITY_SERVICE_CID);
  559. #endif
  560. NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
  561. NS_DEFINE_NAMED_CID(TEXT_INPUT_PROCESSOR_CID);
  562. NS_DEFINE_NAMED_CID(NS_SCRIPTERROR_CID);
  563. static nsresult
  564. CreateWindowCommandTableConstructor(nsISupports *aOuter,
  565. REFNSIID aIID, void **aResult)
  566. {
  567. nsresult rv;
  568. nsCOMPtr<nsIControllerCommandTable> commandTable =
  569. do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
  570. if (NS_FAILED(rv)) return rv;
  571. rv = nsWindowCommandRegistration::RegisterWindowCommands(commandTable);
  572. if (NS_FAILED(rv)) return rv;
  573. return commandTable->QueryInterface(aIID, aResult);
  574. }
  575. static nsresult
  576. CreateWindowControllerWithSingletonCommandTable(nsISupports *aOuter,
  577. REFNSIID aIID, void **aResult)
  578. {
  579. nsresult rv;
  580. nsCOMPtr<nsIController> controller =
  581. do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
  582. if (NS_FAILED(rv)) return rv;
  583. nsCOMPtr<nsIControllerCommandTable> windowCommandTable = do_GetService(kNS_WINDOWCOMMANDTABLE_CID, &rv);
  584. if (NS_FAILED(rv)) return rv;
  585. // this is a singleton; make it immutable
  586. windowCommandTable->MakeImmutable();
  587. nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
  588. if (NS_FAILED(rv)) return rv;
  589. controllerContext->Init(windowCommandTable);
  590. if (NS_FAILED(rv)) return rv;
  591. return controller->QueryInterface(aIID, aResult);
  592. }
  593. // Constructor of a controller which is set up to use, internally, a
  594. // singleton command-table pre-filled with editor commands.
  595. static nsresult
  596. EditorControllerConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult)
  597. {
  598. nsresult rv;
  599. nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
  600. if (NS_FAILED(rv)) return rv;
  601. nsCOMPtr<nsIControllerCommandTable> editorCommandTable = do_GetService(kNS_EDITORCOMMANDTABLE_CID, &rv);
  602. if (NS_FAILED(rv)) return rv;
  603. // this guy is a singleton, so make it immutable
  604. editorCommandTable->MakeImmutable();
  605. nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
  606. if (NS_FAILED(rv)) return rv;
  607. rv = controllerContext->Init(editorCommandTable);
  608. if (NS_FAILED(rv)) return rv;
  609. return controller->QueryInterface(aIID, aResult);
  610. }
  611. // Constructor of a controller which is set up to use, internally, a
  612. // singleton command-table pre-filled with editing commands.
  613. static nsresult
  614. nsEditingControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
  615. void **aResult)
  616. {
  617. nsresult rv;
  618. nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
  619. if (NS_FAILED(rv)) return rv;
  620. nsCOMPtr<nsIControllerCommandTable> editingCommandTable = do_GetService(kNS_EDITINGCOMMANDTABLE_CID, &rv);
  621. if (NS_FAILED(rv)) return rv;
  622. // this guy is a singleton, so make it immutable
  623. editingCommandTable->MakeImmutable();
  624. nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
  625. if (NS_FAILED(rv)) return rv;
  626. rv = controllerContext->Init(editingCommandTable);
  627. if (NS_FAILED(rv)) return rv;
  628. return controller->QueryInterface(aIID, aResult);
  629. }
  630. // Constructor for a command-table pre-filled with editor commands
  631. static nsresult
  632. nsEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
  633. void **aResult)
  634. {
  635. nsresult rv;
  636. nsCOMPtr<nsIControllerCommandTable> commandTable =
  637. do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
  638. if (NS_FAILED(rv)) return rv;
  639. rv = EditorController::RegisterEditorCommands(commandTable);
  640. if (NS_FAILED(rv)) return rv;
  641. // we don't know here whether we're being created as an instance,
  642. // or a service, so we can't become immutable
  643. return commandTable->QueryInterface(aIID, aResult);
  644. }
  645. // Constructor for a command-table pre-filled with editing commands
  646. static nsresult
  647. nsEditingCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
  648. void **aResult)
  649. {
  650. nsresult rv;
  651. nsCOMPtr<nsIControllerCommandTable> commandTable =
  652. do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
  653. if (NS_FAILED(rv)) return rv;
  654. rv = EditorController::RegisterEditingCommands(commandTable);
  655. if (NS_FAILED(rv)) return rv;
  656. // we don't know here whether we're being created as an instance,
  657. // or a service, so we can't become immutable
  658. return commandTable->QueryInterface(aIID, aResult);
  659. }
  660. static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
  661. XPCONNECT_CIDENTRIES
  662. #ifdef DEBUG
  663. { &kNS_FRAME_UTIL_CID, false, nullptr, CreateNewFrameUtil },
  664. { &kNS_LAYOUT_DEBUGGER_CID, false, nullptr, CreateNewLayoutDebugger },
  665. #endif
  666. { &kNS_FRAMETRAVERSAL_CID, false, nullptr, CreateNewFrameTraversal },
  667. { &kNS_BOXOBJECT_CID, false, nullptr, CreateNewBoxObject },
  668. #ifdef MOZ_XUL
  669. { &kNS_LISTBOXOBJECT_CID, false, nullptr, CreateNewListBoxObject },
  670. { &kNS_MENUBOXOBJECT_CID, false, nullptr, CreateNewMenuBoxObject },
  671. { &kNS_POPUPBOXOBJECT_CID, false, nullptr, CreateNewPopupBoxObject },
  672. { &kNS_CONTAINERBOXOBJECT_CID, false, nullptr, CreateNewContainerBoxObject },
  673. { &kNS_SCROLLBOXOBJECT_CID, false, nullptr, CreateNewScrollBoxObject },
  674. { &kNS_TREEBOXOBJECT_CID, false, nullptr, CreateNewTreeBoxObject },
  675. #endif // MOZ_XUL
  676. #ifdef MOZ_XUL
  677. { &kIN_DOMVIEW_CID, false, nullptr, inDOMViewConstructor },
  678. #endif
  679. { &kIN_DEEPTREEWALKER_CID, false, nullptr, inDeepTreeWalkerConstructor },
  680. { &kIN_CSSVALUESEARCH_CID, false, nullptr, inCSSValueSearchConstructor },
  681. { &kIN_DOMUTILS_CID, false, nullptr, inDOMUtilsConstructor },
  682. { &kNS_CONTENT_VIEWER_CID, false, nullptr, CreateContentViewer },
  683. { &kNS_HTMLDOCUMENT_CID, false, nullptr, CreateHTMLDocument },
  684. { &kNS_XMLDOCUMENT_CID, false, nullptr, CreateXMLDocument },
  685. { &kNS_SVGDOCUMENT_CID, false, nullptr, CreateSVGDocument },
  686. { &kNS_IMAGEDOCUMENT_CID, false, nullptr, CreateImageDocument },
  687. { &kNS_DOMSELECTION_CID, false, nullptr, CreateDOMSelection },
  688. { &kNS_CONTENTITERATOR_CID, false, nullptr, CreateContentIterator },
  689. { &kNS_PRECONTENTITERATOR_CID, false, nullptr, CreatePreContentIterator },
  690. { &kNS_SUBTREEITERATOR_CID, false, nullptr, CreateSubtreeIterator },
  691. { &kNS_CANVASRENDERINGCONTEXTWEBGL_CID, false, nullptr, CreateCanvasRenderingContextWebGL },
  692. { &kNS_TEXT_ENCODER_CID, false, nullptr, CreateTextEncoder },
  693. { &kNS_HTMLCOPY_TEXT_ENCODER_CID, false, nullptr, CreateHTMLCopyTextEncoder },
  694. { &kNS_XMLCONTENTSERIALIZER_CID, false, nullptr, CreateXMLContentSerializer },
  695. { &kNS_HTMLCONTENTSERIALIZER_CID, false, nullptr, CreateHTMLContentSerializer },
  696. { &kNS_XHTMLCONTENTSERIALIZER_CID, false, nullptr, CreateXHTMLContentSerializer },
  697. { &kNS_PLAINTEXTSERIALIZER_CID, false, nullptr, CreatePlainTextSerializer },
  698. { &kNS_PARSERUTILS_CID, false, nullptr, nsParserUtilsConstructor },
  699. { &kNS_SCRIPTABLEUNESCAPEHTML_CID, false, nullptr, nsParserUtilsConstructor },
  700. { &kNS_CONTENTPOLICY_CID, false, nullptr, CreateContentPolicy },
  701. { &kNS_DATADOCUMENTCONTENTPOLICY_CID, false, nullptr, nsDataDocumentContentPolicyConstructor },
  702. { &kNS_NODATAPROTOCOLCONTENTPOLICY_CID, false, nullptr, nsNoDataProtocolContentPolicyConstructor },
  703. { &kNS_XULCONTROLLERS_CID, false, nullptr, NS_NewXULControllers },
  704. #ifdef MOZ_XUL
  705. { &kNS_XULSORTSERVICE_CID, false, nullptr, CreateXULSortService },
  706. { &kNS_XULTEMPLATEBUILDER_CID, false, nullptr, NS_NewXULContentBuilder },
  707. { &kNS_XULTREEBUILDER_CID, false, nullptr, NS_NewXULTreeBuilder },
  708. { &kNS_XULDOCUMENT_CID, false, nullptr, CreateXULDocument },
  709. #endif
  710. { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, nullptr, CreateContentDLF },
  711. { &kNS_JSPROTOCOLHANDLER_CID, false, nullptr, nsJSProtocolHandler::Create },
  712. { &kNS_JSURI_CID, false, nullptr, nsJSURIConstructor },
  713. { &kNS_WINDOWCOMMANDTABLE_CID, false, nullptr, CreateWindowCommandTableConstructor },
  714. { &kNS_WINDOWCONTROLLER_CID, false, nullptr, CreateWindowControllerWithSingletonCommandTable },
  715. { &kNS_PLUGINDOCLOADERFACTORY_CID, false, nullptr, CreateContentDLF },
  716. { &kNS_PLUGINDOCUMENT_CID, false, nullptr, CreatePluginDocument },
  717. { &kNS_VIDEODOCUMENT_CID, false, nullptr, CreateVideoDocument },
  718. { &kNS_STYLESHEETSERVICE_CID, false, nullptr, nsStyleSheetServiceConstructor },
  719. { &kTRANSFORMIIX_XSLT_PROCESSOR_CID, false, nullptr, txMozillaXSLTProcessorConstructor },
  720. { &kTRANSFORMIIX_XPATH_EVALUATOR_CID, false, nullptr, XPathEvaluatorConstructor },
  721. { &kTRANSFORMIIX_NODESET_CID, false, nullptr, txNodeSetAdaptorConstructor },
  722. { &kNS_XMLSERIALIZER_CID, false, nullptr, nsDOMSerializerConstructor },
  723. { &kNS_FORMDATA_CID, false, nullptr, FormDataConstructor },
  724. { &kNS_HOSTOBJECTURI_CID, false, nullptr, nsHostObjectURIConstructor },
  725. { &kNS_XMLHTTPREQUEST_CID, false, nullptr, XMLHttpRequestMainThreadConstructor },
  726. { &kNS_DOMPARSER_CID, false, nullptr, DOMParserConstructor },
  727. { &kNS_XPCEXCEPTION_CID, false, nullptr, ExceptionConstructor },
  728. { &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, DOMSessionStorageManagerConstructor },
  729. { &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, DOMLocalStorageManagerConstructor },
  730. { &kNS_DOMJSON_CID, false, nullptr, NS_NewJSON },
  731. { &kNS_TEXTEDITOR_CID, false, nullptr, TextEditorConstructor },
  732. { &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor },
  733. { &kQUOTAMANAGER_SERVICE_CID, false, nullptr, QuotaManagerServiceConstructor },
  734. { &kSERVICEWORKERMANAGER_CID, false, nullptr, ServiceWorkerManagerConstructor },
  735. { &kPUSHNOTIFIER_CID, false, nullptr, PushNotifierConstructor },
  736. { &kWORKERDEBUGGERMANAGER_CID, true, nullptr, WorkerDebuggerManagerConstructor },
  737. { &kNS_AUDIOCHANNELAGENT_CID, true, nullptr, AudioChannelAgentConstructor },
  738. { &kNS_HTMLEDITOR_CID, false, nullptr, HTMLEditorConstructor },
  739. { &kNS_EDITORCONTROLLER_CID, false, nullptr, EditorControllerConstructor },
  740. { &kNS_EDITINGCONTROLLER_CID, false, nullptr, nsEditingControllerConstructor },
  741. { &kNS_EDITORCOMMANDTABLE_CID, false, nullptr, nsEditorCommandTableConstructor },
  742. { &kNS_EDITINGCOMMANDTABLE_CID, false, nullptr, nsEditingCommandTableConstructor },
  743. { &kNS_TEXTSERVICESDOCUMENT_CID, false, nullptr, nsTextServicesDocumentConstructor },
  744. { &kNS_GEOLOCATION_SERVICE_CID, false, nullptr, nsGeolocationServiceConstructor },
  745. { &kNS_GEOLOCATION_CID, false, nullptr, GeolocationConstructor },
  746. { &kNS_AUDIOCHANNEL_SERVICE_CID, false, nullptr, AudioChannelServiceConstructor },
  747. { &kNS_WEBSOCKETEVENT_SERVICE_CID, false, nullptr, WebSocketEventServiceConstructor },
  748. { &kNS_FOCUSMANAGER_CID, false, nullptr, CreateFocusManager },
  749. #ifdef MOZ_WEBSPEECH
  750. { &kNS_SYNTHVOICEREGISTRY_CID, true, nullptr, nsSynthVoiceRegistryConstructor },
  751. #endif
  752. { &kNS_CONTENTSECURITYMANAGER_CID, false, nullptr, nsContentSecurityManagerConstructor },
  753. { &kCSPSERVICE_CID, false, nullptr, CSPServiceConstructor },
  754. { &kNS_CSPCONTEXT_CID, false, nullptr, nsCSPContextConstructor },
  755. { &kNS_MIXEDCONTENTBLOCKER_CID, false, nullptr, nsMixedContentBlockerConstructor },
  756. { &kNS_EVENTLISTENERSERVICE_CID, false, nullptr, CreateEventListenerService },
  757. { &kNS_GLOBALMESSAGEMANAGER_CID, false, nullptr, CreateGlobalMessageManager },
  758. { &kNS_PARENTPROCESSMESSAGEMANAGER_CID, false, nullptr, CreateParentMessageManager },
  759. { &kNS_CHILDPROCESSMESSAGEMANAGER_CID, false, nullptr, CreateChildMessageManager },
  760. { &kNS_SCRIPTSECURITYMANAGER_CID, false, nullptr, Construct_nsIScriptSecurityManager },
  761. { &kNS_PRINCIPAL_CID, false, nullptr, nsPrincipalConstructor },
  762. { &kNS_SYSTEMPRINCIPAL_CID, false, nullptr, nsSystemPrincipalConstructor },
  763. { &kNS_NULLPRINCIPAL_CID, false, nullptr, nsNullPrincipalConstructor },
  764. { &kNS_DEVICE_SENSORS_CID, false, nullptr, nsDeviceSensorsConstructor },
  765. { &kTHIRDPARTYUTIL_CID, false, nullptr, ThirdPartyUtilConstructor },
  766. { &kNS_STRUCTUREDCLONECONTAINER_CID, false, nullptr, nsStructuredCloneContainerConstructor },
  767. { &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, Module::ALLOW_IN_GPU_PROCESS },
  768. { &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor },
  769. { &kUDPSOCKETCHILD_CID, false, nullptr, UDPSocketChildConstructor },
  770. { &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor },
  771. { &kNS_TIMESERVICE_CID, false, nullptr, nsITimeServiceConstructor },
  772. { &kNS_MEDIASTREAMCONTROLLERSERVICE_CID, false, nullptr, nsIStreamingProtocolControllerServiceConstructor },
  773. { &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor },
  774. #ifdef ACCESSIBILITY
  775. { &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
  776. #endif
  777. { &kTEXT_INPUT_PROCESSOR_CID, false, nullptr, TextInputProcessorConstructor },
  778. { &kNS_SCRIPTERROR_CID, false, nullptr, nsScriptErrorConstructor },
  779. { nullptr }
  780. };
  781. static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
  782. XPCONNECT_CONTRACTS
  783. { "@mozilla.org/layout/xul-boxobject;1", &kNS_BOXOBJECT_CID },
  784. #ifdef MOZ_XUL
  785. { "@mozilla.org/layout/xul-boxobject-listbox;1", &kNS_LISTBOXOBJECT_CID },
  786. { "@mozilla.org/layout/xul-boxobject-menu;1", &kNS_MENUBOXOBJECT_CID },
  787. { "@mozilla.org/layout/xul-boxobject-popup;1", &kNS_POPUPBOXOBJECT_CID },
  788. { "@mozilla.org/layout/xul-boxobject-container;1", &kNS_CONTAINERBOXOBJECT_CID },
  789. { "@mozilla.org/layout/xul-boxobject-scrollbox;1", &kNS_SCROLLBOXOBJECT_CID },
  790. { "@mozilla.org/layout/xul-boxobject-tree;1", &kNS_TREEBOXOBJECT_CID },
  791. #endif // MOZ_XUL
  792. #ifdef MOZ_XUL
  793. { "@mozilla.org/inspector/dom-view;1", &kIN_DOMVIEW_CID },
  794. #endif
  795. { "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
  796. { "@mozilla.org/inspector/search;1?type=cssvalue", &kIN_CSSVALUESEARCH_CID },
  797. { IN_DOMUTILS_CONTRACTID, &kIN_DOMUTILS_CID },
  798. { "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
  799. { "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
  800. { "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
  801. { "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
  802. { "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
  803. { "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID },
  804. { "@mozilla.org/content/canvas-rendering-context;1?id=webgl", &kNS_CANVASRENDERINGCONTEXTWEBGL_CID },
  805. { NS_DOC_ENCODER_CONTRACTID_BASE "text/xml", &kNS_TEXT_ENCODER_CID },
  806. { NS_DOC_ENCODER_CONTRACTID_BASE "application/xml", &kNS_TEXT_ENCODER_CID },
  807. { NS_DOC_ENCODER_CONTRACTID_BASE "application/xhtml+xml", &kNS_TEXT_ENCODER_CID },
  808. { NS_DOC_ENCODER_CONTRACTID_BASE "image/svg+xml", &kNS_TEXT_ENCODER_CID },
  809. { NS_DOC_ENCODER_CONTRACTID_BASE "text/html", &kNS_TEXT_ENCODER_CID },
  810. { NS_DOC_ENCODER_CONTRACTID_BASE "text/plain", &kNS_TEXT_ENCODER_CID },
  811. { NS_HTMLCOPY_ENCODER_CONTRACTID, &kNS_HTMLCOPY_TEXT_ENCODER_CID },
  812. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml", &kNS_XMLCONTENTSERIALIZER_CID },
  813. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml", &kNS_XMLCONTENTSERIALIZER_CID },
  814. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml", &kNS_XHTMLCONTENTSERIALIZER_CID },
  815. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml", &kNS_XMLCONTENTSERIALIZER_CID },
  816. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html", &kNS_HTMLCONTENTSERIALIZER_CID },
  817. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml", &kNS_XMLCONTENTSERIALIZER_CID },
  818. { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain", &kNS_PLAINTEXTSERIALIZER_CID },
  819. { NS_PARSERUTILS_CONTRACTID, &kNS_PARSERUTILS_CID },
  820. { NS_SCRIPTABLEUNESCAPEHTML_CONTRACTID, &kNS_SCRIPTABLEUNESCAPEHTML_CID },
  821. { NS_CONTENTPOLICY_CONTRACTID, &kNS_CONTENTPOLICY_CID },
  822. { NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, &kNS_DATADOCUMENTCONTENTPOLICY_CID },
  823. { NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, &kNS_NODATAPROTOCOLCONTENTPOLICY_CID },
  824. { "@mozilla.org/xul/xul-controllers;1", &kNS_XULCONTROLLERS_CID },
  825. #ifdef MOZ_XUL
  826. { "@mozilla.org/xul/xul-sort-service;1", &kNS_XULSORTSERVICE_CID },
  827. { "@mozilla.org/xul/xul-template-builder;1", &kNS_XULTEMPLATEBUILDER_CID },
  828. { "@mozilla.org/xul/xul-tree-builder;1", &kNS_XULTREEBUILDER_CID },
  829. { "@mozilla.org/xul/xul-document;1", &kNS_XULDOCUMENT_CID },
  830. #endif
  831. { CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID },
  832. { NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID },
  833. { NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID },
  834. { PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
  835. { NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
  836. { TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID, &kTRANSFORMIIX_XSLT_PROCESSOR_CID },
  837. { NS_XPATH_EVALUATOR_CONTRACTID, &kTRANSFORMIIX_XPATH_EVALUATOR_CID },
  838. { TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
  839. { NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
  840. { NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID },
  841. { NS_XMLHTTPREQUEST_CONTRACTID, &kNS_XMLHTTPREQUEST_CID },
  842. { NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID },
  843. { XPC_EXCEPTION_CONTRACTID, &kNS_XPCEXCEPTION_CID },
  844. { "@mozilla.org/dom/localStorage-manager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
  845. // Keeping the old ContractID for backward compatibility
  846. { "@mozilla.org/dom/storagemanager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
  847. { "@mozilla.org/dom/sessionStorage-manager;1", &kNS_DOMSESSIONSTORAGEMANAGER_CID },
  848. { "@mozilla.org/dom/json;1", &kNS_DOMJSON_CID },
  849. { "@mozilla.org/editor/texteditor;1", &kNS_TEXTEDITOR_CID },
  850. { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID },
  851. { QUOTAMANAGER_SERVICE_CONTRACTID, &kQUOTAMANAGER_SERVICE_CID },
  852. { SERVICEWORKERMANAGER_CONTRACTID, &kSERVICEWORKERMANAGER_CID },
  853. { PUSHNOTIFIER_CONTRACTID, &kPUSHNOTIFIER_CID },
  854. { WORKERDEBUGGERMANAGER_CONTRACTID, &kWORKERDEBUGGERMANAGER_CID },
  855. { NS_AUDIOCHANNELAGENT_CONTRACTID, &kNS_AUDIOCHANNELAGENT_CID },
  856. { "@mozilla.org/editor/htmleditor;1", &kNS_HTMLEDITOR_CID },
  857. { "@mozilla.org/editor/editorcontroller;1", &kNS_EDITORCONTROLLER_CID },
  858. { "@mozilla.org/editor/editingcontroller;1", &kNS_EDITINGCONTROLLER_CID },
  859. { "@mozilla.org/textservices/textservicesdocument;1", &kNS_TEXTSERVICESDOCUMENT_CID },
  860. { "@mozilla.org/geolocation/service;1", &kNS_GEOLOCATION_SERVICE_CID },
  861. { "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID },
  862. { "@mozilla.org/audiochannel/service;1", &kNS_AUDIOCHANNEL_SERVICE_CID },
  863. { "@mozilla.org/websocketevent/service;1", &kNS_WEBSOCKETEVENT_SERVICE_CID },
  864. { "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
  865. #ifdef MOZ_WEBSPEECH
  866. { NS_SYNTHVOICEREGISTRY_CONTRACTID, &kNS_SYNTHVOICEREGISTRY_CID },
  867. #endif
  868. { NS_CONTENTSECURITYMANAGER_CONTRACTID, &kNS_CONTENTSECURITYMANAGER_CID },
  869. { CSPSERVICE_CONTRACTID, &kCSPSERVICE_CID },
  870. { NS_CSPCONTEXT_CONTRACTID, &kNS_CSPCONTEXT_CID },
  871. { NS_MIXEDCONTENTBLOCKER_CONTRACTID, &kNS_MIXEDCONTENTBLOCKER_CID },
  872. { NS_EVENTLISTENERSERVICE_CONTRACTID, &kNS_EVENTLISTENERSERVICE_CID },
  873. { NS_GLOBALMESSAGEMANAGER_CONTRACTID, &kNS_GLOBALMESSAGEMANAGER_CID },
  874. { NS_PARENTPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_PARENTPROCESSMESSAGEMANAGER_CID },
  875. { NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_CHILDPROCESSMESSAGEMANAGER_CID },
  876. { NS_SCRIPTSECURITYMANAGER_CONTRACTID, &kNS_SCRIPTSECURITYMANAGER_CID },
  877. { NS_PRINCIPAL_CONTRACTID, &kNS_PRINCIPAL_CID },
  878. { NS_SYSTEMPRINCIPAL_CONTRACTID, &kNS_SYSTEMPRINCIPAL_CID },
  879. { NS_NULLPRINCIPAL_CONTRACTID, &kNS_NULLPRINCIPAL_CID },
  880. { NS_DEVICE_SENSORS_CONTRACTID, &kNS_DEVICE_SENSORS_CID },
  881. { THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID },
  882. { NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID },
  883. { POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, Module::ALLOW_IN_GPU_PROCESS },
  884. { OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID },
  885. { "@mozilla.org/udp-socket-child;1", &kUDPSOCKETCHILD_CID },
  886. { TIMESERVICE_CONTRACTID, &kNS_TIMESERVICE_CID },
  887. { MEDIASTREAMCONTROLLERSERVICE_CONTRACTID, &kNS_MEDIASTREAMCONTROLLERSERVICE_CID },
  888. { MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID },
  889. #ifdef ACCESSIBILITY
  890. { "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
  891. { "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
  892. #endif
  893. { "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
  894. { "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID },
  895. { NS_SCRIPTERROR_CONTRACTID, &kNS_SCRIPTERROR_CID },
  896. { nullptr }
  897. };
  898. static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
  899. XPCONNECT_CATEGORIES
  900. { "content-policy", NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID },
  901. { "content-policy", NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID },
  902. { "content-policy", "CSPService", CSPSERVICE_CONTRACTID },
  903. { "content-policy", NS_MIXEDCONTENTBLOCKER_CONTRACTID, NS_MIXEDCONTENTBLOCKER_CONTRACTID },
  904. { "net-channel-event-sinks", "CSPService", CSPSERVICE_CONTRACTID },
  905. { "net-channel-event-sinks", NS_MIXEDCONTENTBLOCKER_CONTRACTID, NS_MIXEDCONTENTBLOCKER_CONTRACTID },
  906. { "app-startup", "Script Security Manager", "service," NS_SCRIPTSECURITYMANAGER_CONTRACTID },
  907. { "app-startup", "Push Notifier", "service," PUSHNOTIFIER_CONTRACTID },
  908. { "clear-origin-attributes-data", "QuotaManagerService", "service," QUOTAMANAGER_SERVICE_CONTRACTID },
  909. { OBSERVER_TOPIC_IDLE_DAILY, "QuotaManagerService", QUOTAMANAGER_SERVICE_CONTRACTID },
  910. CONTENTDLF_CATEGORIES
  911. { nullptr }
  912. };
  913. static void
  914. LayoutModuleDtor()
  915. {
  916. if (XRE_GetProcessType() == GeckoProcessType_GPU) {
  917. return;
  918. }
  919. Shutdown();
  920. nsContentUtils::XPCOMShutdown();
  921. // Layout depends heavily on gfx and imagelib, so we want to make sure that
  922. // these modules are shut down after all the layout cleanup runs.
  923. mozilla::image::ShutdownModule();
  924. gfxPlatform::Shutdown();
  925. gfx::gfxVars::Shutdown();
  926. nsScriptSecurityManager::Shutdown();
  927. xpcModuleDtor();
  928. }
  929. static const mozilla::Module kLayoutModule = {
  930. mozilla::Module::kVersion,
  931. kLayoutCIDs,
  932. kLayoutContracts,
  933. kLayoutCategories,
  934. nullptr,
  935. Initialize,
  936. LayoutModuleDtor,
  937. Module::ALLOW_IN_GPU_PROCESS
  938. };
  939. NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;