mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-05 05:30:29 +00:00
Bug 1087442 - Attach LoadInfo inside each individual ProtocolHandler - extensions/ changes (r=karlt)
This commit is contained in:
parent
a4375f9cf0
commit
85302dc6bc
@ -1059,12 +1059,23 @@ nsGIOProtocolHandler::NewChannel2(nsIURI* aURI,
|
||||
return rv;
|
||||
|
||||
nsRefPtr<nsGIOInputStream> stream = new nsGIOInputStream(spec);
|
||||
if (!stream)
|
||||
{
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!stream) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// 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);
|
||||
@ -1078,8 +1089,9 @@ nsGIOProtocolHandler::NewChannel2(nsIURI* aURI,
|
||||
nsILoadInfo::SEC_NORMAL,
|
||||
nsIContentPolicy::TYPE_OTHER,
|
||||
NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
stream->SetChannel(*aResult);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
stream->SetChannel(*aResult);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user