do_GetIOService should use nsGetServiceByCID - bug 271823 r=biesi sr=jag
This commit is contained in:
Родитель
8b06707629
Коммит
a4cba0ab63
|
@ -139,8 +139,6 @@ void nsIDNService::prefsChanged(nsIPrefBranch *prefBranch, const PRUnichar *pref
|
|||
|
||||
nsIDNService::nsIDNService()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// initialize to the official prefix (RFC 3490 "5. ACE prefix")
|
||||
const char kIDNSPrefix[] = "xn--";
|
||||
strcpy(mACEPrefix, kIDNSPrefix);
|
||||
|
@ -150,9 +148,7 @@ nsIDNService::nsIDNService()
|
|||
if (idn_success != idn_nameprep_create(NULL, &mNamePrepHandle))
|
||||
mNamePrepHandle = nsnull;
|
||||
|
||||
mNormalizer = do_GetService(NS_UNICODE_NORMALIZER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
mNormalizer = nsnull;
|
||||
mNormalizer = do_GetService(NS_UNICODE_NORMALIZER_CONTRACTID);
|
||||
/* member initializers and constructor code */
|
||||
}
|
||||
|
||||
|
|
|
@ -105,8 +105,8 @@ nsMIMEHeaderParamImpl::GetParameter(const nsACString& aHeaderVal,
|
|||
{
|
||||
nsCAutoString str2;
|
||||
nsCOMPtr<nsIUTF8ConverterService>
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
|
||||
if (cvtUTF8 &&
|
||||
NS_SUCCEEDED(cvtUTF8->ConvertStringToUTF8(str1,
|
||||
PromiseFlatCString(aFallbackCharset).get(), PR_FALSE, str2))) {
|
||||
CopyUTF8toUTF16(str2, aResult);
|
||||
|
@ -410,13 +410,12 @@ nsMIMEHeaderParamImpl::DecodeParameter(const nsACString& aParamValue,
|
|||
nsACString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
nsresult rv;
|
||||
// If aCharset is given, aParamValue was obtained from RFC2231
|
||||
// encoding and we're pretty sure that it's in aCharset.
|
||||
if (aCharset && *aCharset)
|
||||
{
|
||||
nsCOMPtr<nsIUTF8ConverterService> cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
nsCOMPtr<nsIUTF8ConverterService> cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
|
||||
if (cvtUTF8)
|
||||
// skip ASCIIness/UTF8ness test if aCharset is 7bit non-ascii charset.
|
||||
return cvtUTF8->ConvertStringToUTF8(aParamValue, aCharset,
|
||||
IS_7BIT_NON_ASCII_CHARSET(aCharset), aResult);
|
||||
|
@ -447,8 +446,8 @@ nsMIMEHeaderParamImpl::DecodeParameter(const nsACString& aParamValue,
|
|||
nsCAutoString decoded;
|
||||
|
||||
// Try RFC 2047 encoding, instead.
|
||||
rv = DecodeRFC2047Header(unQuoted.get(), aDefaultCharset,
|
||||
aOverrideCharset, PR_TRUE, decoded);
|
||||
nsresult rv = DecodeRFC2047Header(unQuoted.get(), aDefaultCharset,
|
||||
aOverrideCharset, PR_TRUE, decoded);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !decoded.IsEmpty())
|
||||
aResult = decoded;
|
||||
|
@ -592,12 +591,11 @@ void CopyRawHeader(const char *aInput, PRUint32 aLen,
|
|||
PRBool skipCheck = (c == 0x1B || c == '~') &&
|
||||
IS_7BIT_NON_ASCII_CHARSET(aDefaultCharset);
|
||||
|
||||
nsresult rv;
|
||||
// If not UTF-8, treat as default charset
|
||||
nsCOMPtr<nsIUTF8ConverterService>
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID, &rv));
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
|
||||
nsCAutoString utf8Text;
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
if (cvtUTF8 &&
|
||||
NS_SUCCEEDED(
|
||||
cvtUTF8->ConvertStringToUTF8(Substring(aInput, aInput + aLen),
|
||||
aDefaultCharset, skipCheck, utf8Text))) {
|
||||
|
@ -722,12 +720,11 @@ nsresult DecodeRFC2047Str(const char *aHeader, const char *aDefaultCharset,
|
|||
}
|
||||
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIUTF8ConverterService>
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID, &rv));
|
||||
cvtUTF8(do_GetService(NS_UTF8CONVERTERSERVICE_CONTRACTID));
|
||||
nsCAutoString utf8Text;
|
||||
// skip ASCIIness/UTF8ness test if aCharset is 7bit non-ascii charset.
|
||||
if (NS_SUCCEEDED(rv) &&
|
||||
if (cvtUTF8 &&
|
||||
NS_SUCCEEDED(
|
||||
cvtUTF8->ConvertStringToUTF8(nsDependentCString(decodedText),
|
||||
charset, IS_7BIT_NON_ASCII_CHARSET(charset), utf8Text))) {
|
||||
|
|
|
@ -871,15 +871,14 @@ nsFtpState::R_syst() {
|
|||
NS_ERROR("Server type list format unrecognized.");
|
||||
// Guessing causes crashes.
|
||||
// (Of course, the parsing code should be more robust...)
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
nsCOMPtr<nsIStringBundleService> bundleService =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
|
||||
if (!bundleService)
|
||||
return FTP_ERROR;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> bundle;
|
||||
rv = bundleService->CreateBundle(NECKO_MSGS_URL,
|
||||
getter_AddRefs(bundle));
|
||||
nsresult rv = bundleService->CreateBundle(NECKO_MSGS_URL,
|
||||
getter_AddRefs(bundle));
|
||||
if (NS_FAILED(rv))
|
||||
return FTP_ERROR;
|
||||
|
||||
|
@ -1242,8 +1241,6 @@ nsFtpState::R_stor() {
|
|||
|
||||
nsresult
|
||||
nsFtpState::S_pasv() {
|
||||
nsresult rv;
|
||||
|
||||
if (!mAddressChecked) {
|
||||
// Find socket address
|
||||
mAddressChecked = PR_TRUE;
|
||||
|
@ -1254,7 +1251,7 @@ nsFtpState::S_pasv() {
|
|||
nsCOMPtr<nsISocketTransport> sTrans = do_QueryInterface(controlSocket);
|
||||
if (sTrans) {
|
||||
PRNetAddr addr;
|
||||
rv = sTrans->GetPeerAddr(&addr);
|
||||
nsresult rv = sTrans->GetPeerAddr(&addr);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mServerIsIPv6 = addr.raw.family == PR_AF_INET6 &&
|
||||
!PR_IsNetAddrType(&addr, PR_IpAddrV4Mapped);
|
||||
|
@ -1376,12 +1373,14 @@ nsFtpState::R_pasv() {
|
|||
if (newDataConn) {
|
||||
// now we know where to connect our data channel
|
||||
nsCOMPtr<nsISocketTransportService> sts =
|
||||
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||
|
||||
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
|
||||
if (!sts)
|
||||
return FTP_ERROR;
|
||||
|
||||
nsCOMPtr<nsISocketTransport> strans;
|
||||
rv = sts->CreateTransport(nsnull, 0, nsDependentCString(mServerAddress),
|
||||
port, mChannel->ProxyInfo(),
|
||||
getter_AddRefs(strans)); // the data socket
|
||||
rv = sts->CreateTransport(nsnull, 0, nsDependentCString(mServerAddress),
|
||||
port, mChannel->ProxyInfo(),
|
||||
getter_AddRefs(strans)); // the data socket
|
||||
if (NS_FAILED(rv))
|
||||
return FTP_ERROR;
|
||||
mDataTransport = strans;
|
||||
|
@ -1407,8 +1406,8 @@ nsFtpState::R_pasv() {
|
|||
// because "output" is a socket output stream, so the result is that
|
||||
// all work will be done on the socket transport thread.
|
||||
nsCOMPtr<nsIEventTarget> stEventTarget =
|
||||
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID);
|
||||
if (!stEventTarget)
|
||||
return FTP_ERROR;
|
||||
|
||||
nsCOMPtr<nsIAsyncStreamCopier> copier;
|
||||
|
|
|
@ -2404,13 +2404,13 @@ nsHttpChannel::ProcessRedirection(PRUint32 redirectType)
|
|||
|
||||
// move the reference of the old location to the new one if the new
|
||||
// one has none.
|
||||
nsCOMPtr<nsIURL> newURL = do_QueryInterface(newURI, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIURL> newURL = do_QueryInterface(newURI);
|
||||
if (newURL) {
|
||||
nsCAutoString ref;
|
||||
rv = newURL->GetRef(ref);
|
||||
if (NS_SUCCEEDED(rv) && ref.IsEmpty()) {
|
||||
nsCOMPtr<nsIURL> baseURL( do_QueryInterface(mURI, &rv) );
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIURL> baseURL(do_QueryInterface(mURI));
|
||||
if (baseURL) {
|
||||
baseURL->GetRef(ref);
|
||||
if (!ref.IsEmpty())
|
||||
newURL->SetRef(ref);
|
||||
|
|
|
@ -304,7 +304,7 @@ nsHttpDigestAuth::GenerateCredentials(nsIHttpChannel *httpChannel,
|
|||
}
|
||||
else {
|
||||
nsCOMPtr<nsISupportsPRUint32> v(
|
||||
do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID, &rv));
|
||||
do_CreateInstance(NS_SUPPORTS_PRUINT32_CONTRACTID));
|
||||
if (v) {
|
||||
v->SetData(1);
|
||||
NS_ADDREF(*sessionState = v);
|
||||
|
|
|
@ -1074,8 +1074,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
|||
else {
|
||||
// verify that this socket type is actually valid
|
||||
nsCOMPtr<nsISocketProviderService> sps(
|
||||
do_GetService(kSocketProviderServiceCID, &rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
do_GetService(kSocketProviderServiceCID));
|
||||
if (sps) {
|
||||
nsCOMPtr<nsISocketProvider> sp;
|
||||
rv = sps->GetSocketProvider(sval, getter_AddRefs(sp));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -1142,8 +1142,8 @@ nsHttpHandler::PrefsChanged(nsIPrefBranch *prefs, const char *pref)
|
|||
// UI thread, and so do all the methods in nsHttpChannel.cpp
|
||||
// (mIDNConverter is used by nsHttpChannel)
|
||||
if (enableIDN && !mIDNConverter) {
|
||||
mIDNConverter = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "idnSDK not installed");
|
||||
mIDNConverter = do_GetService(NS_IDNSERVICE_CONTRACTID);
|
||||
NS_ASSERTION(mIDNConverter, "idnSDK not installed");
|
||||
}
|
||||
else if (!enableIDN && mIDNConverter)
|
||||
mIDNConverter = nsnull;
|
||||
|
|
|
@ -615,10 +615,8 @@ nsSOCKSIOLayerConnect(PRFileDesc *fd, const PRNetAddr *addr, PRIntervalTime /*ti
|
|||
nsCOMPtr<nsIDNSRecord> rec;
|
||||
nsresult rv;
|
||||
{
|
||||
nsCOMPtr<nsIDNSService> dns;
|
||||
|
||||
dns = do_GetService(NS_DNSSERVICE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
nsCOMPtr<nsIDNSService> dns = do_GetService(NS_DNSSERVICE_CONTRACTID);
|
||||
if (!dns)
|
||||
return PR_FAILURE;
|
||||
|
||||
rv = dns->Resolve(proxyHost, 0, getter_AddRefs(rec));
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "mozTXTToHTMLConv.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCRT.h"
|
||||
|
@ -434,7 +435,7 @@ PRBool mozTXTToHTMLConv::ShouldLinkify(const nsCString& aURL)
|
|||
return PR_FALSE;
|
||||
|
||||
// Is it an external protocol handler? If not, linkify it.
|
||||
nsCOMPtr<nsIExternalProtocolHandler> externalHandler = do_QueryInterface(handler, &rv);
|
||||
nsCOMPtr<nsIExternalProtocolHandler> externalHandler = do_QueryInterface(handler);
|
||||
if (!externalHandler)
|
||||
return PR_TRUE; // handler is built-in, linkify it!
|
||||
|
||||
|
@ -451,12 +452,15 @@ mozTXTToHTMLConv::CheckURLAndCreateHTML(
|
|||
{
|
||||
// Create *uri from txtURL
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv;
|
||||
// Lazily initialize mIOService
|
||||
if (!mIOService)
|
||||
mIOService = do_GetService(kIOServiceCID, &rv);
|
||||
|
||||
if (NS_FAILED(rv) || !mIOService)
|
||||
return PR_FALSE;
|
||||
{
|
||||
mIOService = do_GetIOService();
|
||||
|
||||
if (!mIOService)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// See if the url should be linkified.
|
||||
NS_ConvertUTF16toUTF8 utf8URL(txtURL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -117,6 +117,8 @@ nsIndexedToHTML::Init(nsIStreamListener* aListener) {
|
|||
mListener = aListener;
|
||||
|
||||
mDateTime = do_CreateInstance(NS_DATETIMEFORMAT_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIStringBundleService> sbs =
|
||||
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
|
||||
|
|
|
@ -647,8 +647,8 @@ nsStreamConverterService::AsyncConvertData(const char *aFromType,
|
|||
const char *lContractID = contractIDStr->get();
|
||||
|
||||
// create the converter for this from/to pair
|
||||
nsCOMPtr<nsIStreamConverter> converter(do_CreateInstance(lContractID, &rv));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "graph construction problem, built a contractid that wasn't registered");
|
||||
nsCOMPtr<nsIStreamConverter> converter(do_CreateInstance(lContractID));
|
||||
NS_ASSERTION(converter, "graph construction problem, built a contractid that wasn't registered");
|
||||
|
||||
nsCAutoString fromStr, toStr;
|
||||
rv = ParseFromTo(lContractID, fromStr, toStr);
|
||||
|
|
Загрузка…
Ссылка в новой задаче