diff --git a/layout/html/forms/src/nsFormFrame.cpp b/layout/html/forms/src/nsFormFrame.cpp
index a1266e429955..66642d29a0a2 100644
--- a/layout/html/forms/src/nsFormFrame.cpp
+++ b/layout/html/forms/src/nsFormFrame.cpp
@@ -103,6 +103,7 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIServiceManager.h"
#include "nsEscape.h"
#include "nsLinebreakConverter.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsILocalFile.h" // Using nsILocalFile to get file size
@@ -114,7 +115,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
static NS_DEFINE_CID(kPlatformCharsetCID, NS_PLATFORMCHARSET_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
//----------------------------------------------------------------------
@@ -1233,7 +1233,7 @@ nsFormFrame::GetContentType(char* aPathName, char** aContentType)
fileExt--;
}
if (fileExt) {
- NS_WITH_SERVICE(nsIMIMEService, MIMEService, kMIMEServiceCID, &rv);
+ nsCOMPtr MIMEService (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_FAILED(rv)) return rv;
if (NS_SUCCEEDED(MIMEService->GetTypeFromExtension(++fileExt, aContentType)))
return NS_OK;
diff --git a/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp b/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
index f8faed895cec..a2bbc0cedc6c 100644
--- a/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
+++ b/mailnews/compose/src/nsMsgAppleDoubleEncode.cpp
@@ -35,11 +35,10 @@
#include "nsMsgAppleCodes.h"
#include "nsFileSpec.h"
#include "nsMsgCompUtils.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIMIMEInfo.h"
-static NS_DEFINE_CID(kMimeServiceCID, NS_MIMESERVICE_CID);
-
#ifdef XP_MAC
#pragma warn_unusedarg off
@@ -110,7 +109,7 @@ MacGetFileType(nsFileSpec *fs,
if (NS_SUCCEEDED(nsMsgNewURL(&tURI, tFileURL.GetURLString())) && tURI)
{
- NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
+ nsCOMPtr mimeFinder (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv) && mimeFinder)
{
char *mimeType = nsnull;
diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp
index 2aeccb8f6c5a..8251f859a5ba 100644
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -61,6 +61,7 @@
#include "nsIAddrDatabase.h"
#include "nsIAddrBookSession.h"
#include "nsIAddressBook.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
@@ -77,7 +78,6 @@ static NS_DEFINE_CID(kHeaderParserCID, NS_MSGHEADERPARSER_CID);
static NS_DEFINE_CID(kAddrBookCID, NS_ADDRESSBOOK_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kMsgRecipientArrayCID, NS_MSGRECIPIENTARRAY_CID);
-static NS_DEFINE_CID(kMimeServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static PRInt32 GetReplyOnTop()
@@ -1969,7 +1969,7 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, nsString *aMsgBody)
// this signature...if we can't, we assume text
rv = NS_OK;
char *sigContentType = nsnull;
- NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
+ nsCOMPtr mimeFinder (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv) && mimeFinder && fileExt)
{
mimeFinder->GetTypeFromExtension(fileExt, &(sigContentType));
diff --git a/mailnews/compose/src/nsMsgSend.cpp b/mailnews/compose/src/nsMsgSend.cpp
index 28807d12e027..144bc110025a 100644
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -51,6 +51,7 @@
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLAnchorElement.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
@@ -87,7 +88,6 @@ static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
-static NS_DEFINE_CID(kMimeServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kCAddressCollecter, NS_ABADDRESSCOLLECTER_CID);
static NS_DEFINE_CID(kTXTToHTMLConvCID, MOZITXTTOHTMLCONV_CID);
static NS_DEFINE_CID(kCNetSupportDialogCID, NS_NETSUPPORTDIALOG_CID);
@@ -1858,7 +1858,7 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments()
// Now, most importantly, we need to figure out what the content type is for
// this attachment...If we can't, then just make it application/octet-stream
nsresult rv = NS_OK;
- NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
+ nsCOMPtr mimeFinder (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv) && mimeFinder)
{
char *fileExt = nsMsgGetExtensionFromFileURL(NS_ConvertASCIItoUCS2(str));
diff --git a/mailnews/mime/src/mimedrft.cpp b/mailnews/mime/src/mimedrft.cpp
index 748f0df00c84..37cf51f6d0bb 100644
--- a/mailnews/mime/src/mimedrft.cpp
+++ b/mailnews/mime/src/mimedrft.cpp
@@ -56,6 +56,7 @@
#include "nsIMsgMessageService.h"
#include "nsMsgUtils.h"
#include "nsXPIDLString.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIMIMEInfo.h"
@@ -82,7 +83,6 @@ static nsString& mime_decode_string(const char* str ,
// CID's
static NS_DEFINE_CID(kCMsgComposeServiceCID, NS_MSGCOMPOSESERVICE_CID);
-static NS_DEFINE_CID(kMimeServiceCID, NS_MIMESERVICE_CID);
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
@@ -1713,7 +1713,7 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
if (pos > 0)
contentType.Truncate(pos);
nsresult rv = NS_OK;
- NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
+ nsCOMPtr mimeFinder (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv) && mimeFinder)
{
nsCOMPtr mimeInfo = nsnull;
diff --git a/mailnews/mime/src/mimemoz2.cpp b/mailnews/mime/src/mimemoz2.cpp
index ff54deae045d..1c8261926749 100644
--- a/mailnews/mime/src/mimemoz2.cpp
+++ b/mailnews/mime/src/mimemoz2.cpp
@@ -59,6 +59,7 @@
#include "nsIMsgMailNewsUrl.h"
#include "nsSpecialSystemDirectory.h"
#include "mozITXTToHTMLConv.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIImapUrl.h"
#include "nsMsgI18N.h"
@@ -73,7 +74,6 @@
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
-static NS_DEFINE_CID(kMimeServiceCID, NS_MIMESERVICE_CID);
#ifdef MOZ_SECURITY
#include HG01944
@@ -252,7 +252,7 @@ ValidateRealName(nsMsgAttachmentData *aAttach, MimeHeaders *aHdrs)
if (pos > 0)
contentType.Truncate(pos);
- NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
+ nsCOMPtr mimeFinder (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv) && mimeFinder)
{
nsIMIMEInfo *mimeInfo = nsnull;
@@ -592,7 +592,7 @@ mime_file_type (const char *filename, void *stream_closure)
if (ext)
{
ext++;
- NS_WITH_SERVICE(nsIMIMEService, mimeFinder, kMimeServiceCID, &rv);
+ nsCOMPtr mimeFinder (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv) && mimeFinder)
mimeFinder->GetTypeFromExtension(ext, &retType);
}
diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp
index 32187a7492e7..a45fb2c83710 100644
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -25,6 +25,7 @@
#include "nsCRT.h"
#include "nsIFileTransportService.h"
#include "nsIURL.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsAutoLock.h"
#include "nsIFileStreams.h"
@@ -41,7 +42,6 @@
#endif
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
static NS_DEFINE_CID(kScriptSecurityManagerCID, NS_SCRIPTSECURITYMANAGER_CID);
@@ -683,7 +683,7 @@ nsJARChannel::GetContentType(char* *aContentType)
}
if (ext) {
- NS_WITH_SERVICE(nsIMIMEService, mimeServ, kMIMEServiceCID, &rv);
+ nsCOMPtr mimeServ (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = mimeServ->GetTypeFromExtension(ext, &mContentType);
}
@@ -925,6 +925,7 @@ nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* con
(const char*)jarURLStr, aStatus));
}
#endif
+
rv = mUserListener->OnStopRequest(this, mUserContext, aStatus, aStatusArg);
if (mLoadGroup) {
diff --git a/netwerk/base/src/nsFileStreams.cpp b/netwerk/base/src/nsFileStreams.cpp
index b1ba8e953c5c..bf06971a6ea5 100644
--- a/netwerk/base/src/nsFileStreams.cpp
+++ b/netwerk/base/src/nsFileStreams.cpp
@@ -26,6 +26,7 @@
#include "prerror.h"
#include "nsCRT.h"
#include "nsInt64.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsIFile.h"
#include "nsDirectoryIndexStream.h"
@@ -49,8 +50,6 @@ PRLogModuleInfo* gFileIOLog = nsnull;
#endif /* PR_LOGGING */
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
-
////////////////////////////////////////////////////////////////////////////////
// nsFileIO
@@ -153,7 +152,7 @@ nsFileIO::Open(char **contentType, PRInt32 *contentLength)
*contentLength = -1;
}
else {
- NS_WITH_SERVICE(nsIMIMEService, mimeServ, kMIMEServiceCID, &rv);
+ nsCOMPtr mimeServ (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = mimeServ->GetTypeFromFile(mFile, contentType);
}
diff --git a/netwerk/base/src/nsInputStreamChannel.cpp b/netwerk/base/src/nsInputStreamChannel.cpp
index d4a27233bb8e..8f88c6363e83 100644
--- a/netwerk/base/src/nsInputStreamChannel.cpp
+++ b/netwerk/base/src/nsInputStreamChannel.cpp
@@ -24,13 +24,11 @@
#include "nsCOMPtr.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
-#include "nsIMIMEService.h"
#include "nsIFileTransportService.h"
#include "netCore.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
////////////////////////////////////////////////////////////////////////////////
diff --git a/netwerk/cache/filecache/nsDiskCacheRecordChannel.cpp b/netwerk/cache/filecache/nsDiskCacheRecordChannel.cpp
index 379eebd8eb5d..1005fafe0bb6 100644
--- a/netwerk/cache/filecache/nsDiskCacheRecordChannel.cpp
+++ b/netwerk/cache/filecache/nsDiskCacheRecordChannel.cpp
@@ -32,6 +32,7 @@
#include "nsIURL.h"
#include "nsIOutputStream.h"
#include "netCore.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsISupportsUtils.h"
#include "prio.h"
@@ -39,7 +40,6 @@
//static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
// This is copied from nsMemCacheChannel, We should consolidate these two.
class WriteStreamWrapper : public nsIOutputStream
@@ -500,8 +500,7 @@ nsDiskCacheRecordChannel::GetContentType(char * *aContentType)
rv = url->SetSpec((char*)urlStr);
if (NS_FAILED(rv))
return rv;
-
- NS_WITH_SERVICE(nsIMIMEService, MIMEService, kMIMEServiceCID, &rv);
+ nsCOMPtr MIMEService (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_FAILED(rv)) return rv;
rv = MIMEService->GetTypeFromURI(url, aContentType);
diff --git a/netwerk/protocol/ftp/src/nsFTPChannel.cpp b/netwerk/protocol/ftp/src/nsFTPChannel.cpp
index 5f561613c6c2..41c1e7265044 100644
--- a/netwerk/protocol/ftp/src/nsFTPChannel.cpp
+++ b/netwerk/protocol/ftp/src/nsFTPChannel.cpp
@@ -25,11 +25,11 @@
#include "nsFTPChannel.h"
#include "nsIStreamListener.h"
#include "nsIServiceManager.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsNetUtil.h"
#include "nsMimeTypes.h"
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#if defined(PR_LOGGING)
@@ -431,7 +431,8 @@ nsFTPChannel::GetContentType(char* *aContentType) {
nsAutoLock lock(mLock);
*aContentType = nsnull;
if (mContentType.IsEmpty()) {
- NS_WITH_SERVICE(nsIMIMEService, MIMEService, kMIMEServiceCID, &rv);
+
+ nsCOMPtr MIMEService (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_FAILED(rv)) return rv;
rv = MIMEService->GetTypeFromURI(mURL, aContentType);
if (NS_SUCCEEDED(rv)) {
diff --git a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
index bc4a3480fde2..dd52ca308bb0 100644
--- a/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/src/nsFtpConnectionThread.cpp
@@ -22,7 +22,6 @@
#include "nsFtpConnectionThread.h"
#include "nsISocketTransport.h"
-#include "nsIMIMEService.h"
#include "nsIStreamConverterService.h"
#include "prprf.h"
#include "prlog.h"
@@ -43,7 +42,6 @@
static NS_DEFINE_CID(kWalletServiceCID, NS_WALLETSERVICE_CID);
static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID);
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
diff --git a/netwerk/protocol/jar/src/nsJARChannel.cpp b/netwerk/protocol/jar/src/nsJARChannel.cpp
index 32187a7492e7..a45fb2c83710 100644
--- a/netwerk/protocol/jar/src/nsJARChannel.cpp
+++ b/netwerk/protocol/jar/src/nsJARChannel.cpp
@@ -25,6 +25,7 @@
#include "nsCRT.h"
#include "nsIFileTransportService.h"
#include "nsIURL.h"
+#include "nsCExternalHandlerService.h"
#include "nsIMIMEService.h"
#include "nsAutoLock.h"
#include "nsIFileStreams.h"
@@ -41,7 +42,6 @@
#endif
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
static NS_DEFINE_CID(kScriptSecurityManagerCID, NS_SCRIPTSECURITYMANAGER_CID);
@@ -683,7 +683,7 @@ nsJARChannel::GetContentType(char* *aContentType)
}
if (ext) {
- NS_WITH_SERVICE(nsIMIMEService, mimeServ, kMIMEServiceCID, &rv);
+ nsCOMPtr mimeServ (do_GetService(NS_MIMESERVICE_PROGID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = mimeServ->GetTypeFromExtension(ext, &mContentType);
}
@@ -925,6 +925,7 @@ nsJARChannel::OnStopRequest(nsIChannel* jarExtractionTransport, nsISupports* con
(const char*)jarURLStr, aStatus));
}
#endif
+
rv = mUserListener->OnStopRequest(this, mUserContext, aStatus, aStatusArg);
if (mLoadGroup) {
diff --git a/netwerk/protocol/res/src/nsResChannel.cpp b/netwerk/protocol/res/src/nsResChannel.cpp
index 631d621f8b7c..5a275ef06218 100644
--- a/netwerk/protocol/res/src/nsResChannel.cpp
+++ b/netwerk/protocol/res/src/nsResChannel.cpp
@@ -25,14 +25,12 @@
#include "netCore.h"
#include "nsIServiceManager.h"
#include "nsIFileTransportService.h"
-#include "nsIMIMEService.h"
#include "nsIComponentManager.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsXPIDLString.h"
static NS_DEFINE_CID(kFileTransportServiceCID, NS_FILETRANSPORTSERVICE_CID);
-static NS_DEFINE_CID(kMIMEServiceCID, NS_MIMESERVICE_CID);
static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);