1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : * Pierre Phaneuf <pp@ludusdesign.com>
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either of the GNU General Public License Version 2 or later (the "GPL"),
27 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #include "base/basictypes.h"
40 :
41 : #include "XPCModule.h"
42 : #include "mozilla/ModuleUtils.h"
43 : #include "nsLayoutStatics.h"
44 : #include "nsContentCID.h"
45 : #include "nsContentDLF.h"
46 : #include "nsContentPolicyUtils.h"
47 : #include "nsDataDocumentContentPolicy.h"
48 : #include "nsNoDataProtocolContentPolicy.h"
49 : #include "nsDOMCID.h"
50 : #include "nsHTMLContentSerializer.h"
51 : #include "nsHTMLParts.h"
52 : #include "nsGenericHTMLElement.h"
53 : #include "nsIComponentManager.h"
54 : #include "nsIContentIterator.h"
55 : #include "nsIContentSerializer.h"
56 : #include "nsIContentViewer.h"
57 : #include "nsIController.h"
58 : #include "nsIControllers.h"
59 : #include "nsIDOMDOMImplementation.h"
60 : #include "nsIDocument.h"
61 : #include "nsIDocumentEncoder.h"
62 : #include "nsIFactory.h"
63 : #include "nsIFrameUtil.h"
64 : #include "nsHTMLStyleSheet.h"
65 : #include "nsILayoutDebugger.h"
66 : #include "nsINameSpaceManager.h"
67 : #include "nsINodeInfo.h"
68 : #include "nsIObserver.h"
69 : #include "nsIObserverService.h"
70 : #include "nsIPresShell.h"
71 : #include "nsIScriptNameSpaceManager.h"
72 : #include "nsISelection.h"
73 : #include "nsIXBLService.h"
74 : #include "nsCaret.h"
75 : #include "nsPlainTextSerializer.h"
76 : #include "mozSanitizingSerializer.h"
77 : #include "nsXMLContentSerializer.h"
78 : #include "nsXHTMLContentSerializer.h"
79 : #include "nsRuleNode.h"
80 : #include "nsContentAreaDragDrop.h"
81 : #include "nsContentList.h"
82 : #include "nsBox.h"
83 : #include "nsIFrameTraversal.h"
84 : #include "nsLayoutCID.h"
85 : #include "nsStyleSheetService.h"
86 : #include "nsFocusManager.h"
87 : #include "ThirdPartyUtil.h"
88 : #include "mozilla/Services.h"
89 : #include "nsStructuredCloneContainer.h"
90 :
91 : #include "nsIEventListenerService.h"
92 : #include "nsIFrameMessageManager.h"
93 :
94 : // Transformiix stuff
95 : #include "nsXPathEvaluator.h"
96 : #include "txMozillaXSLTProcessor.h"
97 : #include "txNodeSetAdaptor.h"
98 :
99 : #include "nsDOMParser.h"
100 : #include "nsDOMSerializer.h"
101 : #include "nsXMLHttpRequest.h"
102 : #include "nsChannelPolicy.h"
103 : #include "nsWebSocket.h"
104 : #include "nsEventSource.h"
105 :
106 : // view stuff
107 : #include "nsViewsCID.h"
108 : #include "nsViewManager.h"
109 : #include "nsContentCreatorFunctions.h"
110 :
111 : // DOM includes
112 : #include "nsDOMException.h"
113 : #include "nsDOMFileReader.h"
114 : #include "nsFormData.h"
115 : #include "nsBlobProtocolHandler.h"
116 : #include "nsGlobalWindowCommands.h"
117 : #include "nsIControllerCommandTable.h"
118 : #include "nsJSProtocolHandler.h"
119 : #include "nsScriptNameSpaceManager.h"
120 : #include "nsIControllerContext.h"
121 : #include "nsDOMScriptObjectFactory.h"
122 : #include "nsDOMStorage.h"
123 : #include "nsJSON.h"
124 : #include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
125 : #include "mozilla/dom/DOMRequest.h"
126 :
127 : using mozilla::dom::indexedDB::IndexedDatabaseManager;
128 : using mozilla::dom::DOMRequestService;
129 :
130 : #ifdef MOZ_B2G_RIL
131 : #include "SystemWorkerManager.h"
132 : using mozilla::dom::telephony::SystemWorkerManager;
133 : #define SYSTEMWORKERMANAGER_CID \
134 : {0xd53b6524, 0x6ac3, 0x42b0, {0xae, 0xca, 0x62, 0xb3, 0xc4, 0xe5, 0x2b, 0x04}}
135 : #define SYSTEMWORKERMANAGER_CONTRACTID \
136 : "@mozilla.org/telephony/system-worker-manager;1"
137 : #endif
138 :
139 : #ifdef MOZ_WIDGET_GONK
140 : #include "AudioManager.h"
141 : using mozilla::dom::telephony::AudioManager;
142 : #endif
143 :
144 : // Editor stuff
145 : #include "nsEditorCID.h"
146 : #include "nsEditor.h"
147 : #include "nsPlaintextEditor.h"
148 : #include "nsEditorController.h" //CID
149 :
150 : #include "nsHTMLEditor.h"
151 : #include "nsTextServicesDocument.h"
152 : #include "nsTextServicesCID.h"
153 :
154 : #include "nsScriptSecurityManager.h"
155 : #include "nsPrincipal.h"
156 : #include "nsSystemPrincipal.h"
157 : #include "nsNullPrincipal.h"
158 : #include "nsNetCID.h"
159 : #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_PLATFORM_MAEMO)
160 : #include "nsHapticFeedback.h"
161 : #endif
162 : #include "nsParserUtils.h"
163 :
164 : #define NS_EDITORCOMMANDTABLE_CID \
165 : { 0x4f5e62b8, 0xd659, 0x4156, { 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 }}
166 :
167 : #define NS_EDITINGCOMMANDTABLE_CID \
168 : { 0xcb38a746, 0xbeb8, 0x43f3, { 0x94, 0x29, 0x77, 0x96, 0xe1, 0xa9, 0x3f, 0xb4 }}
169 :
170 : #define NS_HAPTICFEEDBACK_CID \
171 : { 0x1f15dbc8, 0xbfaa, 0x45de, \
172 : { 0x8a, 0x46, 0x08, 0xe2, 0xe2, 0x63, 0x26, 0xb0 } }
173 :
174 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlaintextEditor)
175 :
176 4 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserUtils)
177 :
178 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextServicesDocument)
179 : #ifdef ENABLE_EDITOR_API_LOG
180 : #include "nsHTMLEditorLog.h"
181 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditorLog)
182 : #else
183 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditor)
184 : #endif
185 :
186 : #include "nsHTMLCanvasFrame.h"
187 :
188 : #include "nsIDOMCanvasRenderingContext2D.h"
189 : #include "nsIDOMWebGLRenderingContext.h"
190 :
191 : class nsIDocumentLoaderFactory;
192 :
193 : #define PRODUCT_NAME "Gecko"
194 :
195 : #define NS_HTMLIMGELEMENT_CONTRACTID \
196 : "@mozilla.org/content/element/html;1?name=img"
197 :
198 : #define NS_HTMLOPTIONELEMENT_CONTRACTID \
199 : "@mozilla.org/content/element/html;1?name=option"
200 :
201 : #ifdef MOZ_MEDIA
202 : #define NS_HTMLAUDIOELEMENT_CONTRACTID \
203 : "@mozilla.org/content/element/html;1?name=audio"
204 : #endif
205 :
206 : /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
207 : #define NS_PLUGINDOCLOADERFACTORY_CID \
208 : { 0x0ddf4df8, 0x4dbb, 0x4133, { 0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 } }
209 :
210 : #define NS_WINDOWCOMMANDTABLE_CID \
211 : { /* 0DE2FBFA-6B7F-11D7-BBBA-0003938A9D96 */ \
212 : 0x0DE2FBFA, 0x6B7F, 0x11D7, {0xBB, 0xBA, 0x00, 0x03, 0x93, 0x8A, 0x9D, 0x96} }
213 :
214 : #include "nsIBoxObject.h"
215 :
216 : #ifdef MOZ_XUL
217 : #include "inDOMView.h"
218 : #endif /* MOZ_XUL */
219 :
220 : #include "inDeepTreeWalker.h"
221 : #include "inFlasher.h"
222 : #include "inCSSValueSearch.h"
223 : #include "inDOMUtils.h"
224 :
225 : #ifdef MOZ_XUL
226 : #include "nsIXULDocument.h"
227 : #include "nsIXULSortService.h"
228 :
229 : nsresult
230 : NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
231 :
232 : nsresult
233 : NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
234 : #endif
235 :
236 : static void Shutdown();
237 :
238 : #ifdef MOZ_XTF
239 : #include "nsIXTFService.h"
240 : #include "nsIXMLContentBuilder.h"
241 : #endif
242 :
243 : #include "nsGeolocation.h"
244 : #ifndef MOZ_WIDGET_GONK
245 : #if defined(XP_UNIX) || \
246 : defined(_WINDOWS) || \
247 : defined(machintosh) || \
248 : defined(android)
249 : #include "nsDeviceMotionSystem.h"
250 : #endif
251 : #endif
252 : #include "nsCSPService.h"
253 : #include "nsISmsService.h"
254 : #include "nsISmsDatabaseService.h"
255 : #include "mozilla/dom/sms/SmsRequestManager.h"
256 : #include "mozilla/dom/sms/SmsServicesFactory.h"
257 : #include "nsIPowerManagerService.h"
258 :
259 : using namespace mozilla::dom::sms;
260 :
261 : #include "mozilla/dom/power/PowerManagerService.h"
262 :
263 : using mozilla::dom::power::PowerManagerService;
264 :
265 : // Transformiix
266 : /* 5d5d92cd-6bf8-11d9-bf4a-000a95dc234c */
267 : #define TRANSFORMIIX_NODESET_CID \
268 : { 0x5d5d92cd, 0x6bf8, 0x11d9, { 0xbf, 0x4a, 0x0, 0x0a, 0x95, 0xdc, 0x23, 0x4c } }
269 :
270 : #define TRANSFORMIIX_NODESET_CONTRACTID \
271 : "@mozilla.org/transformiix-nodeset;1"
272 :
273 : // Factory Constructor
274 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor)
275 4 : NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsXPathEvaluator, Init)
276 0 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
277 432 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
278 1192 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init)
279 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsEventSource)
280 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebSocket)
281 4 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDOMFileReader, Init)
282 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormData)
283 6 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsBlobProtocolHandler)
284 1138 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMParser)
285 4 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDOMStorageManager,
286 4 : nsDOMStorageManager::GetInstance)
287 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsChannelPolicy)
288 54 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(IndexedDatabaseManager,
289 54 : IndexedDatabaseManager::FactoryCreate)
290 0 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService,
291 0 : DOMRequestService::FactoryCreate)
292 : #ifdef MOZ_B2G_RIL
293 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(SystemWorkerManager,
294 : SystemWorkerManager::FactoryCreate)
295 : #endif
296 :
297 : #ifdef MOZ_WIDGET_GONK
298 : NS_GENERIC_FACTORY_CONSTRUCTOR(AudioManager)
299 : #else
300 : #if defined(XP_UNIX) || \
301 : defined(_WINDOWS) || \
302 : defined(machintosh) || \
303 : defined(android)
304 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceMotionSystem)
305 : #endif
306 : #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
307 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
308 : #endif
309 : #endif
310 8 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
311 1 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService, SmsServicesFactory::CreateSmsService)
312 0 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsDatabaseService, SmsServicesFactory::CreateSmsDatabaseService)
313 0 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
314 0 : PowerManagerService::GetInstance)
315 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(SmsRequestManager)
316 :
317 : //-----------------------------------------------------------------------------
318 :
319 : // Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
320 : // perform shutdown of the layout modules at that time instead of waiting for
321 : // our module destructor to run. If we do not do this, then we risk holding
322 : // references to objects in other component libraries that have already been
323 : // shutdown (and possibly unloaded if 60709 is ever fixed).
324 :
325 : class LayoutShutdownObserver : public nsIObserver
326 1404 : {
327 : public:
328 : NS_DECL_ISUPPORTS
329 : NS_DECL_NSIOBSERVER
330 : };
331 :
332 9828 : NS_IMPL_ISUPPORTS1(LayoutShutdownObserver, nsIObserver)
333 :
334 : NS_IMETHODIMP
335 1404 : LayoutShutdownObserver::Observe(nsISupports *aSubject,
336 : const char *aTopic,
337 : const PRUnichar *someData)
338 : {
339 1404 : if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
340 1404 : Shutdown();
341 1404 : nsContentUtils::XPCOMShutdown();
342 : }
343 1404 : return NS_OK;
344 : }
345 :
346 : //-----------------------------------------------------------------------------
347 :
348 : static bool gInitialized = false;
349 :
350 : // Perform our one-time intialization for this module
351 :
352 : // static
353 : nsresult
354 1404 : Initialize()
355 : {
356 1404 : if (gInitialized) {
357 0 : NS_RUNTIMEABORT("Recursive layout module initialization");
358 0 : return NS_ERROR_FAILURE;
359 : }
360 :
361 : NS_ASSERTION(sizeof(PtrBits) == sizeof(void *),
362 : "Eeek! You'll need to adjust the size of PtrBits to the size "
363 : "of a pointer on your platform.");
364 :
365 1404 : gInitialized = true;
366 :
367 : nsresult rv;
368 1404 : rv = xpcModuleCtor();
369 1404 : if (NS_FAILED(rv))
370 0 : return rv;
371 :
372 1404 : rv = nsLayoutStatics::Initialize();
373 1404 : if (NS_FAILED(rv)) {
374 0 : Shutdown();
375 0 : return rv;
376 : }
377 :
378 : // Add our shutdown observer.
379 : nsCOMPtr<nsIObserverService> observerService =
380 2808 : mozilla::services::GetObserverService();
381 :
382 1404 : if (observerService) {
383 1404 : LayoutShutdownObserver* observer = new LayoutShutdownObserver();
384 :
385 1404 : if (!observer) {
386 0 : Shutdown();
387 :
388 0 : return NS_ERROR_OUT_OF_MEMORY;
389 : }
390 :
391 1404 : observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
392 : } else {
393 0 : NS_WARNING("Could not get an observer service. We will leak on shutdown.");
394 : }
395 :
396 1404 : return NS_OK;
397 : }
398 :
399 : // Shutdown this module, releasing all of the module resources
400 :
401 : // static
402 : void
403 1404 : Shutdown()
404 : {
405 1404 : NS_PRECONDITION(gInitialized, "module not initialized");
406 1404 : if (!gInitialized)
407 0 : return;
408 :
409 1404 : gInitialized = false;
410 :
411 1404 : nsLayoutStatics::Release();
412 : }
413 :
414 : #ifdef NS_DEBUG
415 : nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
416 : nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
417 : #endif
418 :
419 : nsresult NS_NewBoxObject(nsIBoxObject** aResult);
420 :
421 : #ifdef MOZ_XUL
422 : nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
423 : nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
424 : nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
425 : nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
426 : nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
427 : nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
428 : #endif
429 :
430 : nsresult NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult);
431 : nsresult NS_NewCanvasRenderingContext2DThebes(nsIDOMCanvasRenderingContext2D** aResult);
432 : nsresult NS_NewCanvasRenderingContextWebGL(nsIDOMWebGLRenderingContext** aResult);
433 :
434 : nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
435 :
436 : nsresult NS_NewDomSelection(nsISelection** aResult);
437 : nsresult NS_NewContentViewer(nsIContentViewer** aResult);
438 : nsresult NS_NewContentIterator(nsIContentIterator** aResult);
439 : nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
440 : nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
441 : nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
442 : nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
443 : nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
444 : nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
445 : nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
446 : nsresult NS_NewXBLService(nsIXBLService** aResult);
447 : nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
448 :
449 : nsresult NS_NewEventListenerService(nsIEventListenerService** aResult);
450 : nsresult NS_NewGlobalMessageManager(nsIChromeFrameMessageManager** aResult);
451 : nsresult NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult);
452 : nsresult NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult);
453 :
454 : nsresult NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
455 :
456 : #define MAKE_CTOR(ctor_, iface_, func_) \
457 : static nsresult \
458 : ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
459 : { \
460 : *aResult = nsnull; \
461 : if (aOuter) \
462 : return NS_ERROR_NO_AGGREGATION; \
463 : iface_* inst; \
464 : nsresult rv = func_(&inst); \
465 : if (NS_SUCCEEDED(rv)) { \
466 : rv = inst->QueryInterface(aIID, aResult); \
467 : NS_RELEASE(inst); \
468 : } \
469 : return rv; \
470 : }
471 :
472 : #ifdef DEBUG
473 0 : MAKE_CTOR(CreateNewFrameUtil, nsIFrameUtil, NS_NewFrameUtil)
474 0 : MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
475 : #endif
476 :
477 0 : MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
478 0 : MAKE_CTOR(CreateNewPresShell, nsIPresShell, NS_NewPresShell)
479 0 : MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
480 :
481 : #ifdef MOZ_XUL
482 0 : MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject)
483 0 : MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
484 0 : MAKE_CTOR(CreateNewPopupBoxObject, nsIBoxObject, NS_NewPopupBoxObject)
485 0 : MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject)
486 1 : MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
487 0 : MAKE_CTOR(CreateNewContainerBoxObject, nsIBoxObject, NS_NewContainerBoxObject)
488 : #endif // MOZ_XUL
489 :
490 : #ifdef MOZ_XUL
491 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMView)
492 : #endif
493 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
494 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(inFlasher)
495 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
496 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
497 :
498 0 : MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
499 0 : MAKE_CTOR(CreateContentViewer, nsIContentViewer, NS_NewContentViewer)
500 0 : MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
501 0 : MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
502 0 : MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
503 0 : MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
504 0 : MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
505 0 : MAKE_CTOR(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
506 0 : MAKE_CTOR(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
507 0 : MAKE_CTOR(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
508 : // CreateHTMLImgElement, see below
509 : // CreateHTMLOptionElement, see below
510 : // CreateHTMLAudioElement, see below
511 459 : MAKE_CTOR(CreateTextEncoder, nsIDocumentEncoder, NS_NewTextEncoder)
512 0 : MAKE_CTOR(CreateHTMLCopyTextEncoder, nsIDocumentEncoder, NS_NewHTMLCopyTextEncoder)
513 10 : MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer, NS_NewXMLContentSerializer)
514 0 : MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer, NS_NewHTMLContentSerializer)
515 215 : MAKE_CTOR(CreateXHTMLContentSerializer, nsIContentSerializer, NS_NewXHTMLContentSerializer)
516 234 : MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer)
517 0 : MAKE_CTOR(CreateSanitizingHTMLSerializer, nsIContentSerializer, NS_NewSanitizingHTMLSerializer)
518 0 : MAKE_CTOR(CreateXBLService, nsIXBLService, NS_NewXBLService)
519 113 : MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
520 : #ifdef MOZ_XUL
521 0 : MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
522 : // NS_NewXULContentBuilder
523 : // NS_NewXULTreeBuilder
524 0 : MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
525 : // NS_NewXULControllers
526 : #endif
527 : #ifdef MOZ_XTF
528 236 : MAKE_CTOR(CreateXTFService, nsIXTFService, NS_NewXTFService)
529 0 : MAKE_CTOR(CreateXMLContentBuilder, nsIXMLContentBuilder, NS_NewXMLContentBuilder)
530 : #endif
531 0 : MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
532 0 : MAKE_CTOR(CreateEventListenerService, nsIEventListenerService, NS_NewEventListenerService)
533 228 : MAKE_CTOR(CreateGlobalMessageManager, nsIChromeFrameMessageManager,NS_NewGlobalMessageManager)
534 11 : MAKE_CTOR(CreateParentMessageManager, nsIFrameMessageManager,NS_NewParentProcessMessageManager)
535 0 : MAKE_CTOR(CreateChildMessageManager, nsISyncMessageSender,NS_NewChildProcessMessageManager)
536 6 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
537 6 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
538 0 : MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)
539 : #ifdef MOZ_MEDIA
540 0 : MAKE_CTOR(CreateVideoDocument, nsIDocument, NS_NewVideoDocument)
541 : #endif
542 2 : MAKE_CTOR(CreateFocusManager, nsIFocusManager, NS_NewFocusManager)
543 :
544 0 : MAKE_CTOR(CreateCanvasRenderingContext2D, nsIDOMCanvasRenderingContext2D, NS_NewCanvasRenderingContext2D)
545 0 : MAKE_CTOR(CreateCanvasRenderingContext2DThebes, nsIDOMCanvasRenderingContext2D, NS_NewCanvasRenderingContext2DThebes)
546 0 : MAKE_CTOR(CreateCanvasRenderingContextWebGL, nsIDOMWebGLRenderingContext, NS_NewCanvasRenderingContextWebGL)
547 :
548 0 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init)
549 :
550 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSURI)
551 :
552 : // views are not refcounted, so this is the same as
553 : // NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
554 : #define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \
555 : static nsresult \
556 : _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
557 : void **aResult) \
558 : { \
559 : nsresult rv; \
560 : \
561 : *aResult = NULL; \
562 : if (NULL != aOuter) { \
563 : rv = NS_ERROR_NO_AGGREGATION; \
564 : return rv; \
565 : } \
566 : \
567 : _InstanceClass * inst = new _InstanceClass(); \
568 : if (NULL == inst) { \
569 : rv = NS_ERROR_OUT_OF_MEMORY; \
570 : return rv; \
571 : } \
572 : rv = inst->QueryInterface(aIID, aResult); \
573 : \
574 : return rv; \
575 : } \
576 :
577 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager)
578 :
579 : static nsresult
580 0 : CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
581 : {
582 0 : *aResult = nsnull;
583 0 : if (aOuter)
584 0 : return NS_ERROR_NO_AGGREGATION;
585 : // Note! NS_NewHTMLImageElement is special cased to handle a null nodeinfo
586 0 : nsCOMPtr<nsINodeInfo> ni;
587 0 : nsIContent* inst = NS_NewHTMLImageElement(ni.forget());
588 0 : nsresult rv = NS_ERROR_OUT_OF_MEMORY;
589 0 : if (inst) {
590 0 : NS_ADDREF(inst);
591 0 : rv = inst->QueryInterface(aIID, aResult);
592 0 : NS_RELEASE(inst);
593 : }
594 0 : return rv;
595 : }
596 :
597 : static nsresult
598 0 : CreateHTMLOptionElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
599 : {
600 0 : *aResult = nsnull;
601 0 : if (aOuter)
602 0 : return NS_ERROR_NO_AGGREGATION;
603 : // Note! NS_NewHTMLOptionElement is special cased to handle a null nodeinfo
604 0 : nsCOMPtr<nsINodeInfo> ni;
605 0 : nsIContent* inst = NS_NewHTMLOptionElement(ni.forget());
606 0 : nsresult rv = NS_ERROR_OUT_OF_MEMORY;
607 0 : if (inst) {
608 0 : NS_ADDREF(inst);
609 0 : rv = inst->QueryInterface(aIID, aResult);
610 0 : NS_RELEASE(inst);
611 : }
612 0 : return rv;
613 : }
614 :
615 : #ifdef MOZ_MEDIA
616 : static nsresult
617 0 : CreateHTMLAudioElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
618 : {
619 0 : *aResult = nsnull;
620 0 : if (aOuter)
621 0 : return NS_ERROR_NO_AGGREGATION;
622 : // Note! NS_NewHTMLAudioElement is special cased to handle a null nodeinfo
623 0 : nsCOMPtr<nsINodeInfo> ni;
624 0 : nsCOMPtr<nsIContent> inst(NS_NewHTMLAudioElement(ni.forget()));
625 0 : return inst ? inst->QueryInterface(aIID, aResult) : NS_ERROR_OUT_OF_MEMORY;
626 : }
627 : #endif
628 :
629 100 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory)
630 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseDOMException)
631 :
632 : #define NS_GEOLOCATION_CID \
633 : { 0x1E1C3FF, 0x94A, 0xD048, { 0x44, 0xB4, 0x62, 0xD2, 0x9C, 0x7B, 0x4F, 0x39 } }
634 :
635 2 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGeolocation, Init)
636 :
637 : #define NS_GEOLOCATION_SERVICE_CID \
638 : { 0x404d02a, 0x1CA, 0xAAAB, { 0x47, 0x62, 0x94, 0x4b, 0x1b, 0xf2, 0xf7, 0xb5 } }
639 :
640 1 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocationService, nsGeolocationService::GetGeolocationService)
641 :
642 80 : NS_GENERIC_FACTORY_CONSTRUCTOR(CSPService)
643 :
644 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrincipal)
645 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecurityNameSet)
646 934 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsSystemPrincipal,
647 934 : nsScriptSecurityManager::SystemPrincipalSingletonConstructor)
648 5344 : NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNullPrincipal, Init)
649 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(nsStructuredCloneContainer)
650 :
651 : static nsresult
652 1392 : Construct_nsIScriptSecurityManager(nsISupports *aOuter, REFNSIID aIID,
653 : void **aResult)
654 : {
655 1392 : if (!aResult)
656 0 : return NS_ERROR_NULL_POINTER;
657 1392 : *aResult = nsnull;
658 1392 : if (aOuter)
659 0 : return NS_ERROR_NO_AGGREGATION;
660 1392 : nsScriptSecurityManager *obj = nsScriptSecurityManager::GetScriptSecurityManager();
661 1392 : if (!obj)
662 0 : return NS_ERROR_OUT_OF_MEMORY;
663 1392 : if (NS_FAILED(obj->QueryInterface(aIID, aResult)))
664 0 : return NS_ERROR_FAILURE;
665 1392 : return NS_OK;
666 : }
667 :
668 : #ifdef DEBUG
669 : NS_DEFINE_NAMED_CID(NS_FRAME_UTIL_CID);
670 : NS_DEFINE_NAMED_CID(NS_LAYOUT_DEBUGGER_CID);
671 : #endif
672 : NS_DEFINE_NAMED_CID(NS_FRAMETRAVERSAL_CID);
673 : NS_DEFINE_NAMED_CID(NS_PRESSHELL_CID);
674 : NS_DEFINE_NAMED_CID(NS_BOXOBJECT_CID);
675 : #ifdef MOZ_XUL
676 : NS_DEFINE_NAMED_CID(NS_LISTBOXOBJECT_CID);
677 : NS_DEFINE_NAMED_CID(NS_MENUBOXOBJECT_CID);
678 : NS_DEFINE_NAMED_CID(NS_POPUPBOXOBJECT_CID);
679 : NS_DEFINE_NAMED_CID(NS_CONTAINERBOXOBJECT_CID);
680 : NS_DEFINE_NAMED_CID(NS_SCROLLBOXOBJECT_CID);
681 : NS_DEFINE_NAMED_CID(NS_TREEBOXOBJECT_CID);
682 : #endif // MOZ_XUL
683 : #ifdef MOZ_XUL
684 : NS_DEFINE_NAMED_CID(IN_DOMVIEW_CID);
685 : #endif
686 : NS_DEFINE_NAMED_CID(IN_DEEPTREEWALKER_CID);
687 : NS_DEFINE_NAMED_CID(IN_FLASHER_CID);
688 : NS_DEFINE_NAMED_CID(IN_CSSVALUESEARCH_CID);
689 : NS_DEFINE_NAMED_CID(IN_DOMUTILS_CID);
690 : NS_DEFINE_NAMED_CID(NS_NAMESPACEMANAGER_CID);
691 : NS_DEFINE_NAMED_CID(NS_CONTENT_VIEWER_CID);
692 : NS_DEFINE_NAMED_CID(NS_HTMLDOCUMENT_CID);
693 : NS_DEFINE_NAMED_CID(NS_XMLDOCUMENT_CID);
694 : NS_DEFINE_NAMED_CID(NS_SVGDOCUMENT_CID);
695 : NS_DEFINE_NAMED_CID(NS_IMAGEDOCUMENT_CID);
696 : NS_DEFINE_NAMED_CID(NS_DOMSELECTION_CID);
697 : NS_DEFINE_NAMED_CID(NS_CONTENTITERATOR_CID);
698 : NS_DEFINE_NAMED_CID(NS_PRECONTENTITERATOR_CID);
699 : NS_DEFINE_NAMED_CID(NS_SUBTREEITERATOR_CID);
700 : NS_DEFINE_NAMED_CID(NS_HTMLIMAGEELEMENT_CID);
701 : NS_DEFINE_NAMED_CID(NS_HTMLOPTIONELEMENT_CID);
702 : #ifdef MOZ_MEDIA
703 : NS_DEFINE_NAMED_CID(NS_HTMLAUDIOELEMENT_CID);
704 : #endif
705 : NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXT2D_CID);
706 : NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXT2DTHEBES_CID);
707 : NS_DEFINE_NAMED_CID(NS_CANVASRENDERINGCONTEXTWEBGL_CID);
708 : NS_DEFINE_NAMED_CID(NS_TEXT_ENCODER_CID);
709 : NS_DEFINE_NAMED_CID(NS_HTMLCOPY_TEXT_ENCODER_CID);
710 : NS_DEFINE_NAMED_CID(NS_XMLCONTENTSERIALIZER_CID);
711 : NS_DEFINE_NAMED_CID(NS_XHTMLCONTENTSERIALIZER_CID);
712 : NS_DEFINE_NAMED_CID(NS_HTMLCONTENTSERIALIZER_CID);
713 : NS_DEFINE_NAMED_CID(NS_PLAINTEXTSERIALIZER_CID);
714 : NS_DEFINE_NAMED_CID(MOZ_SANITIZINGHTMLSERIALIZER_CID);
715 : NS_DEFINE_NAMED_CID(NS_PARSERUTILS_CID);
716 : NS_DEFINE_NAMED_CID(NS_SCRIPTABLEUNESCAPEHTML_CID);
717 : NS_DEFINE_NAMED_CID(NS_XBLSERVICE_CID);
718 : NS_DEFINE_NAMED_CID(NS_CONTENTPOLICY_CID);
719 : NS_DEFINE_NAMED_CID(NS_DATADOCUMENTCONTENTPOLICY_CID);
720 : NS_DEFINE_NAMED_CID(NS_NODATAPROTOCOLCONTENTPOLICY_CID);
721 : NS_DEFINE_NAMED_CID(NS_XULCONTROLLERS_CID);
722 : #ifdef MOZ_XUL
723 : NS_DEFINE_NAMED_CID(NS_XULSORTSERVICE_CID);
724 : NS_DEFINE_NAMED_CID(NS_XULTEMPLATEBUILDER_CID);
725 : NS_DEFINE_NAMED_CID(NS_XULTREEBUILDER_CID);
726 : NS_DEFINE_NAMED_CID(NS_XULDOCUMENT_CID);
727 : #endif
728 : #ifdef MOZ_XTF
729 : NS_DEFINE_NAMED_CID(NS_XTFSERVICE_CID);
730 : NS_DEFINE_NAMED_CID(NS_XMLCONTENTBUILDER_CID);
731 : #endif
732 : NS_DEFINE_NAMED_CID(NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID);
733 : NS_DEFINE_NAMED_CID(NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
734 : NS_DEFINE_NAMED_CID(NS_BASE_DOM_EXCEPTION_CID);
735 : NS_DEFINE_NAMED_CID(NS_JSPROTOCOLHANDLER_CID);
736 : NS_DEFINE_NAMED_CID(NS_JSURI_CID);
737 : NS_DEFINE_NAMED_CID(NS_WINDOWCOMMANDTABLE_CID);
738 : NS_DEFINE_NAMED_CID(NS_WINDOWCONTROLLER_CID);
739 : NS_DEFINE_NAMED_CID(NS_VIEW_MANAGER_CID);
740 : NS_DEFINE_NAMED_CID(NS_PLUGINDOCLOADERFACTORY_CID);
741 : NS_DEFINE_NAMED_CID(NS_PLUGINDOCUMENT_CID);
742 : #ifdef MOZ_MEDIA
743 : NS_DEFINE_NAMED_CID(NS_VIDEODOCUMENT_CID);
744 : #endif
745 : NS_DEFINE_NAMED_CID(NS_STYLESHEETSERVICE_CID);
746 : NS_DEFINE_NAMED_CID(TRANSFORMIIX_XSLT_PROCESSOR_CID);
747 : NS_DEFINE_NAMED_CID(TRANSFORMIIX_XPATH_EVALUATOR_CID);
748 : NS_DEFINE_NAMED_CID(TRANSFORMIIX_NODESET_CID);
749 : NS_DEFINE_NAMED_CID(NS_XMLSERIALIZER_CID);
750 : NS_DEFINE_NAMED_CID(NS_FILEREADER_CID);
751 : NS_DEFINE_NAMED_CID(NS_FORMDATA_CID);
752 : NS_DEFINE_NAMED_CID(NS_BLOBPROTOCOLHANDLER_CID);
753 : NS_DEFINE_NAMED_CID(NS_XMLHTTPREQUEST_CID);
754 : NS_DEFINE_NAMED_CID(NS_EVENTSOURCE_CID);
755 : NS_DEFINE_NAMED_CID(NS_WEBSOCKET_CID);
756 : NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
757 : NS_DEFINE_NAMED_CID(NS_DOMSTORAGE_CID);
758 : NS_DEFINE_NAMED_CID(NS_DOMSTORAGE2_CID);
759 : NS_DEFINE_NAMED_CID(NS_DOMSTORAGEMANAGER_CID);
760 : NS_DEFINE_NAMED_CID(NS_DOMJSON_CID);
761 : NS_DEFINE_NAMED_CID(NS_TEXTEDITOR_CID);
762 : NS_DEFINE_NAMED_CID(INDEXEDDB_MANAGER_CID);
763 : NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID);
764 : #ifdef MOZ_B2G_RIL
765 : NS_DEFINE_NAMED_CID(SYSTEMWORKERMANAGER_CID);
766 : #endif
767 : #ifdef MOZ_WIDGET_GONK
768 : NS_DEFINE_NAMED_CID(NS_AUDIOMANAGER_CID);
769 : #endif
770 : #ifdef ENABLE_EDITOR_API_LOG
771 : NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_CID);
772 : #else
773 : NS_DEFINE_NAMED_CID(NS_HTMLEDITOR_CID);
774 : #endif
775 : NS_DEFINE_NAMED_CID(NS_EDITORCONTROLLER_CID);
776 : NS_DEFINE_NAMED_CID(NS_EDITINGCONTROLLER_CID);
777 : NS_DEFINE_NAMED_CID(NS_EDITORCOMMANDTABLE_CID);
778 : NS_DEFINE_NAMED_CID(NS_EDITINGCOMMANDTABLE_CID);
779 : NS_DEFINE_NAMED_CID(NS_TEXTSERVICESDOCUMENT_CID);
780 : NS_DEFINE_NAMED_CID(NS_GEOLOCATION_SERVICE_CID);
781 : NS_DEFINE_NAMED_CID(NS_GEOLOCATION_CID);
782 : NS_DEFINE_NAMED_CID(NS_FOCUSMANAGER_CID);
783 : NS_DEFINE_NAMED_CID(CSPSERVICE_CID);
784 : NS_DEFINE_NAMED_CID(NS_EVENTLISTENERSERVICE_CID);
785 : NS_DEFINE_NAMED_CID(NS_GLOBALMESSAGEMANAGER_CID);
786 : NS_DEFINE_NAMED_CID(NS_PARENTPROCESSMESSAGEMANAGER_CID);
787 : NS_DEFINE_NAMED_CID(NS_CHILDPROCESSMESSAGEMANAGER_CID);
788 : NS_DEFINE_NAMED_CID(NSCHANNELPOLICY_CID);
789 : NS_DEFINE_NAMED_CID(NS_SCRIPTSECURITYMANAGER_CID);
790 : NS_DEFINE_NAMED_CID(NS_PRINCIPAL_CID);
791 : NS_DEFINE_NAMED_CID(NS_SYSTEMPRINCIPAL_CID);
792 : NS_DEFINE_NAMED_CID(NS_NULLPRINCIPAL_CID);
793 : NS_DEFINE_NAMED_CID(NS_SECURITYNAMESET_CID);
794 : NS_DEFINE_NAMED_CID(THIRDPARTYUTIL_CID);
795 : NS_DEFINE_NAMED_CID(NS_STRUCTUREDCLONECONTAINER_CID);
796 :
797 : #ifndef MOZ_WIDGET_GONK
798 : #if defined(XP_UNIX) || \
799 : defined(_WINDOWS) || \
800 : defined(machintosh) || \
801 : defined(android)
802 : NS_DEFINE_NAMED_CID(NS_DEVICE_MOTION_CID);
803 : #endif
804 : #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
805 : NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID);
806 : #endif
807 : #endif
808 : NS_DEFINE_NAMED_CID(SMS_SERVICE_CID);
809 : NS_DEFINE_NAMED_CID(SMS_DATABASE_SERVICE_CID);
810 : NS_DEFINE_NAMED_CID(SMS_REQUEST_MANAGER_CID);
811 : NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
812 :
813 : static nsresult
814 0 : CreateWindowCommandTableConstructor(nsISupports *aOuter,
815 : REFNSIID aIID, void **aResult)
816 : {
817 : nsresult rv;
818 : nsCOMPtr<nsIControllerCommandTable> commandTable =
819 0 : do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
820 0 : if (NS_FAILED(rv)) return rv;
821 :
822 0 : rv = nsWindowCommandRegistration::RegisterWindowCommands(commandTable);
823 0 : if (NS_FAILED(rv)) return rv;
824 :
825 0 : return commandTable->QueryInterface(aIID, aResult);
826 : }
827 :
828 : static nsresult
829 0 : CreateWindowControllerWithSingletonCommandTable(nsISupports *aOuter,
830 : REFNSIID aIID, void **aResult)
831 : {
832 : nsresult rv;
833 : nsCOMPtr<nsIController> controller =
834 0 : do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
835 :
836 0 : if (NS_FAILED(rv)) return rv;
837 :
838 0 : nsCOMPtr<nsIControllerCommandTable> windowCommandTable = do_GetService(kNS_WINDOWCOMMANDTABLE_CID, &rv);
839 0 : if (NS_FAILED(rv)) return rv;
840 :
841 : // this is a singleton; make it immutable
842 0 : windowCommandTable->MakeImmutable();
843 :
844 0 : nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
845 0 : if (NS_FAILED(rv)) return rv;
846 :
847 0 : controllerContext->Init(windowCommandTable);
848 0 : if (NS_FAILED(rv)) return rv;
849 :
850 0 : return controller->QueryInterface(aIID, aResult);
851 : }
852 :
853 : // Constructor of a controller which is set up to use, internally, a
854 : // singleton command-table pre-filled with editor commands.
855 : static nsresult
856 0 : nsEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
857 : void **aResult)
858 : {
859 : nsresult rv;
860 0 : nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
861 0 : if (NS_FAILED(rv)) return rv;
862 :
863 0 : nsCOMPtr<nsIControllerCommandTable> editorCommandTable = do_GetService(kNS_EDITORCOMMANDTABLE_CID, &rv);
864 0 : if (NS_FAILED(rv)) return rv;
865 :
866 : // this guy is a singleton, so make it immutable
867 0 : editorCommandTable->MakeImmutable();
868 :
869 0 : nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
870 0 : if (NS_FAILED(rv)) return rv;
871 :
872 0 : rv = controllerContext->Init(editorCommandTable);
873 0 : if (NS_FAILED(rv)) return rv;
874 :
875 0 : return controller->QueryInterface(aIID, aResult);
876 : }
877 :
878 : // Constructor of a controller which is set up to use, internally, a
879 : // singleton command-table pre-filled with editing commands.
880 : static nsresult
881 0 : nsEditingControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
882 : void **aResult)
883 : {
884 : nsresult rv;
885 0 : nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
886 0 : if (NS_FAILED(rv)) return rv;
887 :
888 0 : nsCOMPtr<nsIControllerCommandTable> editingCommandTable = do_GetService(kNS_EDITINGCOMMANDTABLE_CID, &rv);
889 0 : if (NS_FAILED(rv)) return rv;
890 :
891 : // this guy is a singleton, so make it immutable
892 0 : editingCommandTable->MakeImmutable();
893 :
894 0 : nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
895 0 : if (NS_FAILED(rv)) return rv;
896 :
897 0 : rv = controllerContext->Init(editingCommandTable);
898 0 : if (NS_FAILED(rv)) return rv;
899 :
900 0 : return controller->QueryInterface(aIID, aResult);
901 : }
902 :
903 : // Constructor for a command-table pre-filled with editor commands
904 : static nsresult
905 0 : nsEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
906 : void **aResult)
907 : {
908 : nsresult rv;
909 : nsCOMPtr<nsIControllerCommandTable> commandTable =
910 0 : do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
911 0 : if (NS_FAILED(rv)) return rv;
912 :
913 0 : rv = nsEditorController::RegisterEditorCommands(commandTable);
914 0 : if (NS_FAILED(rv)) return rv;
915 :
916 : // we don't know here whether we're being created as an instance,
917 : // or a service, so we can't become immutable
918 :
919 0 : return commandTable->QueryInterface(aIID, aResult);
920 : }
921 :
922 : // Constructor for a command-table pre-filled with editing commands
923 : static nsresult
924 0 : nsEditingCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
925 : void **aResult)
926 : {
927 : nsresult rv;
928 : nsCOMPtr<nsIControllerCommandTable> commandTable =
929 0 : do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
930 0 : if (NS_FAILED(rv)) return rv;
931 :
932 0 : rv = nsEditorController::RegisterEditingCommands(commandTable);
933 0 : if (NS_FAILED(rv)) return rv;
934 :
935 : // we don't know here whether we're being created as an instance,
936 : // or a service, so we can't become immutable
937 :
938 0 : return commandTable->QueryInterface(aIID, aResult);
939 : }
940 :
941 :
942 : static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
943 : XPCONNECT_CIDENTRIES
944 : #ifdef DEBUG
945 : { &kNS_FRAME_UTIL_CID, false, NULL, CreateNewFrameUtil },
946 : { &kNS_LAYOUT_DEBUGGER_CID, false, NULL, CreateNewLayoutDebugger },
947 : #endif
948 : { &kNS_FRAMETRAVERSAL_CID, false, NULL, CreateNewFrameTraversal },
949 : { &kNS_PRESSHELL_CID, false, NULL, CreateNewPresShell },
950 : { &kNS_BOXOBJECT_CID, false, NULL, CreateNewBoxObject },
951 : #ifdef MOZ_XUL
952 : { &kNS_LISTBOXOBJECT_CID, false, NULL, CreateNewListBoxObject },
953 : { &kNS_MENUBOXOBJECT_CID, false, NULL, CreateNewMenuBoxObject },
954 : { &kNS_POPUPBOXOBJECT_CID, false, NULL, CreateNewPopupBoxObject },
955 : { &kNS_CONTAINERBOXOBJECT_CID, false, NULL, CreateNewContainerBoxObject },
956 : { &kNS_SCROLLBOXOBJECT_CID, false, NULL, CreateNewScrollBoxObject },
957 : { &kNS_TREEBOXOBJECT_CID, false, NULL, CreateNewTreeBoxObject },
958 : #endif // MOZ_XUL
959 : #ifdef MOZ_XUL
960 : { &kIN_DOMVIEW_CID, false, NULL, inDOMViewConstructor },
961 : #endif
962 : { &kIN_DEEPTREEWALKER_CID, false, NULL, inDeepTreeWalkerConstructor },
963 : { &kIN_FLASHER_CID, false, NULL, inFlasherConstructor },
964 : { &kIN_CSSVALUESEARCH_CID, false, NULL, inCSSValueSearchConstructor },
965 : { &kIN_DOMUTILS_CID, false, NULL, inDOMUtilsConstructor },
966 : { &kNS_NAMESPACEMANAGER_CID, false, NULL, CreateNameSpaceManager },
967 : { &kNS_CONTENT_VIEWER_CID, false, NULL, CreateContentViewer },
968 : { &kNS_HTMLDOCUMENT_CID, false, NULL, CreateHTMLDocument },
969 : { &kNS_XMLDOCUMENT_CID, false, NULL, CreateXMLDocument },
970 : { &kNS_SVGDOCUMENT_CID, false, NULL, CreateSVGDocument },
971 : { &kNS_IMAGEDOCUMENT_CID, false, NULL, CreateImageDocument },
972 : { &kNS_DOMSELECTION_CID, false, NULL, CreateDOMSelection },
973 : { &kNS_CONTENTITERATOR_CID, false, NULL, CreateContentIterator },
974 : { &kNS_PRECONTENTITERATOR_CID, false, NULL, CreatePreContentIterator },
975 : { &kNS_SUBTREEITERATOR_CID, false, NULL, CreateSubtreeIterator },
976 : { &kNS_HTMLIMAGEELEMENT_CID, false, NULL, CreateHTMLImgElement },
977 : { &kNS_HTMLOPTIONELEMENT_CID, false, NULL, CreateHTMLOptionElement },
978 : #ifdef MOZ_MEDIA
979 : { &kNS_HTMLAUDIOELEMENT_CID, false, NULL, CreateHTMLAudioElement },
980 : #endif
981 : { &kNS_CANVASRENDERINGCONTEXT2DTHEBES_CID, false, NULL, CreateCanvasRenderingContext2DThebes },
982 : { &kNS_CANVASRENDERINGCONTEXT2D_CID, false, NULL, CreateCanvasRenderingContext2D },
983 : { &kNS_CANVASRENDERINGCONTEXTWEBGL_CID, false, NULL, CreateCanvasRenderingContextWebGL },
984 : { &kNS_TEXT_ENCODER_CID, false, NULL, CreateTextEncoder },
985 : { &kNS_HTMLCOPY_TEXT_ENCODER_CID, false, NULL, CreateHTMLCopyTextEncoder },
986 : { &kNS_XMLCONTENTSERIALIZER_CID, false, NULL, CreateXMLContentSerializer },
987 : { &kNS_HTMLCONTENTSERIALIZER_CID, false, NULL, CreateHTMLContentSerializer },
988 : { &kNS_XHTMLCONTENTSERIALIZER_CID, false, NULL, CreateXHTMLContentSerializer },
989 : { &kNS_PLAINTEXTSERIALIZER_CID, false, NULL, CreatePlainTextSerializer },
990 : { &kMOZ_SANITIZINGHTMLSERIALIZER_CID, false, NULL, CreateSanitizingHTMLSerializer },
991 : { &kNS_PARSERUTILS_CID, false, NULL, nsParserUtilsConstructor },
992 : { &kNS_SCRIPTABLEUNESCAPEHTML_CID, false, NULL, nsParserUtilsConstructor },
993 : { &kNS_XBLSERVICE_CID, false, NULL, CreateXBLService },
994 : { &kNS_CONTENTPOLICY_CID, false, NULL, CreateContentPolicy },
995 : { &kNS_DATADOCUMENTCONTENTPOLICY_CID, false, NULL, nsDataDocumentContentPolicyConstructor },
996 : { &kNS_NODATAPROTOCOLCONTENTPOLICY_CID, false, NULL, nsNoDataProtocolContentPolicyConstructor },
997 : { &kNS_XULCONTROLLERS_CID, false, NULL, NS_NewXULControllers },
998 : #ifdef MOZ_XUL
999 : { &kNS_XULSORTSERVICE_CID, false, NULL, CreateXULSortService },
1000 : { &kNS_XULTEMPLATEBUILDER_CID, false, NULL, NS_NewXULContentBuilder },
1001 : { &kNS_XULTREEBUILDER_CID, false, NULL, NS_NewXULTreeBuilder },
1002 : { &kNS_XULDOCUMENT_CID, false, NULL, CreateXULDocument },
1003 : #endif
1004 : #ifdef MOZ_XTF
1005 : { &kNS_XTFSERVICE_CID, false, NULL, CreateXTFService },
1006 : { &kNS_XMLCONTENTBUILDER_CID, false, NULL, CreateXMLContentBuilder },
1007 : #endif
1008 : { &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID, false, NULL, CreateContentDLF },
1009 : { &kNS_DOM_SCRIPT_OBJECT_FACTORY_CID, false, NULL, nsDOMScriptObjectFactoryConstructor },
1010 : { &kNS_BASE_DOM_EXCEPTION_CID, false, NULL, nsBaseDOMExceptionConstructor },
1011 : { &kNS_JSPROTOCOLHANDLER_CID, false, NULL, nsJSProtocolHandler::Create },
1012 : { &kNS_JSURI_CID, false, NULL, nsJSURIConstructor },
1013 : { &kNS_WINDOWCOMMANDTABLE_CID, false, NULL, CreateWindowCommandTableConstructor },
1014 : { &kNS_WINDOWCONTROLLER_CID, false, NULL, CreateWindowControllerWithSingletonCommandTable },
1015 : { &kNS_VIEW_MANAGER_CID, false, NULL, nsViewManagerConstructor },
1016 : { &kNS_PLUGINDOCLOADERFACTORY_CID, false, NULL, CreateContentDLF },
1017 : { &kNS_PLUGINDOCUMENT_CID, false, NULL, CreatePluginDocument },
1018 : #ifdef MOZ_MEDIA
1019 : { &kNS_VIDEODOCUMENT_CID, false, NULL, CreateVideoDocument },
1020 : #endif
1021 : { &kNS_STYLESHEETSERVICE_CID, false, NULL, nsStyleSheetServiceConstructor },
1022 : { &kTRANSFORMIIX_XSLT_PROCESSOR_CID, false, NULL, txMozillaXSLTProcessorConstructor },
1023 : { &kTRANSFORMIIX_XPATH_EVALUATOR_CID, false, NULL, nsXPathEvaluatorConstructor },
1024 : { &kTRANSFORMIIX_NODESET_CID, false, NULL, txNodeSetAdaptorConstructor },
1025 : { &kNS_XMLSERIALIZER_CID, false, NULL, nsDOMSerializerConstructor },
1026 : { &kNS_FILEREADER_CID, false, NULL, nsDOMFileReaderConstructor },
1027 : { &kNS_FORMDATA_CID, false, NULL, nsFormDataConstructor },
1028 : { &kNS_BLOBPROTOCOLHANDLER_CID, false, NULL, nsBlobProtocolHandlerConstructor },
1029 : { &kNS_XMLHTTPREQUEST_CID, false, NULL, nsXMLHttpRequestConstructor },
1030 : { &kNS_EVENTSOURCE_CID, false, NULL, nsEventSourceConstructor },
1031 : { &kNS_WEBSOCKET_CID, false, NULL, nsWebSocketConstructor },
1032 : { &kNS_DOMPARSER_CID, false, NULL, nsDOMParserConstructor },
1033 : { &kNS_DOMSTORAGE_CID, false, NULL, NS_NewDOMStorage },
1034 : { &kNS_DOMSTORAGE2_CID, false, NULL, NS_NewDOMStorage2 },
1035 : { &kNS_DOMSTORAGEMANAGER_CID, false, NULL, nsDOMStorageManagerConstructor },
1036 : { &kNS_DOMJSON_CID, false, NULL, NS_NewJSON },
1037 : { &kNS_TEXTEDITOR_CID, false, NULL, nsPlaintextEditorConstructor },
1038 : { &kINDEXEDDB_MANAGER_CID, false, NULL, IndexedDatabaseManagerConstructor },
1039 : { &kDOMREQUEST_SERVICE_CID, false, NULL, DOMRequestServiceConstructor },
1040 : #ifdef MOZ_B2G_RIL
1041 : { &kSYSTEMWORKERMANAGER_CID, true, NULL, SystemWorkerManagerConstructor },
1042 : #endif
1043 : #ifdef MOZ_WIDGET_GONK
1044 : { &kNS_AUDIOMANAGER_CID, true, NULL, AudioManagerConstructor },
1045 : #endif
1046 : #ifdef ENABLE_EDITOR_API_LOG
1047 : { &kNS_HTMLEDITOR_CID, false, NULL, nsHTMLEditorLogConstructor },
1048 : #else
1049 : { &kNS_HTMLEDITOR_CID, false, NULL, nsHTMLEditorConstructor },
1050 : #endif
1051 : { &kNS_EDITORCONTROLLER_CID, false, NULL, nsEditorControllerConstructor },
1052 : { &kNS_EDITINGCONTROLLER_CID, false, NULL, nsEditingControllerConstructor },
1053 : { &kNS_EDITORCOMMANDTABLE_CID, false, NULL, nsEditorCommandTableConstructor },
1054 : { &kNS_EDITINGCOMMANDTABLE_CID, false, NULL, nsEditingCommandTableConstructor },
1055 : { &kNS_TEXTSERVICESDOCUMENT_CID, false, NULL, nsTextServicesDocumentConstructor },
1056 : { &kNS_GEOLOCATION_SERVICE_CID, false, NULL, nsGeolocationServiceConstructor },
1057 : { &kNS_GEOLOCATION_CID, false, NULL, nsGeolocationConstructor },
1058 : { &kNS_FOCUSMANAGER_CID, false, NULL, CreateFocusManager },
1059 : { &kCSPSERVICE_CID, false, NULL, CSPServiceConstructor },
1060 : { &kNS_EVENTLISTENERSERVICE_CID, false, NULL, CreateEventListenerService },
1061 : { &kNS_GLOBALMESSAGEMANAGER_CID, false, NULL, CreateGlobalMessageManager },
1062 : { &kNS_PARENTPROCESSMESSAGEMANAGER_CID, false, NULL, CreateParentMessageManager },
1063 : { &kNS_CHILDPROCESSMESSAGEMANAGER_CID, false, NULL, CreateChildMessageManager },
1064 : { &kNSCHANNELPOLICY_CID, false, NULL, nsChannelPolicyConstructor },
1065 : { &kNS_SCRIPTSECURITYMANAGER_CID, false, NULL, Construct_nsIScriptSecurityManager },
1066 : { &kNS_PRINCIPAL_CID, false, NULL, nsPrincipalConstructor },
1067 : { &kNS_SYSTEMPRINCIPAL_CID, false, NULL, nsSystemPrincipalConstructor },
1068 : { &kNS_NULLPRINCIPAL_CID, false, NULL, nsNullPrincipalConstructor },
1069 : { &kNS_SECURITYNAMESET_CID, false, NULL, nsSecurityNameSetConstructor },
1070 : #ifndef MOZ_WIDGET_GONK
1071 : #if defined(XP_UNIX) || \
1072 : defined(_WINDOWS) || \
1073 : defined(machintosh) || \
1074 : defined(android)
1075 : { &kNS_DEVICE_MOTION_CID, false, NULL, nsDeviceMotionSystemConstructor },
1076 : #endif
1077 : #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
1078 : { &kNS_HAPTICFEEDBACK_CID, false, NULL, nsHapticFeedbackConstructor },
1079 : #endif
1080 : #endif
1081 : { &kTHIRDPARTYUTIL_CID, false, NULL, ThirdPartyUtilConstructor },
1082 : { &kNS_STRUCTUREDCLONECONTAINER_CID, false, NULL, nsStructuredCloneContainerConstructor },
1083 : { &kSMS_SERVICE_CID, false, NULL, nsISmsServiceConstructor },
1084 : { &kSMS_DATABASE_SERVICE_CID, false, NULL, nsISmsDatabaseServiceConstructor },
1085 : { &kSMS_REQUEST_MANAGER_CID, false, NULL, SmsRequestManagerConstructor },
1086 : { &kNS_POWERMANAGERSERVICE_CID, false, NULL, nsIPowerManagerServiceConstructor },
1087 : { NULL }
1088 : };
1089 :
1090 : static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
1091 : XPCONNECT_CONTRACTS
1092 : { "@mozilla.org/layout/xul-boxobject;1", &kNS_BOXOBJECT_CID },
1093 : #ifdef MOZ_XUL
1094 : { "@mozilla.org/layout/xul-boxobject-listbox;1", &kNS_LISTBOXOBJECT_CID },
1095 : { "@mozilla.org/layout/xul-boxobject-menu;1", &kNS_MENUBOXOBJECT_CID },
1096 : { "@mozilla.org/layout/xul-boxobject-popup;1", &kNS_POPUPBOXOBJECT_CID },
1097 : { "@mozilla.org/layout/xul-boxobject-container;1", &kNS_CONTAINERBOXOBJECT_CID },
1098 : { "@mozilla.org/layout/xul-boxobject-scrollbox;1", &kNS_SCROLLBOXOBJECT_CID },
1099 : { "@mozilla.org/layout/xul-boxobject-tree;1", &kNS_TREEBOXOBJECT_CID },
1100 : #endif // MOZ_XUL
1101 : #ifdef MOZ_XUL
1102 : { "@mozilla.org/inspector/dom-view;1", &kIN_DOMVIEW_CID },
1103 : #endif
1104 : { "@mozilla.org/inspector/deep-tree-walker;1", &kIN_DEEPTREEWALKER_CID },
1105 : { "@mozilla.org/inspector/flasher;1", &kIN_FLASHER_CID },
1106 : { "@mozilla.org/inspector/search;1?type=cssvalue", &kIN_CSSVALUESEARCH_CID },
1107 : { "@mozilla.org/inspector/dom-utils;1", &kIN_DOMUTILS_CID },
1108 : { NS_NAMESPACEMANAGER_CONTRACTID, &kNS_NAMESPACEMANAGER_CID },
1109 : { "@mozilla.org/xml/xml-document;1", &kNS_XMLDOCUMENT_CID },
1110 : { "@mozilla.org/svg/svg-document;1", &kNS_SVGDOCUMENT_CID },
1111 : { "@mozilla.org/content/dom-selection;1", &kNS_DOMSELECTION_CID },
1112 : { "@mozilla.org/content/post-content-iterator;1", &kNS_CONTENTITERATOR_CID },
1113 : { "@mozilla.org/content/pre-content-iterator;1", &kNS_PRECONTENTITERATOR_CID },
1114 : { "@mozilla.org/content/subtree-content-iterator;1", &kNS_SUBTREEITERATOR_CID },
1115 : { NS_HTMLIMGELEMENT_CONTRACTID, &kNS_HTMLIMAGEELEMENT_CID },
1116 : { NS_HTMLOPTIONELEMENT_CONTRACTID, &kNS_HTMLOPTIONELEMENT_CID },
1117 : #ifdef MOZ_MEDIA
1118 : { NS_HTMLAUDIOELEMENT_CONTRACTID, &kNS_HTMLAUDIOELEMENT_CID },
1119 : #endif
1120 : { "@mozilla.org/content/canvas-rendering-context;1?id=2d", &kNS_CANVASRENDERINGCONTEXT2D_CID },
1121 : { "@mozilla.org/content/2dthebes-canvas-rendering-context;1", &kNS_CANVASRENDERINGCONTEXT2DTHEBES_CID },
1122 : { "@mozilla.org/content/canvas-rendering-context;1?id=moz-webgl", &kNS_CANVASRENDERINGCONTEXTWEBGL_CID },
1123 : { "@mozilla.org/content/canvas-rendering-context;1?id=experimental-webgl", &kNS_CANVASRENDERINGCONTEXTWEBGL_CID },
1124 : { NS_DOC_ENCODER_CONTRACTID_BASE "text/xml", &kNS_TEXT_ENCODER_CID },
1125 : { NS_DOC_ENCODER_CONTRACTID_BASE "application/xml", &kNS_TEXT_ENCODER_CID },
1126 : { NS_DOC_ENCODER_CONTRACTID_BASE "application/xhtml+xml", &kNS_TEXT_ENCODER_CID },
1127 : { NS_DOC_ENCODER_CONTRACTID_BASE "image/svg+xml", &kNS_TEXT_ENCODER_CID },
1128 : { NS_DOC_ENCODER_CONTRACTID_BASE "text/html", &kNS_TEXT_ENCODER_CID },
1129 : { NS_DOC_ENCODER_CONTRACTID_BASE "text/plain", &kNS_TEXT_ENCODER_CID },
1130 : { NS_HTMLCOPY_ENCODER_CONTRACTID, &kNS_HTMLCOPY_TEXT_ENCODER_CID },
1131 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml", &kNS_XMLCONTENTSERIALIZER_CID },
1132 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml", &kNS_XMLCONTENTSERIALIZER_CID },
1133 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml", &kNS_XHTMLCONTENTSERIALIZER_CID },
1134 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml", &kNS_XMLCONTENTSERIALIZER_CID },
1135 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html", &kNS_HTMLCONTENTSERIALIZER_CID },
1136 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml", &kNS_XMLCONTENTSERIALIZER_CID },
1137 : { NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain", &kNS_PLAINTEXTSERIALIZER_CID },
1138 : { MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID, &kMOZ_SANITIZINGHTMLSERIALIZER_CID },
1139 : { NS_PARSERUTILS_CONTRACTID, &kNS_PARSERUTILS_CID },
1140 : { NS_SCRIPTABLEUNESCAPEHTML_CONTRACTID, &kNS_SCRIPTABLEUNESCAPEHTML_CID },
1141 : { "@mozilla.org/xbl;1", &kNS_XBLSERVICE_CID },
1142 : { NS_CONTENTPOLICY_CONTRACTID, &kNS_CONTENTPOLICY_CID },
1143 : { NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, &kNS_DATADOCUMENTCONTENTPOLICY_CID },
1144 : { NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, &kNS_NODATAPROTOCOLCONTENTPOLICY_CID },
1145 : { "@mozilla.org/xul/xul-controllers;1", &kNS_XULCONTROLLERS_CID },
1146 : #ifdef MOZ_XUL
1147 : { "@mozilla.org/xul/xul-sort-service;1", &kNS_XULSORTSERVICE_CID },
1148 : { "@mozilla.org/xul/xul-template-builder;1", &kNS_XULTEMPLATEBUILDER_CID },
1149 : { "@mozilla.org/xul/xul-tree-builder;1", &kNS_XULTREEBUILDER_CID },
1150 : { "@mozilla.org/xul/xul-document;1", &kNS_XULDOCUMENT_CID },
1151 : #endif
1152 : #ifdef MOZ_XTF
1153 : { NS_XTFSERVICE_CONTRACTID, &kNS_XTFSERVICE_CID },
1154 : { NS_XMLCONTENTBUILDER_CONTRACTID, &kNS_XMLCONTENTBUILDER_CID },
1155 : #endif
1156 : { CONTENT_DLF_CONTRACTID, &kNS_CONTENT_DOCUMENT_LOADER_FACTORY_CID },
1157 : { NS_JSPROTOCOLHANDLER_CONTRACTID, &kNS_JSPROTOCOLHANDLER_CID },
1158 : { NS_WINDOWCONTROLLER_CONTRACTID, &kNS_WINDOWCONTROLLER_CID },
1159 : { "@mozilla.org/view-manager;1", &kNS_VIEW_MANAGER_CID },
1160 : { PLUGIN_DLF_CONTRACTID, &kNS_PLUGINDOCLOADERFACTORY_CID },
1161 : { NS_STYLESHEETSERVICE_CONTRACTID, &kNS_STYLESHEETSERVICE_CID },
1162 : { TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID, &kTRANSFORMIIX_XSLT_PROCESSOR_CID },
1163 : { NS_XPATH_EVALUATOR_CONTRACTID, &kTRANSFORMIIX_XPATH_EVALUATOR_CID },
1164 : { TRANSFORMIIX_NODESET_CONTRACTID, &kTRANSFORMIIX_NODESET_CID },
1165 : { NS_XMLSERIALIZER_CONTRACTID, &kNS_XMLSERIALIZER_CID },
1166 : { NS_FILEREADER_CONTRACTID, &kNS_FILEREADER_CID },
1167 : { NS_FORMDATA_CONTRACTID, &kNS_FORMDATA_CID },
1168 : { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX BLOBURI_SCHEME, &kNS_BLOBPROTOCOLHANDLER_CID },
1169 : { NS_XMLHTTPREQUEST_CONTRACTID, &kNS_XMLHTTPREQUEST_CID },
1170 : { NS_EVENTSOURCE_CONTRACTID, &kNS_EVENTSOURCE_CID },
1171 : { NS_WEBSOCKET_CONTRACTID, &kNS_WEBSOCKET_CID },
1172 : { NS_DOMPARSER_CONTRACTID, &kNS_DOMPARSER_CID },
1173 : { "@mozilla.org/dom/storage;1", &kNS_DOMSTORAGE_CID },
1174 : { "@mozilla.org/dom/storage;2", &kNS_DOMSTORAGE2_CID },
1175 : { "@mozilla.org/dom/storagemanager;1", &kNS_DOMSTORAGEMANAGER_CID },
1176 : { "@mozilla.org/dom/json;1", &kNS_DOMJSON_CID },
1177 : { "@mozilla.org/editor/texteditor;1", &kNS_TEXTEDITOR_CID },
1178 : { INDEXEDDB_MANAGER_CONTRACTID, &kINDEXEDDB_MANAGER_CID },
1179 : { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID },
1180 : #ifdef MOZ_B2G_RIL
1181 : { SYSTEMWORKERMANAGER_CONTRACTID, &kSYSTEMWORKERMANAGER_CID },
1182 : #endif
1183 : #ifdef MOZ_WIDGET_GONK
1184 : { NS_AUDIOMANAGER_CONTRACTID, &kNS_AUDIOMANAGER_CID },
1185 : #endif
1186 : #ifdef ENABLE_EDITOR_API_LOG
1187 : { "@mozilla.org/editor/htmleditor;1", &kNS_HTMLEDITOR_CID },
1188 : #else
1189 : { "@mozilla.org/editor/htmleditor;1", &kNS_HTMLEDITOR_CID },
1190 : #endif
1191 : { "@mozilla.org/editor/editorcontroller;1", &kNS_EDITORCONTROLLER_CID },
1192 : { "@mozilla.org/editor/editingcontroller;1", &kNS_EDITINGCONTROLLER_CID },
1193 : { "@mozilla.org/textservices/textservicesdocument;1", &kNS_TEXTSERVICESDOCUMENT_CID },
1194 : { "@mozilla.org/geolocation/service;1", &kNS_GEOLOCATION_SERVICE_CID },
1195 : { "@mozilla.org/geolocation;1", &kNS_GEOLOCATION_CID },
1196 : { "@mozilla.org/focus-manager;1", &kNS_FOCUSMANAGER_CID },
1197 : { CSPSERVICE_CONTRACTID, &kCSPSERVICE_CID },
1198 : { NS_EVENTLISTENERSERVICE_CONTRACTID, &kNS_EVENTLISTENERSERVICE_CID },
1199 : { NS_GLOBALMESSAGEMANAGER_CONTRACTID, &kNS_GLOBALMESSAGEMANAGER_CID },
1200 : { NS_PARENTPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_PARENTPROCESSMESSAGEMANAGER_CID },
1201 : { NS_CHILDPROCESSMESSAGEMANAGER_CONTRACTID, &kNS_CHILDPROCESSMESSAGEMANAGER_CID },
1202 : { NSCHANNELPOLICY_CONTRACTID, &kNSCHANNELPOLICY_CID },
1203 : { NS_SCRIPTSECURITYMANAGER_CONTRACTID, &kNS_SCRIPTSECURITYMANAGER_CID },
1204 : { NS_GLOBAL_CHANNELEVENTSINK_CONTRACTID, &kNS_SCRIPTSECURITYMANAGER_CID },
1205 : { NS_PRINCIPAL_CONTRACTID, &kNS_PRINCIPAL_CID },
1206 : { NS_SYSTEMPRINCIPAL_CONTRACTID, &kNS_SYSTEMPRINCIPAL_CID },
1207 : { NS_NULLPRINCIPAL_CONTRACTID, &kNS_NULLPRINCIPAL_CID },
1208 : { NS_SECURITYNAMESET_CONTRACTID, &kNS_SECURITYNAMESET_CID },
1209 : #ifndef MOZ_WIDGET_GONK
1210 : #if defined(XP_UNIX) || \
1211 : defined(_WINDOWS) || \
1212 : defined(machintosh) || \
1213 : defined(android)
1214 : { NS_DEVICE_MOTION_CONTRACTID, &kNS_DEVICE_MOTION_CID },
1215 : #endif
1216 : #if defined(ANDROID) || defined(MOZ_PLATFORM_MAEMO)
1217 : { "@mozilla.org/widget/hapticfeedback;1", &kNS_HAPTICFEEDBACK_CID },
1218 : #endif
1219 : #endif
1220 : { THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID },
1221 : { NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID },
1222 : { SMS_SERVICE_CONTRACTID, &kSMS_SERVICE_CID },
1223 : { SMS_DATABASE_SERVICE_CONTRACTID, &kSMS_DATABASE_SERVICE_CID },
1224 : { SMS_REQUEST_MANAGER_CONTRACTID, &kSMS_REQUEST_MANAGER_CID },
1225 : { POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID },
1226 : { NULL }
1227 : };
1228 :
1229 : static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
1230 : XPCONNECT_CATEGORIES
1231 : { JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY, "Image", NS_HTMLIMGELEMENT_CONTRACTID },
1232 : { JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY, "Image", "HTMLImageElement" },
1233 : { JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY, "Option", NS_HTMLOPTIONELEMENT_CONTRACTID },
1234 : { JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY, "Option", "HTMLOptionElement" },
1235 : #ifdef MOZ_MEDIA
1236 : { JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY, "Audio", NS_HTMLAUDIOELEMENT_CONTRACTID },
1237 : { JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY, "Audio", "HTMLAudioElement" },
1238 : #endif
1239 : { "content-policy", NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID, NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID },
1240 : { "content-policy", NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID, NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID },
1241 : { "content-policy", "CSPService", CSPSERVICE_CONTRACTID },
1242 : { "net-channel-event-sinks", "CSPService", CSPSERVICE_CONTRACTID },
1243 : { JAVASCRIPT_GLOBAL_STATIC_NAMESET_CATEGORY, "PrivilegeManager", NS_SECURITYNAMESET_CONTRACTID },
1244 : { "app-startup", "Script Security Manager", "service," NS_SCRIPTSECURITYMANAGER_CONTRACTID },
1245 : CONTENTDLF_CATEGORIES
1246 : #ifdef MOZ_B2G_RIL
1247 : { "profile-after-change", "Telephony System Worker Manager", SYSTEMWORKERMANAGER_CONTRACTID },
1248 : #endif
1249 : { NULL }
1250 : };
1251 :
1252 : static void
1253 1404 : LayoutModuleDtor()
1254 : {
1255 1404 : xpcModuleDtor();
1256 :
1257 1404 : nsScriptSecurityManager::Shutdown();
1258 1404 : }
1259 :
1260 : static const mozilla::Module kLayoutModule = {
1261 : mozilla::Module::kVersion,
1262 : kLayoutCIDs,
1263 : kLayoutContracts,
1264 : kLayoutCategories,
1265 : NULL,
1266 : Initialize,
1267 : LayoutModuleDtor
1268 : };
1269 :
1270 : NSMODULE_DEFN(nsLayoutModule) = &kLayoutModule;
|