mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 1119005 - No need to branch on NewChannelinternal callsites anymore - callsite updated (r=sicking)
This commit is contained in:
parent
fdf17679f1
commit
f3e352240e
@ -163,18 +163,9 @@ AboutRedirector::NewChannel(nsIURI* aURI,
|
||||
rv = NS_NewURI(getter_AddRefs(tempURI),
|
||||
nsDependentCString(kRedirMap[i].url));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = ioService->NewChannelFromURI(tempURI, getter_AddRefs(tempChannel));
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
tempChannel->SetOriginalURI(aURI);
|
||||
|
@ -147,20 +147,9 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to branch on the
|
||||
// loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(result),
|
||||
resolvedURI,
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIIOService> ioServ(do_GetIOService(&rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ioServ->NewChannelFromURI(resolvedURI, getter_AddRefs(result));
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(result),
|
||||
resolvedURI,
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -131,17 +131,9 @@ nsAboutRedirector::NewChannel(nsIURI* aURI,
|
||||
nsCOMPtr<nsIURI> tempURI;
|
||||
rv = NS_NewURI(getter_AddRefs(tempURI), kRedirMap[i].url);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
} else {
|
||||
rv = ioService->NewChannelFromURI(tempURI, getter_AddRefs(tempChannel));
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
|
||||
tempURI,
|
||||
aLoadInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -518,26 +518,12 @@ nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to brach on the
|
||||
// loadInfo and provide default arguments to create a NewInputStreamChannel.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
uri,
|
||||
stream,
|
||||
EmptyCString(), // aContentType
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
|
||||
uri,
|
||||
stream,
|
||||
info->mPrincipal,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER);
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
uri,
|
||||
stream,
|
||||
EmptyCString(), // aContentType
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsString type;
|
||||
|
@ -1063,33 +1063,12 @@ nsGIOProtocolHandler::NewChannel2(nsIURI* aURI,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to brach on the
|
||||
// loadInfo and provide default arguments to create a NewInputStreamChannel.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(aResult,
|
||||
aURI,
|
||||
stream,
|
||||
NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE),
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIPrincipal> nullPrincipal =
|
||||
do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// start out assuming an unknown content-type. we'll set the content-type
|
||||
// to something better once we open the URI.
|
||||
rv = NS_NewInputStreamChannel(aResult,
|
||||
aURI,
|
||||
stream,
|
||||
nullPrincipal,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE));
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(aResult,
|
||||
aURI,
|
||||
stream,
|
||||
NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE),
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
stream->SetChannel(*aResult);
|
||||
}
|
||||
|
@ -872,23 +872,12 @@ nsJARChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *ctx)
|
||||
// we have to provide default arguments in case mLoadInfo is null;
|
||||
uint32_t loadFlags =
|
||||
mLoadFlags & ~(LOAD_DOCUMENT_URI | LOAD_CALL_CONTENT_SNIFFERS);
|
||||
if (mLoadInfo) {
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(channel),
|
||||
mJarBaseURI,
|
||||
mLoadInfo,
|
||||
mLoadGroup,
|
||||
mCallbacks,
|
||||
loadFlags);
|
||||
} else {
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
mJarBaseURI,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
mLoadGroup,
|
||||
mCallbacks,
|
||||
loadFlags);
|
||||
}
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(channel),
|
||||
mJarBaseURI,
|
||||
mLoadInfo,
|
||||
mLoadGroup,
|
||||
mCallbacks,
|
||||
loadFlags);
|
||||
if (NS_FAILED(rv)) {
|
||||
mIsPending = false;
|
||||
mListenerContext = nullptr;
|
||||
|
@ -23,28 +23,12 @@ nsAboutBlank::NewChannel(nsIURI* aURI,
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
in,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
|
||||
aURI,
|
||||
in,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"));
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
in,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
channel.forget(result);
|
||||
|
@ -112,28 +112,12 @@ nsAboutBloat::NewChannel(nsIURI* aURI,
|
||||
}
|
||||
|
||||
nsIChannel* channel = nullptr;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(&channel,
|
||||
aURI,
|
||||
inStr,
|
||||
NS_LITERAL_CSTRING("text/plain"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = NS_NewInputStreamChannel(&channel,
|
||||
aURI,
|
||||
inStr,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
NS_LITERAL_CSTRING("text/plain"),
|
||||
NS_LITERAL_CSTRING("utf-8"));
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(&channel,
|
||||
aURI,
|
||||
inStr,
|
||||
NS_LITERAL_CSTRING("text/plain"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*result = channel;
|
||||
|
@ -64,28 +64,12 @@ nsAboutCache::NewChannel(nsIURI* aURI,
|
||||
mEntriesHeaderAdded = false;
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
inputStream,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
|
||||
aURI,
|
||||
inputStream,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"));
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
inputStream,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mBuffer.AssignLiteral(
|
||||
|
@ -99,26 +99,12 @@ nsAboutCacheEntry::NewChannel(nsIURI* uri,
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
rv = GetContentStream(uri, getter_AddRefs(stream));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2()
|
||||
// instead of NewChannel() we should have a non-null loadInfo
|
||||
// consistently. Until then we have to branch on the loadInfo.
|
||||
if (aLoadInfo) {
|
||||
return NS_NewInputStreamChannelInternal(result,
|
||||
uri,
|
||||
stream,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
}
|
||||
return NS_NewInputStreamChannel(result,
|
||||
uri,
|
||||
stream,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"));
|
||||
return NS_NewInputStreamChannelInternal(result,
|
||||
uri,
|
||||
stream,
|
||||
NS_LITERAL_CSTRING("text/html"),
|
||||
NS_LITERAL_CSTRING("utf-8"),
|
||||
aLoadInfo);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -288,22 +288,13 @@ nsResProtocolHandler::NewChannel2(nsIURI* uri,
|
||||
nsresult rv = ResolveURI(uri, spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to branch on the
|
||||
// loadInfo.
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
rv = NS_NewURI(getter_AddRefs(newURI), spec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewChannelInternal(result,
|
||||
newURI,
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = mIOService->NewChannelFromURI(newURI, result);
|
||||
}
|
||||
rv = NS_NewChannelInternal(result,
|
||||
newURI,
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsLoadFlags loadFlags = 0;
|
||||
|
@ -343,26 +343,12 @@ nsAnnoProtocolHandler::NewFaviconChannel(nsIURI *aURI, nsIURI *aAnnotationURI,
|
||||
// Create our channel. We'll call SetContentType with the right type when
|
||||
// we know what it actually is.
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// Bug 1087720 (and Bug 1099296):
|
||||
// Once all callsites have been updated to call NewChannel2() instead of NewChannel()
|
||||
// we should have a non-null loadInfo consistently. Until then we have to brach on the
|
||||
// loadInfo and provide default arguments to create a NewInputStreamChannel.
|
||||
if (aLoadInfo) {
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
inputStream,
|
||||
EmptyCString(), // aContentType
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
}
|
||||
else {
|
||||
rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
|
||||
aURI,
|
||||
inputStream,
|
||||
nsContentUtils::GetSystemPrincipal(),
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_IMAGE);
|
||||
}
|
||||
rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
|
||||
aURI,
|
||||
inputStream,
|
||||
EmptyCString(), // aContentType
|
||||
EmptyCString(), // aContentCharset
|
||||
aLoadInfo);
|
||||
NS_ENSURE_SUCCESS(rv, GetDefaultIcon(_channel));
|
||||
|
||||
// Now we go ahead and get our data asynchronously for the favicon.
|
||||
|
Loading…
x
Reference in New Issue
Block a user