Bug 449371 Firefox/Thunderbird crashes at exit [@ gdk_display_x11_finalize], p=Brian...
[wine-gecko.git] / layout / build / nsLayoutModule.cpp
blobaaef21d948b495d86b681b1b94760376a18b61f7
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
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/
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.
15 * The Original Code is Mozilla Communicator client code.
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.
22 * Contributor(s):
23 * Pierre Phaneuf <pp@ludusdesign.com>
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.
37 * ***** END LICENSE BLOCK ***** */
39 #include "nsLayoutStatics.h"
40 #include "nsContentCID.h"
41 #include "nsContentDLF.h"
42 #include "nsContentPolicyUtils.h"
43 #include "nsDataDocumentContentPolicy.h"
44 #include "nsNoDataProtocolContentPolicy.h"
45 #include "nsDOMCID.h"
46 #include "nsCSSOMFactory.h"
47 #include "nsInspectorCSSUtils.h"
48 #include "nsHTMLContentSerializer.h"
49 #include "nsHTMLParts.h"
50 #include "nsGenericHTMLElement.h"
51 #include "nsICSSLoader.h"
52 #include "nsICSSParser.h"
53 #include "nsICSSStyleSheet.h"
54 #include "nsICategoryManager.h"
55 #include "nsIComponentManager.h"
56 #include "nsIComputedDOMStyle.h"
57 #include "nsIContentIterator.h"
58 #include "nsIContentSerializer.h"
59 #include "nsIController.h"
60 #include "nsIControllers.h"
61 #include "nsIDOMDOMImplementation.h"
62 #include "nsIDOMEventGroup.h"
63 #include "nsIDOMRange.h"
64 #include "nsIDocument.h"
65 #include "nsIDocumentEncoder.h"
66 #include "nsIDocumentViewer.h"
67 #include "nsIEventListenerManager.h"
68 #include "nsIFactory.h"
69 #include "nsFrameSelection.h"
70 #include "nsIFrameUtil.h"
71 #include "nsIGenericFactory.h"
72 #include "nsIHTMLCSSStyleSheet.h"
73 #include "nsIFragmentContentSink.h"
74 #include "nsHTMLStyleSheet.h"
75 #include "nsIHTMLToTextSink.h"
76 #include "nsILayoutDebugger.h"
77 #include "nsINameSpaceManager.h"
78 #include "nsINodeInfo.h"
79 #include "nsIObserver.h"
80 #include "nsIObserverService.h"
81 #include "nsPresContext.h"
82 #include "nsIPresShell.h"
83 #include "nsIPrivateDOMImplementation.h"
84 #include "nsIRangeUtils.h"
85 #include "nsIScriptNameSpaceManager.h"
86 #include "nsISelection.h"
87 #include "nsIXBLService.h"
88 #include "nsCaret.h"
89 #include "nsPlainTextSerializer.h"
90 #include "mozSanitizingSerializer.h"
91 #include "nsXMLContentSerializer.h"
92 #include "nsRuleNode.h"
93 #include "nsWyciwygProtocolHandler.h"
94 #include "nsContentAreaDragDrop.h"
95 #include "nsContentList.h"
96 #include "nsSyncLoadService.h"
97 #include "nsBox.h"
98 #include "nsIFrameTraversal.h"
99 #include "nsLayoutCID.h"
100 #include "nsILanguageAtomService.h"
101 #include "nsStyleSheetService.h"
102 #include "nsXULPopupManager.h"
104 // Transformiix stuff
105 #include "nsXPathEvaluator.h"
106 #include "txMozillaXSLTProcessor.h"
107 #include "txNodeSetAdaptor.h"
108 #include "nsXPath1Scheme.h"
110 #include "nsDOMParser.h"
111 #include "nsDOMSerializer.h"
112 #include "nsXMLHttpRequest.h"
114 // view stuff
115 #include "nsViewsCID.h"
116 #include "nsViewManager.h"
117 #include "nsContentCreatorFunctions.h"
119 // DOM includes
120 #include "nsDOMException.h"
121 #include "nsGlobalWindowCommands.h"
122 #include "nsIControllerCommandTable.h"
123 #include "nsJSProtocolHandler.h"
124 #include "nsScriptNameSpaceManager.h"
125 #include "nsIControllerContext.h"
126 #include "nsDOMScriptObjectFactory.h"
127 #include "nsDOMStorage.h"
128 #include "nsJSON.h"
130 #include "nsIFocusEventSuppressor.h"
132 // Editor stuff
133 #include "nsEditorCID.h"
134 #include "nsEditor.h"
135 #include "nsPlaintextEditor.h"
136 #include "nsEditorController.h" //CID
137 #include "nsIController.h"
138 #include "nsIControllerContext.h"
139 #include "nsIControllerCommandTable.h"
141 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
142 #include "nsHTMLEditor.h"
143 #include "nsTextServicesDocument.h"
144 #include "nsTextServicesCID.h"
145 #endif
147 #define NS_EDITORCOMMANDTABLE_CID \
148 { 0x4f5e62b8, 0xd659, 0x4156, { 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 }}
150 static NS_DEFINE_CID(kEditorCommandTableCID, NS_EDITORCOMMANDTABLE_CID);
152 NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlaintextEditor)
154 // Constructor of a controller which is set up to use, internally, a
155 // singleton command-table pre-filled with editor commands.
156 static NS_METHOD
157 nsEditorControllerConstructor(nsISupports *aOuter, REFNSIID aIID,
158 void **aResult)
160 nsresult rv;
161 nsCOMPtr<nsIController> controller = do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
162 if (NS_FAILED(rv)) return rv;
164 nsCOMPtr<nsIControllerCommandTable> editorCommandTable = do_GetService(kEditorCommandTableCID, &rv);
165 if (NS_FAILED(rv)) return rv;
167 // this guy is a singleton, so make it immutable
168 editorCommandTable->MakeImmutable();
170 nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
171 if (NS_FAILED(rv)) return rv;
173 rv = controllerContext->Init(editorCommandTable);
174 if (NS_FAILED(rv)) return rv;
176 return controller->QueryInterface(aIID, aResult);
180 // Constructor for a command-table pref-filled with editor commands
181 static NS_METHOD
182 nsEditorCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
183 void **aResult)
185 nsresult rv;
186 nsCOMPtr<nsIControllerCommandTable> commandTable =
187 do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
188 if (NS_FAILED(rv)) return rv;
190 rv = nsEditorController::RegisterEditorCommands(commandTable);
191 if (NS_FAILED(rv)) return rv;
193 // we don't know here whether we're being created as an instance,
194 // or a service, so we can't become immutable
196 return commandTable->QueryInterface(aIID, aResult);
200 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
201 NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextServicesDocument)
202 #ifdef ENABLE_EDITOR_API_LOG
203 #include "nsHTMLEditorLog.h"
204 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditorLog)
205 #else
206 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditor)
207 #endif
208 #endif
210 #include "nsHTMLCanvasFrame.h"
212 #ifdef MOZ_ENABLE_CANVAS
213 #include "nsIDOMCanvasRenderingContext2D.h"
214 #endif
216 class nsIDocumentLoaderFactory;
218 #define PRODUCT_NAME "Gecko"
220 #define NS_HTMLIMGELEMENT_CONTRACTID \
221 "@mozilla.org/content/element/html;1?name=img"
223 #define NS_HTMLOPTIONELEMENT_CONTRACTID \
224 "@mozilla.org/content/element/html;1?name=option"
226 /* 0ddf4df8-4dbb-4133-8b79-9afb966514f5 */
227 #define NS_PLUGINDOCLOADERFACTORY_CID \
228 { 0x0ddf4df8, 0x4dbb, 0x4133, { 0x8b, 0x79, 0x9a, 0xfb, 0x96, 0x65, 0x14, 0xf5 } }
230 #define NS_WINDOWCOMMANDTABLE_CID \
231 { /* 0DE2FBFA-6B7F-11D7-BBBA-0003938A9D96 */ \
232 0x0DE2FBFA, 0x6B7F, 0x11D7, {0xBB, 0xBA, 0x00, 0x03, 0x93, 0x8A, 0x9D, 0x96} }
234 static NS_DEFINE_CID(kWindowCommandTableCID, NS_WINDOWCOMMANDTABLE_CID);
236 #include "nsIBoxObject.h"
238 #ifndef MOZ_NO_INSPECTOR_APIS
239 #ifdef MOZ_XUL
240 #include "inDOMView.h"
241 #endif /* MOZ_XUL */
243 #include "inDeepTreeWalker.h"
244 #include "inFlasher.h"
245 #include "inCSSValueSearch.h"
246 #include "inDOMUtils.h"
247 #endif /* MOZ_NO_INSPECTOR_APIS */
249 #ifdef MOZ_XUL
250 #include "nsIXULDocument.h"
251 #include "nsIXULPrototypeCache.h"
252 #include "nsIXULSortService.h"
254 NS_IMETHODIMP
255 NS_NewXULContentBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
257 NS_IMETHODIMP
258 NS_NewXULTreeBuilder(nsISupports* aOuter, REFNSIID aIID, void** aResult);
259 #endif
261 PR_STATIC_CALLBACK(nsresult) Initialize(nsIModule* aSelf);
262 static void Shutdown();
264 #ifdef MOZ_XTF
265 #include "nsIXTFService.h"
266 #include "nsIXMLContentBuilder.h"
267 #endif
269 #include "nsGeolocation.h"
271 // Transformiix
272 /* {0C351177-0159-4500-86B0-A219DFDE4258} */
273 #define TRANSFORMIIX_XPATH1_SCHEME_CID \
274 { 0xc351177, 0x159, 0x4500, { 0x86, 0xb0, 0xa2, 0x19, 0xdf, 0xde, 0x42, 0x58 } }
276 /* 5d5d92cd-6bf8-11d9-bf4a-000a95dc234c */
277 #define TRANSFORMIIX_NODESET_CID \
278 { 0x5d5d92cd, 0x6bf8, 0x11d9, { 0xbf, 0x4a, 0x0, 0x0a, 0x95, 0xdc, 0x23, 0x4c } }
280 #define TRANSFORMIIX_NODESET_CONTRACTID \
281 "@mozilla.org/transformiix-nodeset;1"
283 NS_GENERIC_FACTORY_CONSTRUCTOR(nsXPath1SchemeProcessor)
285 // Factory Constructor
286 NS_GENERIC_FACTORY_CONSTRUCTOR(txMozillaXSLTProcessor)
287 NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsXPathEvaluator, Init)
288 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(txNodeSetAdaptor, Init)
289 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMSerializer)
290 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsXMLHttpRequest, Init)
291 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMParser)
292 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsDOMStorageManager,
293 nsDOMStorageManager::GetInstance)
295 //-----------------------------------------------------------------------------
297 // Per bug 209804, it is necessary to observe the "xpcom-shutdown" event and
298 // perform shutdown of the layout modules at that time instead of waiting for
299 // our module destructor to run. If we do not do this, then we risk holding
300 // references to objects in other component libraries that have already been
301 // shutdown (and possibly unloaded if 60709 is ever fixed).
303 class LayoutShutdownObserver : public nsIObserver
305 public:
306 NS_DECL_ISUPPORTS
307 NS_DECL_NSIOBSERVER
310 NS_IMPL_ISUPPORTS1(LayoutShutdownObserver, nsIObserver)
312 NS_IMETHODIMP
313 LayoutShutdownObserver::Observe(nsISupports *aSubject,
314 const char *aTopic,
315 const PRUnichar *someData)
317 if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
318 Shutdown();
319 return NS_OK;
322 //-----------------------------------------------------------------------------
324 static PRBool gInitialized = PR_FALSE;
326 // Perform our one-time intialization for this module
328 // static
329 nsresult PR_CALLBACK
330 Initialize(nsIModule* aSelf)
332 NS_PRECONDITION(!gInitialized, "module already initialized");
333 if (gInitialized) {
334 return NS_OK;
337 NS_ASSERTION(sizeof(PtrBits) == sizeof(void *),
338 "Eeek! You'll need to adjust the size of PtrBits to the size "
339 "of a pointer on your platform.");
341 gInitialized = PR_TRUE;
343 nsresult rv = nsLayoutStatics::Initialize();
344 if (NS_FAILED(rv)) {
345 Shutdown();
346 return rv;
349 // Add our shutdown observer.
350 nsCOMPtr<nsIObserverService> observerService =
351 do_GetService("@mozilla.org/observer-service;1");
353 if (observerService) {
354 LayoutShutdownObserver* observer = new LayoutShutdownObserver();
356 if (!observer) {
357 Shutdown();
359 return NS_ERROR_OUT_OF_MEMORY;
362 observerService->AddObserver(observer, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
363 } else {
364 NS_WARNING("Could not get an observer service. We will leak on shutdown.");
367 return NS_OK;
370 // Shutdown this module, releasing all of the module resources
372 // static
373 void
374 Shutdown()
376 NS_PRECONDITION(gInitialized, "module not initialized");
377 if (!gInitialized)
378 return;
380 gInitialized = PR_FALSE;
382 nsLayoutStatics::Release();
385 #ifdef NS_DEBUG
386 nsresult NS_NewFrameUtil(nsIFrameUtil** aResult);
387 nsresult NS_NewLayoutDebugger(nsILayoutDebugger** aResult);
388 #endif
390 nsresult NS_NewBoxObject(nsIBoxObject** aResult);
392 #ifdef MOZ_XUL
393 nsresult NS_NewListBoxObject(nsIBoxObject** aResult);
394 nsresult NS_NewScrollBoxObject(nsIBoxObject** aResult);
395 nsresult NS_NewMenuBoxObject(nsIBoxObject** aResult);
396 nsresult NS_NewPopupBoxObject(nsIBoxObject** aResult);
397 nsresult NS_NewContainerBoxObject(nsIBoxObject** aResult);
398 nsresult NS_NewTreeBoxObject(nsIBoxObject** aResult);
399 #endif
401 #ifdef MOZ_ENABLE_CANVAS
402 nsresult NS_NewCanvasRenderingContext2D(nsIDOMCanvasRenderingContext2D** aResult);
403 #endif
405 nsresult NS_CreateFrameTraversal(nsIFrameTraversal** aResult);
407 nsresult NS_NewSelection(nsFrameSelection** aResult);
408 nsresult NS_NewDomSelection(nsISelection** aResult);
409 nsresult NS_NewDocumentViewer(nsIDocumentViewer** aResult);
410 nsresult NS_NewRange(nsIDOMRange** aResult);
411 nsresult NS_NewRangeUtils(nsIRangeUtils** aResult);
412 nsresult NS_NewContentIterator(nsIContentIterator** aResult);
413 nsresult NS_NewPreContentIterator(nsIContentIterator** aResult);
414 nsresult NS_NewGenRegularIterator(nsIContentIterator** aResult);
415 nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aResult);
416 nsresult NS_NewGenSubtreeIterator(nsIContentIterator** aInstancePtrResult);
417 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
418 nsresult NS_NewHTMLCopyTextEncoder(nsIDocumentEncoder** aResult);
419 nsresult NS_NewTextEncoder(nsIDocumentEncoder** aResult);
420 nsresult NS_NewXBLService(nsIXBLService** aResult);
421 nsresult NS_NewContentPolicy(nsIContentPolicy** aResult);
422 nsresult NS_NewDOMEventGroup(nsIDOMEventGroup** aResult);
423 nsresult NS_NewFocusEventSuppressorService(nsIFocusEventSuppressorService** aResult);
425 NS_IMETHODIMP NS_NewXULControllers(nsISupports* aOuter, REFNSIID aIID, void** aResult);
427 #define MAKE_CTOR(ctor_, iface_, func_) \
428 static NS_IMETHODIMP \
429 ctor_(nsISupports* aOuter, REFNSIID aIID, void** aResult) \
431 *aResult = nsnull; \
432 if (aOuter) \
433 return NS_ERROR_NO_AGGREGATION; \
434 iface_* inst; \
435 nsresult rv = func_(&inst); \
436 if (NS_SUCCEEDED(rv)) { \
437 rv = inst->QueryInterface(aIID, aResult); \
438 NS_RELEASE(inst); \
440 return rv; \
443 #ifdef DEBUG
444 MAKE_CTOR(CreateNewFrameUtil, nsIFrameUtil, NS_NewFrameUtil)
445 MAKE_CTOR(CreateNewLayoutDebugger, nsILayoutDebugger, NS_NewLayoutDebugger)
446 #endif
448 MAKE_CTOR(CreateNewFrameTraversal, nsIFrameTraversal, NS_CreateFrameTraversal)
449 MAKE_CTOR(CreateNewPresShell, nsIPresShell, NS_NewPresShell)
450 MAKE_CTOR(CreateNewBoxObject, nsIBoxObject, NS_NewBoxObject)
452 #ifdef MOZ_XUL
453 MAKE_CTOR(CreateNewListBoxObject, nsIBoxObject, NS_NewListBoxObject)
454 MAKE_CTOR(CreateNewMenuBoxObject, nsIBoxObject, NS_NewMenuBoxObject)
455 MAKE_CTOR(CreateNewPopupBoxObject, nsIBoxObject, NS_NewPopupBoxObject)
456 MAKE_CTOR(CreateNewScrollBoxObject, nsIBoxObject, NS_NewScrollBoxObject)
457 MAKE_CTOR(CreateNewTreeBoxObject, nsIBoxObject, NS_NewTreeBoxObject)
458 MAKE_CTOR(CreateNewContainerBoxObject, nsIBoxObject, NS_NewContainerBoxObject)
459 #endif // MOZ_XUL
461 #ifndef MOZ_NO_INSPECTOR_APIS
462 #ifdef MOZ_XUL
463 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMView)
464 #endif
465 NS_GENERIC_FACTORY_CONSTRUCTOR(inDeepTreeWalker)
466 NS_GENERIC_FACTORY_CONSTRUCTOR(inFlasher)
467 NS_GENERIC_FACTORY_CONSTRUCTOR(inCSSValueSearch)
468 NS_GENERIC_FACTORY_CONSTRUCTOR(inDOMUtils)
469 #endif
471 MAKE_CTOR(CreateNameSpaceManager, nsINameSpaceManager, NS_GetNameSpaceManager)
472 MAKE_CTOR(CreateEventListenerManager, nsIEventListenerManager, NS_NewEventListenerManager)
473 MAKE_CTOR(CreateDOMEventGroup, nsIDOMEventGroup, NS_NewDOMEventGroup)
474 MAKE_CTOR(CreateDocumentViewer, nsIDocumentViewer, NS_NewDocumentViewer)
475 MAKE_CTOR(CreateCSSStyleSheet, nsICSSStyleSheet, NS_NewCSSStyleSheet)
476 MAKE_CTOR(CreateHTMLDocument, nsIDocument, NS_NewHTMLDocument)
477 MAKE_CTOR(CreateHTMLCSSStyleSheet, nsIHTMLCSSStyleSheet, NS_NewHTMLCSSStyleSheet)
478 MAKE_CTOR(CreateDOMImplementation, nsIDOMDOMImplementation, NS_NewDOMImplementation)
479 MAKE_CTOR(CreateXMLDocument, nsIDocument, NS_NewXMLDocument)
480 #ifdef MOZ_SVG
481 MAKE_CTOR(CreateSVGDocument, nsIDocument, NS_NewSVGDocument)
482 #endif
483 MAKE_CTOR(CreateImageDocument, nsIDocument, NS_NewImageDocument)
484 MAKE_CTOR(CreateCSSParser, nsICSSParser, NS_NewCSSParser)
485 MAKE_CTOR(CreateCSSLoader, nsICSSLoader, NS_NewCSSLoader)
486 MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
487 MAKE_CTOR(CreateSelection, nsFrameSelection, NS_NewSelection)
488 MAKE_CTOR(CreateRange, nsIDOMRange, NS_NewRange)
489 MAKE_CTOR(CreateRangeUtils, nsIRangeUtils, NS_NewRangeUtils)
490 MAKE_CTOR(CreateContentIterator, nsIContentIterator, NS_NewContentIterator)
491 MAKE_CTOR(CreatePreContentIterator, nsIContentIterator, NS_NewPreContentIterator)
492 MAKE_CTOR(CreateSubtreeIterator, nsIContentIterator, NS_NewContentSubtreeIterator)
493 // CreateHTMLImgElement, see below
494 // CreateHTMLOptionElement, see below
495 MAKE_CTOR(CreateTextEncoder, nsIDocumentEncoder, NS_NewTextEncoder)
496 MAKE_CTOR(CreateHTMLCopyTextEncoder, nsIDocumentEncoder, NS_NewHTMLCopyTextEncoder)
497 MAKE_CTOR(CreateXMLContentSerializer, nsIContentSerializer, NS_NewXMLContentSerializer)
498 MAKE_CTOR(CreateHTMLContentSerializer, nsIContentSerializer, NS_NewHTMLContentSerializer)
499 MAKE_CTOR(CreatePlainTextSerializer, nsIContentSerializer, NS_NewPlainTextSerializer)
500 MAKE_CTOR(CreateHTMLFragmentSink, nsIFragmentContentSink, NS_NewHTMLFragmentContentSink)
501 MAKE_CTOR(CreateHTMLFragmentSink2, nsIFragmentContentSink, NS_NewHTMLFragmentContentSink2)
502 MAKE_CTOR(CreateHTMLParanoidFragmentSink, nsIFragmentContentSink, NS_NewHTMLParanoidFragmentSink)
503 MAKE_CTOR(CreateXMLFragmentSink, nsIFragmentContentSink, NS_NewXMLFragmentContentSink)
504 MAKE_CTOR(CreateXMLFragmentSink2, nsIFragmentContentSink, NS_NewXMLFragmentContentSink2)
505 MAKE_CTOR(CreateXHTMLParanoidFragmentSink,nsIFragmentContentSink, NS_NewXHTMLParanoidFragmentSink)
506 MAKE_CTOR(CreateSanitizingHTMLSerializer, nsIContentSerializer, NS_NewSanitizingHTMLSerializer)
507 MAKE_CTOR(CreateXBLService, nsIXBLService, NS_NewXBLService)
508 MAKE_CTOR(CreateContentPolicy, nsIContentPolicy, NS_NewContentPolicy)
509 MAKE_CTOR(CreateComputedDOMStyle, nsIComputedDOMStyle, NS_NewComputedDOMStyle)
510 MAKE_CTOR(CreateFocusEventSuppressorService,nsIFocusEventSuppressorService,NS_NewFocusEventSuppressorService)
511 #ifdef MOZ_XUL
512 MAKE_CTOR(CreateXULSortService, nsIXULSortService, NS_NewXULSortService)
513 // NS_NewXULContentBuilder
514 // NS_NewXULTreeBuilder
515 MAKE_CTOR(CreateXULDocument, nsIXULDocument, NS_NewXULDocument)
516 // NS_NewXULControllers
517 // NS_NewXULPrototypeCache
518 MAKE_CTOR(CreateXULPopupManager, nsISupports, NS_NewXULPopupManager)
519 #endif
520 #ifdef MOZ_XTF
521 MAKE_CTOR(CreateXTFService, nsIXTFService, NS_NewXTFService)
522 MAKE_CTOR(CreateXMLContentBuilder, nsIXMLContentBuilder, NS_NewXMLContentBuilder)
523 #endif
524 MAKE_CTOR(CreateContentDLF, nsIDocumentLoaderFactory, NS_NewContentDocumentLoaderFactory)
525 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCSSOMFactory)
526 NS_GENERIC_FACTORY_CONSTRUCTOR(nsInspectorCSSUtils)
527 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWyciwygProtocolHandler)
528 NS_GENERIC_FACTORY_CONSTRUCTOR(nsContentAreaDragDrop)
529 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDataDocumentContentPolicy)
530 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoDataProtocolContentPolicy)
531 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSyncLoadService)
532 MAKE_CTOR(CreatePluginDocument, nsIDocument, NS_NewPluginDocument)
534 #ifdef MOZ_ENABLE_CANVAS
535 MAKE_CTOR(CreateCanvasRenderingContext2D, nsIDOMCanvasRenderingContext2D, NS_NewCanvasRenderingContext2D)
536 #endif
538 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStyleSheetService, Init)
540 // views are not refcounted, so this is the same as
541 // NS_GENERIC_FACTORY_CONSTRUCTOR without the NS_ADDREF/NS_RELEASE
542 #define NS_GENERIC_FACTORY_CONSTRUCTOR_NOREFS(_InstanceClass) \
543 static NS_IMETHODIMP \
544 _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
545 void **aResult) \
547 nsresult rv; \
549 _InstanceClass * inst; \
551 *aResult = NULL; \
552 if (NULL != aOuter) { \
553 rv = NS_ERROR_NO_AGGREGATION; \
554 return rv; \
557 NS_NEWXPCOM(inst, _InstanceClass); \
558 if (NULL == inst) { \
559 rv = NS_ERROR_OUT_OF_MEMORY; \
560 return rv; \
562 rv = inst->QueryInterface(aIID, aResult); \
564 return rv; \
567 NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewManager)
569 static NS_IMETHODIMP
570 CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
572 *aResult = nsnull;
573 if (aOuter)
574 return NS_ERROR_NO_AGGREGATION;
575 // Note! NS_NewHTMLImageElement is special cased to handle a null nodeinfo
576 nsIContent* inst = NS_NewHTMLImageElement(nsnull);
577 nsresult rv = NS_ERROR_OUT_OF_MEMORY;
578 if (inst) {
579 NS_ADDREF(inst);
580 rv = inst->QueryInterface(aIID, aResult);
581 NS_RELEASE(inst);
583 return rv;
586 static NS_IMETHODIMP
587 RegisterHTMLImgElement(nsIComponentManager *aCompMgr,
588 nsIFile* aPath,
589 const char* aRegistryLocation,
590 const char* aComponentType,
591 const nsModuleComponentInfo* aInfo)
593 nsCOMPtr<nsICategoryManager> catman =
594 do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
596 if (!catman)
597 return NS_ERROR_FAILURE;
599 nsXPIDLCString previous;
600 nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
601 "Image", NS_HTMLIMGELEMENT_CONTRACTID,
602 PR_TRUE, PR_TRUE, getter_Copies(previous));
603 NS_ENSURE_SUCCESS(rv, rv);
605 return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
606 "Image", "HTMLImageElement",
607 PR_TRUE, PR_TRUE, getter_Copies(previous));
610 static NS_IMETHODIMP
611 UnregisterHTMLImgElement(nsIComponentManager* aCompMgr,
612 nsIFile* aPath,
613 const char* aRegistryLocation,
614 const nsModuleComponentInfo* aInfo)
616 // XXX remove category entry
617 return NS_OK;
620 static NS_IMETHODIMP
621 CreateHTMLOptionElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
623 *aResult = nsnull;
624 if (aOuter)
625 return NS_ERROR_NO_AGGREGATION;
626 // Note! NS_NewHTMLOptionElement is special cased to handle a null nodeinfo
627 nsIContent* inst = NS_NewHTMLOptionElement(nsnull);
628 nsresult rv = NS_ERROR_OUT_OF_MEMORY;
629 if (inst) {
630 NS_ADDREF(inst);
631 rv = inst->QueryInterface(aIID, aResult);
632 NS_RELEASE(inst);
634 return rv;
637 static NS_IMETHODIMP
638 RegisterHTMLOptionElement(nsIComponentManager *aCompMgr,
639 nsIFile* aPath,
640 const char* aRegistryLocation,
641 const char* aComponentType,
642 const nsModuleComponentInfo* aInfo)
644 nsCOMPtr<nsICategoryManager> catman =
645 do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
647 if (!catman)
648 return NS_ERROR_FAILURE;
650 nsXPIDLCString previous;
651 nsresult rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
652 "Option", NS_HTMLOPTIONELEMENT_CONTRACTID,
653 PR_TRUE, PR_TRUE, getter_Copies(previous));
654 NS_ENSURE_SUCCESS(rv, rv);
656 return catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_PROTO_ALIAS_CATEGORY,
657 "Option", "HTMLOptionElement",
658 PR_TRUE, PR_TRUE, getter_Copies(previous));
661 static NS_IMETHODIMP
662 UnregisterHTMLOptionElement(nsIComponentManager* aCompMgr,
663 nsIFile* aPath,
664 const char* aRegistryLocation,
665 const nsModuleComponentInfo* aInfo)
667 // XXX remove category entry
668 return NS_OK;
671 static NS_METHOD
672 RegisterDataDocumentContentPolicy(nsIComponentManager *aCompMgr,
673 nsIFile* aPath,
674 const char* aRegistryLocation,
675 const char* aComponentType,
676 const nsModuleComponentInfo* aInfo)
678 nsresult rv;
679 nsCOMPtr<nsICategoryManager> catman =
680 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
681 if (NS_FAILED(rv)) {
682 return rv;
684 nsXPIDLCString previous;
685 return catman->AddCategoryEntry("content-policy",
686 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
687 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
688 PR_TRUE, PR_TRUE, getter_Copies(previous));
691 static NS_METHOD
692 UnregisterDataDocumentContentPolicy(nsIComponentManager *aCompMgr,
693 nsIFile *aPath,
694 const char *registryLocation,
695 const nsModuleComponentInfo *info)
697 nsresult rv;
698 nsCOMPtr<nsICategoryManager> catman =
699 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
700 if (NS_FAILED(rv)) {
701 return rv;
704 return catman->DeleteCategoryEntry("content-policy",
705 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
706 PR_TRUE);
709 static NS_METHOD
710 RegisterNoDataProtocolContentPolicy(nsIComponentManager *aCompMgr,
711 nsIFile* aPath,
712 const char* aRegistryLocation,
713 const char* aComponentType,
714 const nsModuleComponentInfo* aInfo)
716 nsresult rv;
717 nsCOMPtr<nsICategoryManager> catman =
718 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
719 if (NS_FAILED(rv)) {
720 return rv;
722 nsXPIDLCString previous;
723 return catman->AddCategoryEntry("content-policy",
724 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
725 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
726 PR_TRUE, PR_TRUE, getter_Copies(previous));
729 static NS_METHOD
730 UnregisterNoDataProtocolContentPolicy(nsIComponentManager *aCompMgr,
731 nsIFile *aPath,
732 const char *registryLocation,
733 const nsModuleComponentInfo *info)
735 nsresult rv;
736 nsCOMPtr<nsICategoryManager> catman =
737 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
738 if (NS_FAILED(rv)) {
739 return rv;
742 return catman->DeleteCategoryEntry("content-policy",
743 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
744 PR_TRUE);
747 static NS_METHOD
748 CreateWindowCommandTableConstructor(nsISupports *aOuter,
749 REFNSIID aIID, void **aResult)
751 nsresult rv;
752 nsCOMPtr<nsIControllerCommandTable> commandTable =
753 do_CreateInstance(NS_CONTROLLERCOMMANDTABLE_CONTRACTID, &rv);
754 if (NS_FAILED(rv)) return rv;
756 rv = nsWindowCommandRegistration::RegisterWindowCommands(commandTable);
757 if (NS_FAILED(rv)) return rv;
759 return commandTable->QueryInterface(aIID, aResult);
762 static NS_METHOD
763 CreateWindowControllerWithSingletonCommandTable(nsISupports *aOuter,
764 REFNSIID aIID, void **aResult)
766 nsresult rv;
767 nsCOMPtr<nsIController> controller =
768 do_CreateInstance("@mozilla.org/embedcomp/base-command-controller;1", &rv);
770 if (NS_FAILED(rv)) return rv;
772 nsCOMPtr<nsIControllerCommandTable> windowCommandTable = do_GetService(kWindowCommandTableCID, &rv);
773 if (NS_FAILED(rv)) return rv;
775 // this is a singleton; make it immutable
776 windowCommandTable->MakeImmutable();
778 nsCOMPtr<nsIControllerContext> controllerContext = do_QueryInterface(controller, &rv);
779 if (NS_FAILED(rv)) return rv;
781 controllerContext->Init(windowCommandTable);
782 if (NS_FAILED(rv)) return rv;
784 return controller->QueryInterface(aIID, aResult);
787 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDOMScriptObjectFactory)
788 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseDOMException)
790 #define NS_GEOLOCATION_SERVICE_CID \
791 { 0x404d02a, 0x1CA, 0xAAAB, { 0x47, 0x62, 0x94, 0x4b, 0x1b, 0xf2, 0xf7, 0xb5 } }
793 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsGeolocatorService, nsGeolocatorService::GetGeolocationService)
795 // The list of components we register
796 static const nsModuleComponentInfo gComponents[] = {
797 #ifdef DEBUG
798 { "Frame utility",
799 NS_FRAME_UTIL_CID,
800 nsnull,
801 CreateNewFrameUtil },
802 { "Layout debugger",
803 NS_LAYOUT_DEBUGGER_CID,
804 nsnull,
805 CreateNewLayoutDebugger },
806 #endif
808 { "Frame Traversal",
809 NS_FRAMETRAVERSAL_CID,
810 nsnull,
811 CreateNewFrameTraversal },
813 // XXX ick
814 { "Presentation shell",
815 NS_PRESSHELL_CID,
816 nsnull,
817 CreateNewPresShell },
819 // XXX end ick
821 { "Box Object",
822 NS_BOXOBJECT_CID,
823 "@mozilla.org/layout/xul-boxobject;1",
824 CreateNewBoxObject },
826 #ifdef MOZ_XUL
827 { "XUL Listbox Box Object",
828 NS_LISTBOXOBJECT_CID,
829 "@mozilla.org/layout/xul-boxobject-listbox;1",
830 CreateNewListBoxObject },
832 { "XUL Menu Box Object",
833 NS_MENUBOXOBJECT_CID,
834 "@mozilla.org/layout/xul-boxobject-menu;1",
835 CreateNewMenuBoxObject },
837 { "XUL Popup Box Object",
838 NS_POPUPBOXOBJECT_CID,
839 "@mozilla.org/layout/xul-boxobject-popup;1",
840 CreateNewPopupBoxObject },
842 { "Container Box Object",
843 NS_CONTAINERBOXOBJECT_CID,
844 "@mozilla.org/layout/xul-boxobject-container;1",
845 CreateNewContainerBoxObject },
847 { "XUL ScrollBox Object",
848 NS_SCROLLBOXOBJECT_CID,
849 "@mozilla.org/layout/xul-boxobject-scrollbox;1",
850 CreateNewScrollBoxObject },
852 { "XUL Tree Box Object",
853 NS_TREEBOXOBJECT_CID,
854 "@mozilla.org/layout/xul-boxobject-tree;1",
855 CreateNewTreeBoxObject },
857 #endif // MOZ_XUL
859 #ifndef MOZ_NO_INSPECTOR_APIS
860 #ifdef MOZ_XUL
861 { "DOM View",
862 IN_DOMVIEW_CID,
863 "@mozilla.org/inspector/dom-view;1",
864 inDOMViewConstructor },
865 #endif
867 { "Deep Tree Walker",
868 IN_DEEPTREEWALKER_CID,
869 "@mozilla.org/inspector/deep-tree-walker;1",
870 inDeepTreeWalkerConstructor },
872 { "Flasher",
873 IN_FLASHER_CID,
874 "@mozilla.org/inspector/flasher;1",
875 inFlasherConstructor },
877 { "CSS Value Search",
878 IN_CSSVALUESEARCH_CID,
879 "@mozilla.org/inspector/search;1?type=cssvalue",
880 inCSSValueSearchConstructor },
882 { "DOM Utils",
883 IN_DOMUTILS_CID,
884 "@mozilla.org/inspector/dom-utils;1",
885 inDOMUtilsConstructor },
888 #endif // MOZ_NO_INSPECTOR_APIS
890 { "Namespace manager",
891 NS_NAMESPACEMANAGER_CID,
892 NS_NAMESPACEMANAGER_CONTRACTID,
893 CreateNameSpaceManager },
895 { "Event listener manager",
896 NS_EVENTLISTENERMANAGER_CID,
897 nsnull,
898 CreateEventListenerManager },
900 { "DOM Event group",
901 NS_DOMEVENTGROUP_CID,
902 nsnull,
903 CreateDOMEventGroup },
905 { "Document Viewer",
906 NS_DOCUMENT_VIEWER_CID,
907 nsnull,
908 CreateDocumentViewer },
910 { "CSS Style Sheet",
911 NS_CSS_STYLESHEET_CID,
912 nsnull,
913 CreateCSSStyleSheet },
915 { "HTML document",
916 NS_HTMLDOCUMENT_CID,
917 nsnull,
918 CreateHTMLDocument },
920 { "HTML-CSS style sheet",
921 NS_HTML_CSS_STYLESHEET_CID,
922 nsnull,
923 CreateHTMLCSSStyleSheet },
925 { "DOM implementation",
926 NS_DOM_IMPLEMENTATION_CID,
927 nsnull,
928 CreateDOMImplementation },
931 { "XML document",
932 NS_XMLDOCUMENT_CID,
933 "@mozilla.org/xml/xml-document;1",
934 CreateXMLDocument },
936 #ifdef MOZ_SVG
937 { "SVG document",
938 NS_SVGDOCUMENT_CID,
939 "@mozilla.org/svg/svg-document;1",
940 CreateSVGDocument },
941 #endif
943 { "Image document",
944 NS_IMAGEDOCUMENT_CID,
945 nsnull,
946 CreateImageDocument },
948 { "CSS parser",
949 NS_CSSPARSER_CID,
950 "@mozilla.org/content/css-parser;1",
951 CreateCSSParser },
953 { "CSS loader",
954 NS_CSS_LOADER_CID,
955 nsnull,
956 CreateCSSLoader },
958 { "Dom selection",
959 NS_DOMSELECTION_CID,
960 "@mozilla.org/content/dom-selection;1",
961 CreateDOMSelection },
963 { "Frame selection",
964 NS_FRAMESELECTION_CID,
965 nsnull,
966 CreateSelection },
968 { "Range",
969 NS_RANGE_CID,
970 "@mozilla.org/content/range;1",
971 CreateRange },
973 { "Range Utils",
974 NS_RANGEUTILS_CID,
975 "@mozilla.org/content/range-utils;1",
976 CreateRangeUtils },
978 { "Content iterator",
979 NS_CONTENTITERATOR_CID,
980 "@mozilla.org/content/post-content-iterator;1",
981 CreateContentIterator },
983 { "Pre Content iterator",
984 NS_PRECONTENTITERATOR_CID,
985 "@mozilla.org/content/pre-content-iterator;1",
986 CreatePreContentIterator },
988 { "Subtree iterator",
989 NS_SUBTREEITERATOR_CID,
990 "@mozilla.org/content/subtree-content-iterator;1",
991 CreateSubtreeIterator },
993 { "CSS Object Model Factory",
994 NS_CSSOMFACTORY_CID,
995 nsnull,
996 nsCSSOMFactoryConstructor },
998 { "Inspector CSS Utils",
999 NS_INSPECTORCSSUTILS_CID,
1000 nsnull,
1001 nsInspectorCSSUtilsConstructor },
1003 // Needed to support "new Option;" and "new Image;" in JavaScript
1004 { "HTML img element",
1005 NS_HTMLIMAGEELEMENT_CID,
1006 NS_HTMLIMGELEMENT_CONTRACTID,
1007 CreateHTMLImgElement,
1008 RegisterHTMLImgElement,
1009 UnregisterHTMLImgElement },
1011 { "HTML option element",
1012 NS_HTMLOPTIONELEMENT_CID,
1013 NS_HTMLOPTIONELEMENT_CONTRACTID,
1014 CreateHTMLOptionElement,
1015 RegisterHTMLOptionElement,
1016 UnregisterHTMLOptionElement },
1018 #ifdef MOZ_ENABLE_CANVAS
1019 { "Canvas 2D Rendering Context",
1020 NS_CANVASRENDERINGCONTEXT2D_CID,
1021 "@mozilla.org/content/canvas-rendering-context;1?id=2d",
1022 CreateCanvasRenderingContext2D },
1023 #endif
1025 { "XML document encoder",
1026 NS_TEXT_ENCODER_CID,
1027 NS_DOC_ENCODER_CONTRACTID_BASE "text/xml",
1028 CreateTextEncoder },
1030 { "XML document encoder",
1031 NS_TEXT_ENCODER_CID,
1032 NS_DOC_ENCODER_CONTRACTID_BASE "application/xml",
1033 CreateTextEncoder },
1035 { "XML document encoder",
1036 NS_TEXT_ENCODER_CID,
1037 NS_DOC_ENCODER_CONTRACTID_BASE "application/xhtml+xml",
1038 CreateTextEncoder },
1040 #ifdef MOZ_SVG
1041 { "SVG document encoder",
1042 NS_TEXT_ENCODER_CID,
1043 NS_DOC_ENCODER_CONTRACTID_BASE "image/svg+xml",
1044 CreateTextEncoder },
1045 #endif
1047 { "HTML document encoder",
1048 NS_TEXT_ENCODER_CID,
1049 NS_DOC_ENCODER_CONTRACTID_BASE "text/html",
1050 CreateTextEncoder },
1052 { "Plaintext document encoder",
1053 NS_TEXT_ENCODER_CID,
1054 NS_DOC_ENCODER_CONTRACTID_BASE "text/plain",
1055 CreateTextEncoder },
1057 { "HTML copy encoder",
1058 NS_HTMLCOPY_TEXT_ENCODER_CID,
1059 NS_HTMLCOPY_ENCODER_CONTRACTID,
1060 CreateHTMLCopyTextEncoder },
1062 { "XML content serializer",
1063 NS_XMLCONTENTSERIALIZER_CID,
1064 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/xml",
1065 CreateXMLContentSerializer },
1067 { "XML content serializer",
1068 NS_XMLCONTENTSERIALIZER_CID,
1069 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xml",
1070 CreateXMLContentSerializer },
1072 { "XML content serializer",
1073 NS_XMLCONTENTSERIALIZER_CID,
1074 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/xhtml+xml",
1075 CreateXMLContentSerializer },
1077 #ifdef MOZ_SVG
1078 { "SVG content serializer",
1079 NS_XMLCONTENTSERIALIZER_CID,
1080 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "image/svg+xml",
1081 CreateXMLContentSerializer },
1082 #endif
1084 { "HTML content serializer",
1085 NS_HTMLCONTENTSERIALIZER_CID,
1086 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/html",
1087 CreateHTMLContentSerializer },
1089 { "XUL content serializer",
1090 NS_XMLCONTENTSERIALIZER_CID,
1091 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "application/vnd.mozilla.xul+xml",
1092 CreateXMLContentSerializer },
1094 { "plaintext content serializer",
1095 NS_PLAINTEXTSERIALIZER_CID,
1096 NS_CONTENTSERIALIZER_CONTRACTID_PREFIX "text/plain",
1097 CreatePlainTextSerializer },
1099 { "plaintext sink",
1100 NS_PLAINTEXTSERIALIZER_CID,
1101 NS_PLAINTEXTSINK_CONTRACTID,
1102 CreatePlainTextSerializer },
1104 { "html fragment sink",
1105 NS_HTMLFRAGMENTSINK_CID,
1106 NS_HTMLFRAGMENTSINK_CONTRACTID,
1107 CreateHTMLFragmentSink },
1109 { "html fragment sink 2",
1110 NS_HTMLFRAGMENTSINK2_CID,
1111 NS_HTMLFRAGMENTSINK2_CONTRACTID,
1112 CreateHTMLFragmentSink2 },
1114 { "html paranoid fragment sink",
1115 NS_HTMLPARANOIDFRAGMENTSINK_CID,
1116 NS_HTMLPARANOIDFRAGMENTSINK_CONTRACTID,
1117 CreateHTMLParanoidFragmentSink },
1119 { "HTML sanitizing content serializer",
1120 MOZ_SANITIZINGHTMLSERIALIZER_CID,
1121 MOZ_SANITIZINGHTMLSERIALIZER_CONTRACTID,
1122 CreateSanitizingHTMLSerializer },
1124 { "xml fragment sink",
1125 NS_XMLFRAGMENTSINK_CID,
1126 NS_XMLFRAGMENTSINK_CONTRACTID,
1127 CreateXMLFragmentSink },
1129 { "xml fragment sink 2",
1130 NS_XMLFRAGMENTSINK2_CID,
1131 NS_XMLFRAGMENTSINK2_CONTRACTID,
1132 CreateXMLFragmentSink2 },
1134 { "xhtml paranoid fragment sink",
1135 NS_XHTMLPARANOIDFRAGMENTSINK_CID,
1136 NS_XHTMLPARANOIDFRAGMENTSINK_CONTRACTID,
1137 CreateXHTMLParanoidFragmentSink },
1139 { "XBL Service",
1140 NS_XBLSERVICE_CID,
1141 "@mozilla.org/xbl;1",
1142 CreateXBLService },
1144 { "Content policy service",
1145 NS_CONTENTPOLICY_CID,
1146 NS_CONTENTPOLICY_CONTRACTID,
1147 CreateContentPolicy },
1149 { "Data document content policy",
1150 NS_DATADOCUMENTCONTENTPOLICY_CID,
1151 NS_DATADOCUMENTCONTENTPOLICY_CONTRACTID,
1152 nsDataDocumentContentPolicyConstructor,
1153 RegisterDataDocumentContentPolicy,
1154 UnregisterDataDocumentContentPolicy },
1156 { "No data protocol content policy",
1157 NS_NODATAPROTOCOLCONTENTPOLICY_CID,
1158 NS_NODATAPROTOCOLCONTENTPOLICY_CONTRACTID,
1159 nsNoDataProtocolContentPolicyConstructor,
1160 RegisterNoDataProtocolContentPolicy,
1161 UnregisterNoDataProtocolContentPolicy },
1163 { "DOM CSS Computed Style Declaration",
1164 NS_COMPUTEDDOMSTYLE_CID,
1165 "@mozilla.org/DOM/Level2/CSS/computedStyleDeclaration;1",
1166 CreateComputedDOMStyle },
1168 { "XUL Controllers",
1169 NS_XULCONTROLLERS_CID,
1170 "@mozilla.org/xul/xul-controllers;1",
1171 NS_NewXULControllers },
1173 #ifdef MOZ_XUL
1174 { "XUL Sort Service",
1175 NS_XULSORTSERVICE_CID,
1176 "@mozilla.org/xul/xul-sort-service;1",
1177 CreateXULSortService },
1179 { "XUL Template Builder",
1180 NS_XULTEMPLATEBUILDER_CID,
1181 "@mozilla.org/xul/xul-template-builder;1",
1182 NS_NewXULContentBuilder },
1184 { "XUL Tree Builder",
1185 NS_XULTREEBUILDER_CID,
1186 "@mozilla.org/xul/xul-tree-builder;1",
1187 NS_NewXULTreeBuilder },
1189 { "XUL Popup Manager",
1190 NS_XULPOPUPMANAGER_CID,
1191 "@mozilla.org/xul/xul-popup-manager;1",
1192 CreateXULPopupManager },
1194 { "XUL Document",
1195 NS_XULDOCUMENT_CID,
1196 "@mozilla.org/xul/xul-document;1",
1197 CreateXULDocument },
1199 { "XUL Prototype Cache",
1200 NS_XULPROTOTYPECACHE_CID,
1201 "@mozilla.org/xul/xul-prototype-cache;1",
1202 NS_NewXULPrototypeCache },
1204 #endif
1206 #ifdef MOZ_XTF
1207 { "XTF Service",
1208 NS_XTFSERVICE_CID,
1209 NS_XTFSERVICE_CONTRACTID,
1210 CreateXTFService },
1212 { "XML Content Builder",
1213 NS_XMLCONTENTBUILDER_CID,
1214 NS_XMLCONTENTBUILDER_CONTRACTID,
1215 CreateXMLContentBuilder },
1216 #endif
1218 { "Document Loader Factory",
1219 NS_CONTENT_DOCUMENT_LOADER_FACTORY_CID,
1220 "@mozilla.org/content/document-loader-factory;1",
1221 CreateContentDLF,
1222 nsContentDLF::RegisterDocumentFactories,
1223 nsContentDLF::UnregisterDocumentFactories },
1225 { "Wyciwyg Handler",
1226 NS_WYCIWYGPROTOCOLHANDLER_CID,
1227 NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg",
1228 nsWyciwygProtocolHandlerConstructor },
1230 { "Content Area DragDrop",
1231 NS_CONTENTAREADRAGDROP_CID,
1232 NS_CONTENTAREADRAGDROP_CONTRACTID,
1233 nsContentAreaDragDropConstructor },
1235 { "SyncLoad DOM Service",
1236 NS_SYNCLOADDOMSERVICE_CID,
1237 NS_SYNCLOADDOMSERVICE_CONTRACTID,
1238 nsSyncLoadServiceConstructor },
1240 // DOM objects
1241 { "Script Object Factory",
1242 NS_DOM_SCRIPT_OBJECT_FACTORY_CID,
1243 nsnull,
1244 nsDOMScriptObjectFactoryConstructor
1246 { "Base DOM Exception",
1247 NS_BASE_DOM_EXCEPTION_CID,
1248 nsnull,
1249 nsBaseDOMExceptionConstructor
1251 { "JavaScript Protocol Handler",
1252 NS_JSPROTOCOLHANDLER_CID,
1253 NS_JSPROTOCOLHANDLER_CONTRACTID,
1254 nsJSProtocolHandler::Create },
1255 { "Window Command Table",
1256 NS_WINDOWCOMMANDTABLE_CID,
1258 CreateWindowCommandTableConstructor
1260 { "Window Command Controller",
1261 NS_WINDOWCONTROLLER_CID,
1262 NS_WINDOWCONTROLLER_CONTRACTID,
1263 CreateWindowControllerWithSingletonCommandTable
1266 // view stuff
1267 { "View Manager", NS_VIEW_MANAGER_CID, "@mozilla.org/view-manager;1",
1268 nsViewManagerConstructor },
1270 { "Focus Event Suppressor",
1271 NS_NSIFOCUSEVENTSUPPRESSORSERVICE_CID,
1272 NS_NSIFOCUSEVENTSUPPRESSORSERVICE_CONTRACTID,
1273 CreateFocusEventSuppressorService },
1275 { "Plugin Document Loader Factory",
1276 NS_PLUGINDOCLOADERFACTORY_CID,
1277 "@mozilla.org/content/plugin/document-loader-factory;1",
1278 CreateContentDLF },
1280 { "Plugin Document",
1281 NS_PLUGINDOCUMENT_CID,
1282 nsnull,
1283 CreatePluginDocument },
1285 { "Style sheet service",
1286 NS_STYLESHEETSERVICE_CID,
1287 NS_STYLESHEETSERVICE_CONTRACTID,
1288 nsStyleSheetServiceConstructor },
1290 // transformiix
1292 { "XSLTProcessor",
1293 TRANSFORMIIX_XSLT_PROCESSOR_CID,
1294 TRANSFORMIIX_XSLT_PROCESSOR_CONTRACTID,
1295 txMozillaXSLTProcessorConstructor },
1297 { "XPathEvaluator",
1298 TRANSFORMIIX_XPATH_EVALUATOR_CID,
1299 NS_XPATH_EVALUATOR_CONTRACTID,
1300 nsXPathEvaluatorConstructor },
1302 { "XPath1 XPointer Scheme Processor",
1303 TRANSFORMIIX_XPATH1_SCHEME_CID,
1304 NS_XPOINTER_SCHEME_PROCESSOR_BASE "xpath1",
1305 nsXPath1SchemeProcessorConstructor },
1307 { "Transformiix NodeSet",
1308 TRANSFORMIIX_NODESET_CID,
1309 TRANSFORMIIX_NODESET_CONTRACTID,
1310 txNodeSetAdaptorConstructor },
1312 { "XML Serializer",
1313 NS_XMLSERIALIZER_CID,
1314 NS_XMLSERIALIZER_CONTRACTID,
1315 nsDOMSerializerConstructor },
1317 { "XMLHttpRequest",
1318 NS_XMLHTTPREQUEST_CID,
1319 NS_XMLHTTPREQUEST_CONTRACTID,
1320 nsXMLHttpRequestConstructor },
1322 { "DOM Parser",
1323 NS_DOMPARSER_CID,
1324 NS_DOMPARSER_CONTRACTID,
1325 nsDOMParserConstructor },
1327 { "DOM Storage",
1328 NS_DOMSTORAGE_CID,
1329 "@mozilla.org/dom/storage;1",
1330 NS_NewDOMStorage },
1332 { "DOM Storage Manager",
1333 NS_DOMSTORAGEMANAGER_CID,
1334 "@mozilla.org/dom/storagemanager;1",
1335 nsDOMStorageManagerConstructor },
1337 { "DOM JSON",
1338 NS_DOMJSON_CID,
1339 "@mozilla.org/dom/json;1",
1340 NS_NewJSON },
1342 { "Text Editor",
1343 NS_TEXTEDITOR_CID,
1344 "@mozilla.org/editor/texteditor;1",
1345 nsPlaintextEditorConstructor },
1347 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
1348 #ifdef ENABLE_EDITOR_API_LOG
1349 { "HTML Editor",
1350 NS_HTMLEDITOR_CID,
1351 "@mozilla.org/editor/htmleditor;1",
1352 nsHTMLEditorLogConstructor },
1353 #else
1354 { "HTML Editor",
1355 NS_HTMLEDITOR_CID,
1356 "@mozilla.org/editor/htmleditor;1",
1357 nsHTMLEditorConstructor },
1358 #endif
1359 #endif
1361 { "Editor Controller",
1362 NS_EDITORCONTROLLER_CID,
1363 "@mozilla.org/editor/editorcontroller;1",
1364 nsEditorControllerConstructor },
1366 { "Editor Command Table",
1367 NS_EDITORCOMMANDTABLE_CID,
1368 "", // no point in using a contract ID
1369 nsEditorCommandTableConstructor },
1371 #ifndef MOZILLA_PLAINTEXT_EDITOR_ONLY
1372 { NULL,
1373 NS_TEXTSERVICESDOCUMENT_CID,
1374 "@mozilla.org/textservices/textservicesdocument;1",
1375 nsTextServicesDocumentConstructor },
1376 #endif
1378 { "Geolocation Service",
1379 NS_GEOLOCATION_SERVICE_CID,
1380 "@mozilla.org/geolocation/service;1",
1381 nsGeolocatorServiceConstructor },
1386 NS_IMPL_NSGETMODULE_WITH_CTOR(nsLayoutModule, gComponents, Initialize)