CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / netwerk / build / nsNetModule.cpp
blobefc58e858f0aa452cd20a2e45a6ce6482aa45d51
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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.org 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):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include "necko-config.h"
40 #ifdef MOZ_IPC
41 #define ALLOW_LATE_NSHTTP_H_INCLUDE 1
42 #include "base/basictypes.h"
43 #endif
45 #include "nsCOMPtr.h"
46 #include "nsIClassInfoImpl.h"
47 #include "mozilla/ModuleUtils.h"
48 #include "nsIComponentManager.h"
49 #include "nsIServiceManager.h"
50 #include "nsICategoryManager.h"
51 #include "nsSocketProviderService.h"
52 #include "nscore.h"
53 #include "nsSimpleURI.h"
54 #include "nsSimpleNestedURI.h"
55 #include "nsLoadGroup.h"
56 #include "nsStreamLoader.h"
57 #include "nsUnicharStreamLoader.h"
58 #include "nsFileStreams.h"
59 #include "nsBufferedStreams.h"
60 #include "nsMIMEInputStream.h"
61 #include "nsSOCKSSocketProvider.h"
62 #include "nsCacheService.h"
63 #include "nsDiskCacheDeviceSQL.h"
64 #include "nsApplicationCache.h"
65 #include "nsMimeTypes.h"
66 #include "nsNetStrings.h"
67 #include "nsDNSPrefetch.h"
68 #include "nsAboutProtocolHandler.h"
70 #include "nsNetCID.h"
72 #if defined(XP_MACOSX)
73 #if !defined(__LP64__)
74 #define BUILD_APPLEFILE_DECODER 1
75 #endif
76 #else
77 #define BUILD_BINHEX_DECODER 1
78 #endif
80 ///////////////////////////////////////////////////////////////////////////////
82 #include "nsIOService.h"
83 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIOService, nsIOService::GetInstance)
85 #include "nsDNSService2.h"
86 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDNSService, Init)
88 #include "nsProtocolProxyService.h"
89 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsProtocolProxyService, Init)
91 #include "nsStreamTransportService.h"
92 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsStreamTransportService, Init)
94 #include "nsSocketTransportService2.h"
95 #undef LOG
96 #undef LOG_ENABLED
97 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSocketTransportService, Init)
99 #include "nsServerSocket.h"
100 NS_GENERIC_FACTORY_CONSTRUCTOR(nsServerSocket)
102 #include "nsUDPSocketProvider.h"
103 NS_GENERIC_FACTORY_CONSTRUCTOR(nsUDPSocketProvider)
105 #include "nsAsyncStreamCopier.h"
106 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAsyncStreamCopier)
108 #include "nsInputStreamPump.h"
109 NS_GENERIC_FACTORY_CONSTRUCTOR(nsInputStreamPump)
111 #include "nsInputStreamChannel.h"
112 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsInputStreamChannel, Init)
114 #include "nsDownloader.h"
115 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDownloader)
117 #include "nsSyncStreamListener.h"
118 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSyncStreamListener, Init)
120 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFileOutputStream)
122 NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsLoadGroup, Init)
124 #include "nsEffectiveTLDService.h"
125 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsEffectiveTLDService, Init)
127 #include "nsSerializationHelper.h"
128 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSerializationHelper)
130 #ifdef MOZ_IPC
131 #include "RedirectChannelRegistrar.h"
132 typedef mozilla::net::RedirectChannelRegistrar RedirectChannelRegistrar;
133 NS_GENERIC_FACTORY_CONSTRUCTOR(RedirectChannelRegistrar)
134 #endif
136 ///////////////////////////////////////////////////////////////////////////////
138 extern nsresult
139 net_NewIncrementalDownload(nsISupports *, const nsIID &, void **);
141 #define NS_INCREMENTALDOWNLOAD_CLASSNAME \
142 "nsIncrementalDownload"
143 #define NS_INCREMENTALDOWNLOAD_CID \
144 { /* a62af1ba-79b3-4896-8aaf-b148bfce4280 */ \
145 0xa62af1ba, \
146 0x79b3, \
147 0x4896, \
148 {0x8a, 0xaf, 0xb1, 0x48, 0xbf, 0xce, 0x42, 0x80} \
151 ///////////////////////////////////////////////////////////////////////////////
153 #include "nsStreamConverterService.h"
155 #ifdef BUILD_APPLEFILE_DECODER
156 #include "nsAppleFileDecoder.h"
157 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppleFileDecoder)
158 #endif
160 ///////////////////////////////////////////////////////////////////////////////
162 #include "nsMIMEHeaderParamImpl.h"
164 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMIMEHeaderParamImpl)
165 ///////////////////////////////////////////////////////////////////////////////
167 #include "nsRequestObserverProxy.h"
168 #include "nsSimpleStreamListener.h"
169 #include "nsDirIndexParser.h"
170 #include "nsDirIndex.h"
172 NS_GENERIC_FACTORY_CONSTRUCTOR(nsRequestObserverProxy)
173 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleStreamListener)
174 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsDirIndexParser, Init)
175 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirIndex)
177 ///////////////////////////////////////////////////////////////////////////////
179 #include "nsStreamListenerTee.h"
180 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStreamListenerTee)
182 ///////////////////////////////////////////////////////////////////////////////
184 #ifdef NECKO_COOKIES
185 #include "nsCookieService.h"
186 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsICookieService,
187 nsCookieService::GetXPCOMSingleton)
188 #endif
190 ///////////////////////////////////////////////////////////////////////////////
191 #ifdef NECKO_WIFI
193 #include "nsWifiMonitor.h"
194 #undef LOG
195 #undef LOG_ENABLED
196 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWifiMonitor)
198 #endif
200 ///////////////////////////////////////////////////////////////////////////////
201 // protocols
202 ///////////////////////////////////////////////////////////////////////////////
204 // about:blank is mandatory
205 #include "nsAboutProtocolHandler.h"
206 #include "nsAboutBlank.h"
207 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutProtocolHandler)
208 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeAboutProtocolHandler)
209 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNestedAboutURI)
211 #ifdef NECKO_PROTOCOL_about
212 // about
213 #ifdef NS_BUILD_REFCNT_LOGGING
214 #include "nsAboutBloat.h"
215 #endif
216 #include "nsAboutCache.h"
217 #include "nsAboutCacheEntry.h"
218 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAboutCacheEntry)
219 #endif
221 #ifdef NECKO_OFFLINE_CACHE
222 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsOfflineCacheDevice, nsOfflineCacheDevice::GetInstance)
223 NS_GENERIC_FACTORY_CONSTRUCTOR(nsApplicationCacheNamespace)
224 NS_GENERIC_FACTORY_CONSTRUCTOR(nsApplicationCache)
225 #endif
227 #ifdef NECKO_PROTOCOL_file
228 // file
229 #include "nsFileProtocolHandler.h"
230 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFileProtocolHandler, Init)
231 #endif
233 #ifdef NECKO_PROTOCOL_ftp
234 // ftp
235 #include "nsFtpProtocolHandler.h"
236 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsFtpProtocolHandler, Init)
237 #endif
239 #ifdef NECKO_PROTOCOL_http
240 // http/https
241 #include "nsHttpHandler.h"
242 #undef LOG
243 #undef LOG_ENABLED
244 #include "nsHttpAuthManager.h"
245 #include "nsHttpChannelAuthProvider.h"
246 #include "nsHttpBasicAuth.h"
247 #include "nsHttpDigestAuth.h"
248 #include "nsHttpNTLMAuth.h"
249 #include "nsHttpActivityDistributor.h"
250 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpNTLMAuth)
251 #undef LOG
252 #undef LOG_ENABLED
253 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpHandler, Init)
254 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpsHandler, Init)
255 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpAuthManager, Init)
256 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpChannelAuthProvider)
257 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHttpActivityDistributor, Init)
258 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpBasicAuth)
259 NS_GENERIC_FACTORY_CONSTRUCTOR(nsHttpDigestAuth)
260 #endif // !NECKO_PROTOCOL_http
262 #ifdef NECKO_PROTOCOL_res
263 // resource
264 #include "nsResProtocolHandler.h"
265 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsResProtocolHandler, Init)
266 NS_GENERIC_FACTORY_CONSTRUCTOR(nsResURL)
267 #endif
269 #ifdef NECKO_PROTOCOL_device
270 #include "nsDeviceProtocolHandler.h"
271 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceProtocolHandler)
272 #endif
274 #ifdef NECKO_PROTOCOL_viewsource
275 #include "nsViewSourceHandler.h"
276 NS_GENERIC_FACTORY_CONSTRUCTOR(nsViewSourceHandler)
277 #endif
279 #ifdef NECKO_PROTOCOL_data
280 #include "nsDataHandler.h"
281 #endif
283 #ifdef NECKO_PROTOCOL_wyciwyg
284 #include "nsWyciwygProtocolHandler.h"
285 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWyciwygProtocolHandler)
286 #endif
288 ///////////////////////////////////////////////////////////////////////////////
290 #include "nsURIChecker.h"
291 NS_GENERIC_FACTORY_CONSTRUCTOR(nsURIChecker)
293 ///////////////////////////////////////////////////////////////////////////////
295 #include "nsURLParsers.h"
296 NS_GENERIC_FACTORY_CONSTRUCTOR(nsNoAuthURLParser)
297 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAuthURLParser)
298 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStdURLParser)
300 #include "nsStandardURL.h"
301 NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandardURL)
303 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleURI)
305 NS_GENERIC_FACTORY_CONSTRUCTOR(nsSimpleNestedURI)
307 ///////////////////////////////////////////////////////////////////////////////
309 #include "nsIDNService.h"
310 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsIDNService, Init)
312 ///////////////////////////////////////////////////////////////////////////////
313 #if defined(XP_WIN)
314 #include "nsNotifyAddrListener.h"
315 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNotifyAddrListener, Init)
316 #elif defined(MOZ_WIDGET_COCOA)
317 #include "nsNetworkLinkService.h"
318 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetworkLinkService, Init)
319 #elif defined(MOZ_ENABLE_LIBCONIC)
320 #include "nsMaemoNetworkLinkService.h"
321 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMaemoNetworkLinkService, Init)
322 #elif defined(MOZ_ENABLE_QTNETWORK)
323 #include "nsQtNetworkLinkService.h"
324 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsQtNetworkLinkService, Init)
325 #elif defined(ANDROID)
326 #include "nsAndroidNetworkLinkService.h"
327 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAndroidNetworkLinkService)
328 #endif
330 ///////////////////////////////////////////////////////////////////////////////
332 #ifdef NECKO_PROTOCOL_ftp
333 #include "nsFTPDirListingConv.h"
334 nsresult NS_NewFTPDirListingConv(nsFTPDirListingConv** result);
335 #endif
337 #include "nsMultiMixedConv.h"
338 #include "nsHTTPCompressConv.h"
339 #include "mozTXTToHTMLConv.h"
340 #include "nsUnknownDecoder.h"
341 #include "nsTXTToHTMLConv.h"
342 #include "nsIndexedToHTML.h"
343 #ifdef BUILD_BINHEX_DECODER
344 #include "nsBinHexDecoder.h"
345 #endif
347 nsresult NS_NewMultiMixedConv (nsMultiMixedConv** result);
348 nsresult MOZ_NewTXTToHTMLConv (mozTXTToHTMLConv** result);
349 nsresult NS_NewHTTPCompressConv (nsHTTPCompressConv ** result);
350 nsresult NS_NewNSTXTToHTMLConv(nsTXTToHTMLConv** result);
351 nsresult NS_NewStreamConv(nsStreamConverterService **aStreamConv);
353 #define FTP_TO_INDEX "?from=text/ftp-dir&to=application/http-index-format"
354 #define INDEX_TO_HTML "?from=application/http-index-format&to=text/html"
355 #define MULTI_MIXED_X "?from=multipart/x-mixed-replace&to=*/*"
356 #define MULTI_MIXED "?from=multipart/mixed&to=*/*"
357 #define MULTI_BYTERANGES "?from=multipart/byteranges&to=*/*"
358 #define UNKNOWN_CONTENT "?from=" UNKNOWN_CONTENT_TYPE "&to=*/*"
359 #define GZIP_TO_UNCOMPRESSED "?from=gzip&to=uncompressed"
360 #define XGZIP_TO_UNCOMPRESSED "?from=x-gzip&to=uncompressed"
361 #define COMPRESS_TO_UNCOMPRESSED "?from=compress&to=uncompressed"
362 #define XCOMPRESS_TO_UNCOMPRESSED "?from=x-compress&to=uncompressed"
363 #define DEFLATE_TO_UNCOMPRESSED "?from=deflate&to=uncompressed"
364 #define PLAIN_TO_HTML "?from=text/plain&to=text/html"
366 #ifdef BUILD_BINHEX_DECODER
367 #define BINHEX_TO_WILD "?from=application/mac-binhex40&to=*/*"
368 #endif
370 static const mozilla::Module::CategoryEntry kNeckoCategories[] = {
371 { NS_ISTREAMCONVERTER_KEY, FTP_TO_INDEX, "" },
372 { NS_ISTREAMCONVERTER_KEY, INDEX_TO_HTML, "" },
373 { NS_ISTREAMCONVERTER_KEY, MULTI_MIXED_X, "" },
374 { NS_ISTREAMCONVERTER_KEY, MULTI_MIXED, "" },
375 { NS_ISTREAMCONVERTER_KEY, MULTI_BYTERANGES, "" },
376 { NS_ISTREAMCONVERTER_KEY, UNKNOWN_CONTENT, "" },
377 { NS_ISTREAMCONVERTER_KEY, GZIP_TO_UNCOMPRESSED, "" },
378 { NS_ISTREAMCONVERTER_KEY, XGZIP_TO_UNCOMPRESSED, "" },
379 { NS_ISTREAMCONVERTER_KEY, COMPRESS_TO_UNCOMPRESSED, "" },
380 { NS_ISTREAMCONVERTER_KEY, XCOMPRESS_TO_UNCOMPRESSED, "" },
381 { NS_ISTREAMCONVERTER_KEY, DEFLATE_TO_UNCOMPRESSED, "" },
382 #ifdef BUILD_BINHEX_DECODER
383 { NS_ISTREAMCONVERTER_KEY, BINHEX_TO_WILD, "" },
384 #endif
385 { NS_ISTREAMCONVERTER_KEY, PLAIN_TO_HTML, "" },
386 NS_BINARYDETECTOR_CATEGORYENTRY,
387 { NULL }
390 #ifdef BUILD_BINHEX_DECODER
391 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinHexDecoder)
392 #endif
394 static nsresult
395 CreateNewStreamConvServiceFactory(nsISupports* aOuter, REFNSIID aIID, void **aResult)
397 if (!aResult) {
398 return NS_ERROR_INVALID_POINTER;
400 if (aOuter) {
401 *aResult = nsnull;
402 return NS_ERROR_NO_AGGREGATION;
404 nsStreamConverterService* inst = nsnull;
405 nsresult rv = NS_NewStreamConv(&inst);
406 if (NS_FAILED(rv)) {
407 *aResult = nsnull;
408 return rv;
410 rv = inst->QueryInterface(aIID, aResult);
411 if (NS_FAILED(rv)) {
412 *aResult = nsnull;
414 NS_RELEASE(inst); /* get rid of extra refcnt */
415 return rv;
418 #ifdef NECKO_PROTOCOL_ftp
419 static nsresult
420 CreateNewFTPDirListingConv(nsISupports* aOuter, REFNSIID aIID, void **aResult)
422 if (!aResult) {
423 return NS_ERROR_INVALID_POINTER;
425 if (aOuter) {
426 *aResult = nsnull;
427 return NS_ERROR_NO_AGGREGATION;
429 nsFTPDirListingConv* inst = nsnull;
430 nsresult rv = NS_NewFTPDirListingConv(&inst);
431 if (NS_FAILED(rv)) {
432 *aResult = nsnull;
433 return rv;
435 rv = inst->QueryInterface(aIID, aResult);
436 if (NS_FAILED(rv)) {
437 *aResult = nsnull;
439 NS_RELEASE(inst); /* get rid of extra refcnt */
440 return rv;
442 #endif
444 static nsresult
445 CreateNewMultiMixedConvFactory(nsISupports* aOuter, REFNSIID aIID, void **aResult)
447 if (!aResult) {
448 return NS_ERROR_INVALID_POINTER;
450 if (aOuter) {
451 *aResult = nsnull;
452 return NS_ERROR_NO_AGGREGATION;
454 nsMultiMixedConv* inst = nsnull;
455 nsresult rv = NS_NewMultiMixedConv(&inst);
456 if (NS_FAILED(rv)) {
457 *aResult = nsnull;
458 return rv;
460 rv = inst->QueryInterface(aIID, aResult);
461 if (NS_FAILED(rv)) {
462 *aResult = nsnull;
464 NS_RELEASE(inst); /* get rid of extra refcnt */
465 return rv;
468 static nsresult
469 CreateNewTXTToHTMLConvFactory(nsISupports* aOuter, REFNSIID aIID, void **aResult)
471 if (!aResult) {
472 return NS_ERROR_INVALID_POINTER;
474 if (aOuter) {
475 *aResult = nsnull;
476 return NS_ERROR_NO_AGGREGATION;
478 mozTXTToHTMLConv* inst = nsnull;
479 nsresult rv = MOZ_NewTXTToHTMLConv(&inst);
480 if (NS_FAILED(rv)) {
481 *aResult = nsnull;
482 return rv;
484 rv = inst->QueryInterface(aIID, aResult);
485 if (NS_FAILED(rv)) {
486 *aResult = nsnull;
488 NS_RELEASE(inst); /* get rid of extra refcnt */
489 return rv;
492 static nsresult
493 CreateNewHTTPCompressConvFactory (nsISupports* aOuter, REFNSIID aIID, void **aResult)
495 if (!aResult) {
496 return NS_ERROR_INVALID_POINTER;
498 if (aOuter) {
499 *aResult = nsnull;
500 return NS_ERROR_NO_AGGREGATION;
502 nsHTTPCompressConv* inst = nsnull;
503 nsresult rv = NS_NewHTTPCompressConv (&inst);
504 if (NS_FAILED(rv)) {
505 *aResult = nsnull;
506 return rv;
508 rv = inst->QueryInterface(aIID, aResult);
509 if (NS_FAILED(rv)) {
510 *aResult = nsnull;
512 NS_RELEASE(inst); /* get rid of extra refcnt */
513 return rv;
516 static nsresult
517 CreateNewUnknownDecoderFactory(nsISupports *aOuter, REFNSIID aIID, void **aResult)
519 nsresult rv;
521 if (!aResult) {
522 return NS_ERROR_NULL_POINTER;
524 *aResult = nsnull;
526 if (aOuter) {
527 return NS_ERROR_NO_AGGREGATION;
530 nsUnknownDecoder *inst;
532 inst = new nsUnknownDecoder();
533 if (!inst) {
534 return NS_ERROR_OUT_OF_MEMORY;
536 NS_ADDREF(inst);
537 rv = inst->QueryInterface(aIID, aResult);
538 NS_RELEASE(inst);
540 return rv;
543 static nsresult
544 CreateNewBinaryDetectorFactory(nsISupports *aOuter, REFNSIID aIID, void **aResult)
546 nsresult rv;
548 if (!aResult) {
549 return NS_ERROR_NULL_POINTER;
551 *aResult = nsnull;
553 if (aOuter) {
554 return NS_ERROR_NO_AGGREGATION;
557 nsBinaryDetector* inst = new nsBinaryDetector();
558 if (!inst) {
559 return NS_ERROR_OUT_OF_MEMORY;
561 NS_ADDREF(inst);
562 rv = inst->QueryInterface(aIID, aResult);
563 NS_RELEASE(inst);
565 return rv;
568 static nsresult
569 CreateNewNSTXTToHTMLConvFactory(nsISupports *aOuter, REFNSIID aIID, void **aResult)
571 nsresult rv;
573 if (!aResult) {
574 return NS_ERROR_NULL_POINTER;
576 *aResult = nsnull;
578 if (aOuter) {
579 return NS_ERROR_NO_AGGREGATION;
582 nsTXTToHTMLConv *inst;
584 inst = new nsTXTToHTMLConv();
585 if (!inst) return NS_ERROR_OUT_OF_MEMORY;
587 NS_ADDREF(inst);
588 rv = inst->Init();
589 if (NS_FAILED(rv)) {
590 delete inst;
591 return rv;
593 rv = inst->QueryInterface(aIID, aResult);
594 NS_RELEASE(inst);
596 return rv;
599 ///////////////////////////////////////////////////////////////////////////////
600 // Module implementation for the net library
602 // Net module startup hook
603 static nsresult nsNetStartup()
605 gNetStrings = new nsNetStrings();
606 return gNetStrings ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
610 // Net module shutdown hook
611 static void nsNetShutdown()
613 // Release the url parser that the stdurl is holding.
614 nsStandardURL::ShutdownGlobalObjects();
616 // Release buffer cache
617 NS_IF_RELEASE(nsIOService::gBufferCache);
619 // Release global state used by the URL helper module.
620 net_ShutdownURLHelper();
621 #ifdef XP_MACOSX
622 net_ShutdownURLHelperOSX();
623 #endif
625 // Release necko strings
626 delete gNetStrings;
627 gNetStrings = nsnull;
629 // Release DNS service reference.
630 nsDNSPrefetch::Shutdown();
633 NS_DEFINE_NAMED_CID(NS_IOSERVICE_CID);
634 NS_DEFINE_NAMED_CID(NS_STREAMTRANSPORTSERVICE_CID);
635 NS_DEFINE_NAMED_CID(NS_SOCKETTRANSPORTSERVICE_CID);
636 NS_DEFINE_NAMED_CID(NS_SERVERSOCKET_CID);
637 NS_DEFINE_NAMED_CID(NS_SOCKETPROVIDERSERVICE_CID);
638 NS_DEFINE_NAMED_CID(NS_DNSSERVICE_CID);
639 NS_DEFINE_NAMED_CID(NS_IDNSERVICE_CID);
640 NS_DEFINE_NAMED_CID(NS_EFFECTIVETLDSERVICE_CID);
641 NS_DEFINE_NAMED_CID(NS_SIMPLEURI_CID);
642 NS_DEFINE_NAMED_CID(NS_SIMPLENESTEDURI_CID);
643 NS_DEFINE_NAMED_CID(NS_ASYNCSTREAMCOPIER_CID);
644 NS_DEFINE_NAMED_CID(NS_INPUTSTREAMPUMP_CID);
645 NS_DEFINE_NAMED_CID(NS_INPUTSTREAMCHANNEL_CID);
646 NS_DEFINE_NAMED_CID(NS_STREAMLOADER_CID);
647 NS_DEFINE_NAMED_CID(NS_UNICHARSTREAMLOADER_CID);
648 NS_DEFINE_NAMED_CID(NS_DOWNLOADER_CID);
649 NS_DEFINE_NAMED_CID(NS_SYNCSTREAMLISTENER_CID);
650 NS_DEFINE_NAMED_CID(NS_REQUESTOBSERVERPROXY_CID);
651 NS_DEFINE_NAMED_CID(NS_SIMPLESTREAMLISTENER_CID);
652 NS_DEFINE_NAMED_CID(NS_STREAMLISTENERTEE_CID);
653 NS_DEFINE_NAMED_CID(NS_LOADGROUP_CID);
654 NS_DEFINE_NAMED_CID(NS_LOCALFILEINPUTSTREAM_CID);
655 NS_DEFINE_NAMED_CID(NS_LOCALFILEOUTPUTSTREAM_CID);
656 NS_DEFINE_NAMED_CID(NS_PARTIALLOCALFILEINPUTSTREAM_CID);
657 NS_DEFINE_NAMED_CID(NS_SAFELOCALFILEOUTPUTSTREAM_CID);
658 NS_DEFINE_NAMED_CID(NS_URICHECKER_CID);
659 NS_DEFINE_NAMED_CID(NS_INCREMENTALDOWNLOAD_CID);
660 NS_DEFINE_NAMED_CID(NS_STDURLPARSER_CID);
661 NS_DEFINE_NAMED_CID(NS_NOAUTHURLPARSER_CID);
662 NS_DEFINE_NAMED_CID(NS_AUTHURLPARSER_CID);
663 NS_DEFINE_NAMED_CID(NS_STANDARDURL_CID);
664 NS_DEFINE_NAMED_CID(NS_BUFFEREDINPUTSTREAM_CID);
665 NS_DEFINE_NAMED_CID(NS_BUFFEREDOUTPUTSTREAM_CID);
666 NS_DEFINE_NAMED_CID(NS_MIMEINPUTSTREAM_CID);
667 NS_DEFINE_NAMED_CID(NS_PROTOCOLPROXYSERVICE_CID);
668 NS_DEFINE_NAMED_CID(NS_STREAMCONVERTERSERVICE_CID);
669 #ifdef BUILD_APPLEFILE_DECODER
670 NS_DEFINE_NAMED_CID(NS_APPLEFILEDECODER_CID);
671 #endif
672 #ifdef NECKO_PROTOCOL_ftp
673 NS_DEFINE_NAMED_CID(NS_FTPDIRLISTINGCONVERTER_CID);
674 #endif
675 NS_DEFINE_NAMED_CID(NS_NSINDEXEDTOHTMLCONVERTER_CID);
676 NS_DEFINE_NAMED_CID(NS_DIRINDEXPARSER_CID);
677 NS_DEFINE_NAMED_CID(NS_MULTIMIXEDCONVERTER_CID);
678 NS_DEFINE_NAMED_CID(NS_UNKNOWNDECODER_CID);
679 NS_DEFINE_NAMED_CID(NS_BINARYDETECTOR_CID);
680 NS_DEFINE_NAMED_CID(NS_HTTPCOMPRESSCONVERTER_CID);
681 NS_DEFINE_NAMED_CID(NS_NSTXTTOHTMLCONVERTER_CID);
682 #ifdef BUILD_BINHEX_DECODER
683 NS_DEFINE_NAMED_CID(NS_BINHEXDECODER_CID);
684 #endif
685 NS_DEFINE_NAMED_CID(MOZITXTTOHTMLCONV_CID);
686 NS_DEFINE_NAMED_CID(NS_DIRINDEX_CID);
687 NS_DEFINE_NAMED_CID(NS_MIMEHEADERPARAM_CID);
688 #ifdef NECKO_PROTOCOL_file
689 NS_DEFINE_NAMED_CID(NS_FILEPROTOCOLHANDLER_CID);
690 #endif
691 #ifdef NECKO_PROTOCOL_http
692 NS_DEFINE_NAMED_CID(NS_HTTPPROTOCOLHANDLER_CID);
693 NS_DEFINE_NAMED_CID(NS_HTTPSPROTOCOLHANDLER_CID);
694 NS_DEFINE_NAMED_CID(NS_HTTPBASICAUTH_CID);
695 NS_DEFINE_NAMED_CID(NS_HTTPDIGESTAUTH_CID);
696 NS_DEFINE_NAMED_CID(NS_HTTPNTLMAUTH_CID);
697 NS_DEFINE_NAMED_CID(NS_HTTPAUTHMANAGER_CID);
698 NS_DEFINE_NAMED_CID(NS_HTTPCHANNELAUTHPROVIDER_CID);
699 NS_DEFINE_NAMED_CID(NS_HTTPACTIVITYDISTRIBUTOR_CID);
700 #endif // !NECKO_PROTOCOL_http
701 #ifdef NECKO_PROTOCOL_ftp
702 NS_DEFINE_NAMED_CID(NS_FTPPROTOCOLHANDLER_CID);
703 #endif
704 #ifdef NECKO_PROTOCOL_res
705 NS_DEFINE_NAMED_CID(NS_RESPROTOCOLHANDLER_CID);
706 NS_DEFINE_NAMED_CID(NS_RESURL_CID);
707 #endif
708 NS_DEFINE_NAMED_CID(NS_ABOUTPROTOCOLHANDLER_CID);
709 NS_DEFINE_NAMED_CID(NS_SAFEABOUTPROTOCOLHANDLER_CID);
710 NS_DEFINE_NAMED_CID(NS_ABOUT_BLANK_MODULE_CID);
711 NS_DEFINE_NAMED_CID(NS_NESTEDABOUTURI_CID);
712 #ifdef NECKO_PROTOCOL_about
713 #ifdef NS_BUILD_REFCNT_LOGGING
714 NS_DEFINE_NAMED_CID(NS_ABOUT_BLOAT_MODULE_CID);
715 #endif
716 NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_MODULE_CID);
717 NS_DEFINE_NAMED_CID(NS_ABOUT_CACHE_ENTRY_MODULE_CID);
718 #endif
719 NS_DEFINE_NAMED_CID(NS_SOCKSSOCKETPROVIDER_CID);
720 NS_DEFINE_NAMED_CID(NS_SOCKS4SOCKETPROVIDER_CID);
721 NS_DEFINE_NAMED_CID(NS_UDPSOCKETPROVIDER_CID);
722 NS_DEFINE_NAMED_CID(NS_CACHESERVICE_CID);
723 #ifdef NECKO_OFFLINE_CACHE
724 NS_DEFINE_NAMED_CID(NS_APPLICATIONCACHESERVICE_CID);
725 NS_DEFINE_NAMED_CID(NS_APPLICATIONCACHENAMESPACE_CID);
726 NS_DEFINE_NAMED_CID(NS_APPLICATIONCACHE_CID);
727 #endif
728 #ifdef NECKO_COOKIES
729 NS_DEFINE_NAMED_CID(NS_COOKIEMANAGER_CID);
730 NS_DEFINE_NAMED_CID(NS_COOKIESERVICE_CID);
731 #endif
732 #ifdef NECKO_WIFI
733 NS_DEFINE_NAMED_CID(NS_WIFI_MONITOR_COMPONENT_CID);
734 #endif
735 #ifdef NECKO_PROTOCOL_data
736 NS_DEFINE_NAMED_CID(NS_DATAPROTOCOLHANDLER_CID);
737 #endif
738 #ifdef NECKO_PROTOCOL_device
739 NS_DEFINE_NAMED_CID(NS_DEVICEPROTOCOLHANDLER_CID);
740 #endif
741 #ifdef NECKO_PROTOCOL_viewsource
742 NS_DEFINE_NAMED_CID(NS_VIEWSOURCEHANDLER_CID);
743 #endif
744 #ifdef NECKO_PROTOCOL_wyciwyg
745 NS_DEFINE_NAMED_CID(NS_WYCIWYGPROTOCOLHANDLER_CID);
746 #endif
747 #if defined(XP_WIN)
748 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
749 #elif defined(MOZ_WIDGET_COCOA)
750 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
751 #elif defined(MOZ_ENABLE_LIBCONIC)
752 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
753 #elif defined(MOZ_ENABLE_QTNETWORK)
754 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
755 #elif defined(ANDROID)
756 NS_DEFINE_NAMED_CID(NS_NETWORK_LINK_SERVICE_CID);
757 #endif
758 NS_DEFINE_NAMED_CID(NS_SERIALIZATION_HELPER_CID);
759 #ifdef MOZ_IPC
760 NS_DEFINE_NAMED_CID(NS_REDIRECTCHANNELREGISTRAR_CID);
761 #endif
763 static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
764 { &kNS_IOSERVICE_CID, false, NULL, nsIOServiceConstructor },
765 { &kNS_STREAMTRANSPORTSERVICE_CID, false, NULL, nsStreamTransportServiceConstructor },
766 { &kNS_SOCKETTRANSPORTSERVICE_CID, false, NULL, nsSocketTransportServiceConstructor },
767 { &kNS_SERVERSOCKET_CID, false, NULL, nsServerSocketConstructor },
768 { &kNS_SOCKETPROVIDERSERVICE_CID, false, NULL, nsSocketProviderService::Create },
769 { &kNS_DNSSERVICE_CID, false, NULL, nsDNSServiceConstructor },
770 { &kNS_IDNSERVICE_CID, false, NULL, nsIDNServiceConstructor },
771 { &kNS_EFFECTIVETLDSERVICE_CID, false, NULL, nsEffectiveTLDServiceConstructor },
772 { &kNS_SIMPLEURI_CID, false, NULL, nsSimpleURIConstructor },
773 { &kNS_SIMPLENESTEDURI_CID, false, NULL, nsSimpleNestedURIConstructor },
774 { &kNS_ASYNCSTREAMCOPIER_CID, false, NULL, nsAsyncStreamCopierConstructor },
775 { &kNS_INPUTSTREAMPUMP_CID, false, NULL, nsInputStreamPumpConstructor },
776 { &kNS_INPUTSTREAMCHANNEL_CID, false, NULL, nsInputStreamChannelConstructor },
777 { &kNS_STREAMLOADER_CID, false, NULL, nsStreamLoader::Create },
778 { &kNS_UNICHARSTREAMLOADER_CID, false, NULL, nsUnicharStreamLoader::Create },
779 { &kNS_DOWNLOADER_CID, false, NULL, nsDownloaderConstructor },
780 { &kNS_SYNCSTREAMLISTENER_CID, false, NULL, nsSyncStreamListenerConstructor },
781 { &kNS_REQUESTOBSERVERPROXY_CID, false, NULL, nsRequestObserverProxyConstructor },
782 { &kNS_SIMPLESTREAMLISTENER_CID, false, NULL, nsSimpleStreamListenerConstructor },
783 { &kNS_STREAMLISTENERTEE_CID, false, NULL, nsStreamListenerTeeConstructor },
784 { &kNS_LOADGROUP_CID, false, NULL, nsLoadGroupConstructor },
785 { &kNS_LOCALFILEINPUTSTREAM_CID, false, NULL, nsFileInputStream::Create },
786 { &kNS_LOCALFILEOUTPUTSTREAM_CID, false, NULL, nsFileOutputStream::Create },
787 { &kNS_PARTIALLOCALFILEINPUTSTREAM_CID, false, NULL, nsPartialFileInputStream::Create },
788 { &kNS_SAFELOCALFILEOUTPUTSTREAM_CID, false, NULL, nsSafeFileOutputStreamConstructor },
789 { &kNS_URICHECKER_CID, false, NULL, nsURICheckerConstructor },
790 { &kNS_INCREMENTALDOWNLOAD_CID, false, NULL, net_NewIncrementalDownload },
791 { &kNS_STDURLPARSER_CID, false, NULL, nsStdURLParserConstructor },
792 { &kNS_NOAUTHURLPARSER_CID, false, NULL, nsNoAuthURLParserConstructor },
793 { &kNS_AUTHURLPARSER_CID, false, NULL, nsAuthURLParserConstructor },
794 { &kNS_STANDARDURL_CID, false, NULL, nsStandardURLConstructor },
795 { &kNS_BUFFEREDINPUTSTREAM_CID, false, NULL, nsBufferedInputStream::Create },
796 { &kNS_BUFFEREDOUTPUTSTREAM_CID, false, NULL, nsBufferedOutputStream::Create },
797 { &kNS_MIMEINPUTSTREAM_CID, false, NULL, nsMIMEInputStreamConstructor },
798 { &kNS_PROTOCOLPROXYSERVICE_CID, true, NULL, nsProtocolProxyServiceConstructor },
799 { &kNS_STREAMCONVERTERSERVICE_CID, false, NULL, CreateNewStreamConvServiceFactory },
800 #ifdef BUILD_APPLEFILE_DECODER
801 { &kNS_APPLEFILEDECODER_CID, false, NULL, nsAppleFileDecoderConstructor },
802 #endif
803 #ifdef NECKO_PROTOCOL_ftp
804 { &kNS_FTPDIRLISTINGCONVERTER_CID, false, NULL, CreateNewFTPDirListingConv },
805 #endif
806 { &kNS_NSINDEXEDTOHTMLCONVERTER_CID, false, NULL, nsIndexedToHTML::Create },
807 { &kNS_DIRINDEXPARSER_CID, false, NULL, nsDirIndexParserConstructor },
808 { &kNS_MULTIMIXEDCONVERTER_CID, false, NULL, CreateNewMultiMixedConvFactory },
809 { &kNS_UNKNOWNDECODER_CID, false, NULL, CreateNewUnknownDecoderFactory },
810 { &kNS_BINARYDETECTOR_CID, false, NULL, CreateNewBinaryDetectorFactory },
811 { &kNS_HTTPCOMPRESSCONVERTER_CID, false, NULL, CreateNewHTTPCompressConvFactory },
812 { &kNS_NSTXTTOHTMLCONVERTER_CID, false, NULL, CreateNewNSTXTToHTMLConvFactory },
813 #ifdef BUILD_BINHEX_DECODER
814 { &kNS_BINHEXDECODER_CID, false, NULL, nsBinHexDecoderConstructor },
815 #endif
816 { &kMOZITXTTOHTMLCONV_CID, false, NULL, CreateNewTXTToHTMLConvFactory },
817 { &kNS_DIRINDEX_CID, false, NULL, nsDirIndexConstructor },
818 { &kNS_MIMEHEADERPARAM_CID, false, NULL, nsMIMEHeaderParamImplConstructor },
819 #ifdef NECKO_PROTOCOL_file
820 { &kNS_FILEPROTOCOLHANDLER_CID, false, NULL, nsFileProtocolHandlerConstructor },
821 #endif
822 #ifdef NECKO_PROTOCOL_http
823 { &kNS_HTTPPROTOCOLHANDLER_CID, false, NULL, nsHttpHandlerConstructor },
824 { &kNS_HTTPSPROTOCOLHANDLER_CID, false, NULL, nsHttpsHandlerConstructor },
825 { &kNS_HTTPBASICAUTH_CID, false, NULL, nsHttpBasicAuthConstructor },
826 { &kNS_HTTPDIGESTAUTH_CID, false, NULL, nsHttpDigestAuthConstructor },
827 { &kNS_HTTPNTLMAUTH_CID, false, NULL, nsHttpNTLMAuthConstructor },
828 { &kNS_HTTPAUTHMANAGER_CID, false, NULL, nsHttpAuthManagerConstructor },
829 { &kNS_HTTPCHANNELAUTHPROVIDER_CID, false, NULL, nsHttpChannelAuthProviderConstructor },
830 { &kNS_HTTPACTIVITYDISTRIBUTOR_CID, false, NULL, nsHttpActivityDistributorConstructor },
831 #endif // !NECKO_PROTOCOL_http
832 #ifdef NECKO_PROTOCOL_ftp
833 { &kNS_FTPPROTOCOLHANDLER_CID, false, NULL, nsFtpProtocolHandlerConstructor },
834 #endif
835 #ifdef NECKO_PROTOCOL_res
836 { &kNS_RESPROTOCOLHANDLER_CID, false, NULL, nsResProtocolHandlerConstructor },
837 { &kNS_RESURL_CID, false, NULL, nsResURLConstructor },
838 #endif
839 { &kNS_ABOUTPROTOCOLHANDLER_CID, false, NULL, nsAboutProtocolHandlerConstructor },
840 { &kNS_SAFEABOUTPROTOCOLHANDLER_CID, false, NULL, nsSafeAboutProtocolHandlerConstructor },
841 { &kNS_ABOUT_BLANK_MODULE_CID, false, NULL, nsAboutBlank::Create },
842 { &kNS_NESTEDABOUTURI_CID, false, NULL, nsNestedAboutURIConstructor },
843 #ifdef NECKO_PROTOCOL_about
844 #ifdef NS_BUILD_REFCNT_LOGGING
845 { &kNS_ABOUT_BLOAT_MODULE_CID, false, NULL, nsAboutBloat::Create },
846 #endif
847 { &kNS_ABOUT_CACHE_MODULE_CID, false, NULL, nsAboutCache::Create },
848 { &kNS_ABOUT_CACHE_ENTRY_MODULE_CID, false, NULL, nsAboutCacheEntryConstructor },
849 #endif
850 { &kNS_SOCKSSOCKETPROVIDER_CID, false, NULL, nsSOCKSSocketProvider::CreateV5 },
851 { &kNS_SOCKS4SOCKETPROVIDER_CID, false, NULL, nsSOCKSSocketProvider::CreateV4 },
852 { &kNS_UDPSOCKETPROVIDER_CID, false, NULL, nsUDPSocketProviderConstructor },
853 { &kNS_CACHESERVICE_CID, false, NULL, nsCacheService::Create },
854 #ifdef NECKO_OFFLINE_CACHE
855 { &kNS_APPLICATIONCACHESERVICE_CID, false, NULL, nsOfflineCacheDeviceConstructor },
856 { &kNS_APPLICATIONCACHENAMESPACE_CID, false, NULL, nsApplicationCacheNamespaceConstructor },
857 { &kNS_APPLICATIONCACHE_CID, false, NULL, nsApplicationCacheConstructor },
858 #endif
859 #ifdef NECKO_COOKIES
860 { &kNS_COOKIEMANAGER_CID, false, NULL, nsICookieServiceConstructor },
861 { &kNS_COOKIESERVICE_CID, false, NULL, nsICookieServiceConstructor },
862 #endif
863 #ifdef NECKO_WIFI
864 { &kNS_WIFI_MONITOR_COMPONENT_CID, false, NULL, nsWifiMonitorConstructor },
865 #endif
866 #ifdef NECKO_PROTOCOL_data
867 { &kNS_DATAPROTOCOLHANDLER_CID, false, NULL, nsDataHandler::Create },
868 #endif
869 #ifdef NECKO_PROTOCOL_device
870 { &kNS_DEVICEPROTOCOLHANDLER_CID, false, NULL, nsDeviceProtocolHandlerConstructor},
871 #endif
872 #ifdef NECKO_PROTOCOL_viewsource
873 { &kNS_VIEWSOURCEHANDLER_CID, false, NULL, nsViewSourceHandlerConstructor },
874 #endif
875 #ifdef NECKO_PROTOCOL_wyciwyg
876 { &kNS_WYCIWYGPROTOCOLHANDLER_CID, false, NULL, nsWyciwygProtocolHandlerConstructor },
877 #endif
878 #if defined(XP_WIN)
879 { &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsNotifyAddrListenerConstructor },
880 #elif defined(MOZ_WIDGET_COCOA)
881 { &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsNetworkLinkServiceConstructor },
882 #elif defined(MOZ_ENABLE_LIBCONIC)
883 { &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsMaemoNetworkLinkServiceConstructor },
884 #elif defined(MOZ_ENABLE_QTNETWORK)
885 { &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsQtNetworkLinkServiceConstructor },
886 #elif defined(ANDROID)
887 { &kNS_NETWORK_LINK_SERVICE_CID, false, NULL, nsAndroidNetworkLinkServiceConstructor },
888 #endif
889 { &kNS_SERIALIZATION_HELPER_CID, false, NULL, nsSerializationHelperConstructor },
890 #ifdef MOZ_IPC
891 { &kNS_REDIRECTCHANNELREGISTRAR_CID, false, NULL, RedirectChannelRegistrarConstructor },
892 #endif
893 { NULL }
896 static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
897 { NS_IOSERVICE_CONTRACTID, &kNS_IOSERVICE_CID },
898 { NS_NETUTIL_CONTRACTID, &kNS_IOSERVICE_CID },
899 { NS_STREAMTRANSPORTSERVICE_CONTRACTID, &kNS_STREAMTRANSPORTSERVICE_CID },
900 { NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &kNS_SOCKETTRANSPORTSERVICE_CID },
901 { NS_SERVERSOCKET_CONTRACTID, &kNS_SERVERSOCKET_CID },
902 { NS_SOCKETPROVIDERSERVICE_CONTRACTID, &kNS_SOCKETPROVIDERSERVICE_CID },
903 { NS_DNSSERVICE_CONTRACTID, &kNS_DNSSERVICE_CID },
904 { NS_IDNSERVICE_CONTRACTID, &kNS_IDNSERVICE_CID },
905 { NS_EFFECTIVETLDSERVICE_CONTRACTID, &kNS_EFFECTIVETLDSERVICE_CID },
906 { NS_SIMPLEURI_CONTRACTID, &kNS_SIMPLEURI_CID },
907 { NS_ASYNCSTREAMCOPIER_CONTRACTID, &kNS_ASYNCSTREAMCOPIER_CID },
908 { NS_INPUTSTREAMPUMP_CONTRACTID, &kNS_INPUTSTREAMPUMP_CID },
909 { NS_INPUTSTREAMCHANNEL_CONTRACTID, &kNS_INPUTSTREAMCHANNEL_CID },
910 { NS_STREAMLOADER_CONTRACTID, &kNS_STREAMLOADER_CID },
911 { NS_UNICHARSTREAMLOADER_CONTRACTID, &kNS_UNICHARSTREAMLOADER_CID },
912 { NS_DOWNLOADER_CONTRACTID, &kNS_DOWNLOADER_CID },
913 { NS_SYNCSTREAMLISTENER_CONTRACTID, &kNS_SYNCSTREAMLISTENER_CID },
914 { NS_REQUESTOBSERVERPROXY_CONTRACTID, &kNS_REQUESTOBSERVERPROXY_CID },
915 { NS_SIMPLESTREAMLISTENER_CONTRACTID, &kNS_SIMPLESTREAMLISTENER_CID },
916 { NS_STREAMLISTENERTEE_CONTRACTID, &kNS_STREAMLISTENERTEE_CID },
917 { NS_LOADGROUP_CONTRACTID, &kNS_LOADGROUP_CID },
918 { NS_LOCALFILEINPUTSTREAM_CONTRACTID, &kNS_LOCALFILEINPUTSTREAM_CID },
919 { NS_LOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_LOCALFILEOUTPUTSTREAM_CID },
920 { NS_PARTIALLOCALFILEINPUTSTREAM_CONTRACTID, &kNS_PARTIALLOCALFILEINPUTSTREAM_CID },
921 { NS_SAFELOCALFILEOUTPUTSTREAM_CONTRACTID, &kNS_SAFELOCALFILEOUTPUTSTREAM_CID },
922 { NS_URICHECKER_CONTRACT_ID, &kNS_URICHECKER_CID },
923 { NS_INCREMENTALDOWNLOAD_CONTRACTID, &kNS_INCREMENTALDOWNLOAD_CID },
924 { NS_STDURLPARSER_CONTRACTID, &kNS_STDURLPARSER_CID },
925 { NS_NOAUTHURLPARSER_CONTRACTID, &kNS_NOAUTHURLPARSER_CID },
926 { NS_AUTHURLPARSER_CONTRACTID, &kNS_AUTHURLPARSER_CID },
927 { NS_STANDARDURL_CONTRACTID, &kNS_STANDARDURL_CID },
928 { NS_BUFFEREDINPUTSTREAM_CONTRACTID, &kNS_BUFFEREDINPUTSTREAM_CID },
929 { NS_BUFFEREDOUTPUTSTREAM_CONTRACTID, &kNS_BUFFEREDOUTPUTSTREAM_CID },
930 { NS_MIMEINPUTSTREAM_CONTRACTID, &kNS_MIMEINPUTSTREAM_CID },
931 { NS_PROTOCOLPROXYSERVICE_CONTRACTID, &kNS_PROTOCOLPROXYSERVICE_CID },
932 { NS_STREAMCONVERTERSERVICE_CONTRACTID, &kNS_STREAMCONVERTERSERVICE_CID },
933 #ifdef BUILD_APPLEFILE_DECODER
934 { NS_IAPPLEFILEDECODER_CONTRACTID, &kNS_APPLEFILEDECODER_CID },
935 #endif
936 #ifdef NECKO_PROTOCOL_ftp
937 { NS_ISTREAMCONVERTER_KEY FTP_TO_INDEX, &kNS_FTPDIRLISTINGCONVERTER_CID },
938 #endif
939 { NS_ISTREAMCONVERTER_KEY INDEX_TO_HTML, &kNS_NSINDEXEDTOHTMLCONVERTER_CID },
940 { NS_DIRINDEXPARSER_CONTRACTID, &kNS_DIRINDEXPARSER_CID },
941 { NS_ISTREAMCONVERTER_KEY MULTI_MIXED_X, &kNS_MULTIMIXEDCONVERTER_CID },
942 { NS_ISTREAMCONVERTER_KEY MULTI_BYTERANGES, &kNS_MULTIMIXEDCONVERTER_CID },
943 { NS_ISTREAMCONVERTER_KEY MULTI_MIXED, &kNS_MULTIMIXEDCONVERTER_CID },
944 { NS_ISTREAMCONVERTER_KEY UNKNOWN_CONTENT, &kNS_UNKNOWNDECODER_CID },
945 { NS_GENERIC_CONTENT_SNIFFER, &kNS_UNKNOWNDECODER_CID },
946 { NS_BINARYDETECTOR_CONTRACTID, &kNS_BINARYDETECTOR_CID },
947 { NS_ISTREAMCONVERTER_KEY GZIP_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID },
948 { NS_ISTREAMCONVERTER_KEY XGZIP_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID },
949 { NS_ISTREAMCONVERTER_KEY COMPRESS_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID },
950 { NS_ISTREAMCONVERTER_KEY XCOMPRESS_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID },
951 { NS_ISTREAMCONVERTER_KEY DEFLATE_TO_UNCOMPRESSED, &kNS_HTTPCOMPRESSCONVERTER_CID },
952 { NS_ISTREAMCONVERTER_KEY PLAIN_TO_HTML, &kNS_NSTXTTOHTMLCONVERTER_CID },
953 #ifdef BUILD_BINHEX_DECODER
954 { NS_ISTREAMCONVERTER_KEY BINHEX_TO_WILD, &kNS_BINHEXDECODER_CID },
955 #endif
956 { MOZ_TXTTOHTMLCONV_CONTRACTID, &kMOZITXTTOHTMLCONV_CID },
957 { "@mozilla.org/dirIndex;1", &kNS_DIRINDEX_CID },
958 { NS_MIMEHEADERPARAM_CONTRACTID, &kNS_MIMEHEADERPARAM_CID },
959 #ifdef NECKO_PROTOCOL_file
960 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "file", &kNS_FILEPROTOCOLHANDLER_CID },
961 #endif
962 #ifdef NECKO_PROTOCOL_http
963 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &kNS_HTTPPROTOCOLHANDLER_CID },
964 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "https", &kNS_HTTPSPROTOCOLHANDLER_CID },
965 { NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "basic", &kNS_HTTPBASICAUTH_CID },
966 { NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "digest", &kNS_HTTPDIGESTAUTH_CID },
967 { NS_HTTP_AUTHENTICATOR_CONTRACTID_PREFIX "ntlm", &kNS_HTTPNTLMAUTH_CID },
968 { NS_HTTPAUTHMANAGER_CONTRACTID, &kNS_HTTPAUTHMANAGER_CID },
969 { NS_HTTPCHANNELAUTHPROVIDER_CONTRACTID, &kNS_HTTPCHANNELAUTHPROVIDER_CID },
970 { NS_HTTPACTIVITYDISTRIBUTOR_CONTRACTID, &kNS_HTTPACTIVITYDISTRIBUTOR_CID },
971 #endif // !NECKO_PROTOCOL_http
972 #ifdef NECKO_PROTOCOL_ftp
973 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &kNS_FTPPROTOCOLHANDLER_CID },
974 #endif
975 #ifdef NECKO_PROTOCOL_res
976 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "resource", &kNS_RESPROTOCOLHANDLER_CID },
977 #endif
978 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "about", &kNS_ABOUTPROTOCOLHANDLER_CID },
979 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-safe-about", &kNS_SAFEABOUTPROTOCOLHANDLER_CID },
980 { NS_ABOUT_MODULE_CONTRACTID_PREFIX "blank", &kNS_ABOUT_BLANK_MODULE_CID },
981 #ifdef NECKO_PROTOCOL_about
982 #ifdef NS_BUILD_REFCNT_LOGGING
983 { NS_ABOUT_MODULE_CONTRACTID_PREFIX "bloat", &kNS_ABOUT_BLOAT_MODULE_CID },
984 #endif
985 { NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache", &kNS_ABOUT_CACHE_MODULE_CID },
986 { NS_ABOUT_MODULE_CONTRACTID_PREFIX "cache-entry", &kNS_ABOUT_CACHE_ENTRY_MODULE_CID },
987 #endif
988 { NS_NETWORK_SOCKET_CONTRACTID_PREFIX "socks", &kNS_SOCKSSOCKETPROVIDER_CID },
989 { NS_NETWORK_SOCKET_CONTRACTID_PREFIX "socks4", &kNS_SOCKS4SOCKETPROVIDER_CID },
990 { NS_NETWORK_SOCKET_CONTRACTID_PREFIX "udp", &kNS_UDPSOCKETPROVIDER_CID },
991 { NS_CACHESERVICE_CONTRACTID, &kNS_CACHESERVICE_CID },
992 #ifdef NECKO_OFFLINE_CACHE
993 { NS_APPLICATIONCACHESERVICE_CONTRACTID, &kNS_APPLICATIONCACHESERVICE_CID },
994 { NS_APPLICATIONCACHENAMESPACE_CONTRACTID, &kNS_APPLICATIONCACHENAMESPACE_CID },
995 { NS_APPLICATIONCACHE_CONTRACTID, &kNS_APPLICATIONCACHE_CID },
996 #endif
997 #ifdef NECKO_COOKIES
998 { NS_COOKIEMANAGER_CONTRACTID, &kNS_COOKIEMANAGER_CID },
999 { NS_COOKIESERVICE_CONTRACTID, &kNS_COOKIESERVICE_CID },
1000 #endif
1001 #ifdef NECKO_WIFI
1002 { NS_WIFI_MONITOR_CONTRACTID, &kNS_WIFI_MONITOR_COMPONENT_CID },
1003 #endif
1004 #ifdef NECKO_PROTOCOL_data
1005 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "data", &kNS_DATAPROTOCOLHANDLER_CID },
1006 #endif
1007 #ifdef NECKO_PROTOCOL_device
1008 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-device", &kNS_DEVICEPROTOCOLHANDLER_CID },
1009 #endif
1010 #ifdef NECKO_PROTOCOL_viewsource
1011 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "view-source", &kNS_VIEWSOURCEHANDLER_CID },
1012 #endif
1013 #ifdef NECKO_PROTOCOL_wyciwyg
1014 { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "wyciwyg", &kNS_WYCIWYGPROTOCOLHANDLER_CID },
1015 #endif
1016 #if defined(XP_WIN)
1017 { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
1018 #elif defined(MOZ_WIDGET_COCOA)
1019 { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
1020 #elif defined(MOZ_ENABLE_LIBCONIC)
1021 { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
1022 #elif defined(MOZ_ENABLE_QTNETWORK)
1023 { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
1024 #elif defined(ANDROID)
1025 { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_NETWORK_LINK_SERVICE_CID },
1026 #endif
1027 { NS_SERIALIZATION_HELPER_CONTRACTID, &kNS_SERIALIZATION_HELPER_CID },
1028 #ifdef MOZ_IPC
1029 { NS_REDIRECTCHANNELREGISTRAR_CONTRACTID, &kNS_REDIRECTCHANNELREGISTRAR_CID },
1030 #endif
1031 { NULL }
1034 static const mozilla::Module kNeckoModule = {
1035 mozilla::Module::kVersion,
1036 kNeckoCIDs,
1037 kNeckoContracts,
1038 kNeckoCategories,
1039 NULL,
1040 nsNetStartup,
1041 nsNetShutdown
1044 NSMODULE_DEFN(necko) = &kNeckoModule;