Bug 1099296 - Attach LoadInfo to remaining callers of ioService and ProtocolHandlers - in toolkit/ (r=mmc,mak)

This commit is contained in:
Christoph Kerschbaumer 2015-02-17 10:09:50 -08:00
parent aa5bc08574
commit 1602663505
3 changed files with 26 additions and 4 deletions

View File

@ -43,6 +43,10 @@
#include "nsThreadUtils.h"
#include "nsXPCOMStrings.h"
#include "nsIContentPolicy.h"
#include "nsILoadInfo.h"
#include "nsContentUtils.h"
using mozilla::Preferences;
using mozilla::TimeStamp;
using mozilla::Telemetry::Accumulate;
@ -897,7 +901,15 @@ PendingLookup::SendRemoteQueryInternal()
// Set up the channel to transmit the request to the service.
nsCOMPtr<nsIChannel> channel;
nsCOMPtr<nsIIOService> ios = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
rv = ios->NewChannel(serviceUrl, nullptr, nullptr, getter_AddRefs(channel));
rv = ios->NewChannel2(serviceUrl,
nullptr,
nullptr,
nullptr, // aLoadingNode
nsContentUtils::GetSystemPrincipal(),
nullptr, // aTriggeringPrincipal
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER,
getter_AddRefs(channel));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel, &rv));

View File

@ -52,7 +52,7 @@ GetDefaultIcon(nsIChannel **aChannel)
defaultIconURI,
nsContentUtils::GetSystemPrincipal(),
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER);
nsIContentPolicy::TYPE_IMAGE);
}
////////////////////////////////////////////////////////////////////////////////
@ -361,7 +361,7 @@ nsAnnoProtocolHandler::NewFaviconChannel(nsIURI *aURI, nsIURI *aAnnotationURI,
inputStream,
nsContentUtils::GetSystemPrincipal(),
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_OTHER);
nsIContentPolicy::TYPE_IMAGE);
}
NS_ENSURE_SUCCESS(rv, GetDefaultIcon(_channel));

View File

@ -27,6 +27,9 @@
#include "nsIClassInfoImpl.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/Preferences.h"
#include "nsILoadInfo.h"
#include "nsIContentPolicy.h"
#include "nsContentUtils.h"
// For large favicons optimization.
#include "imgITools.h"
@ -328,8 +331,15 @@ nsFaviconService::ReplaceFaviconDataFromDataURL(nsIURI* aFaviconURI,
rv = ioService->GetProtocolHandler("data", getter_AddRefs(protocolHandler));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsILoadInfo> loadInfo =
new mozilla::LoadInfo(nsContentUtils::GetSystemPrincipal(),
nullptr, // aTriggeringPrincipal
nullptr, // aLoadingNode
nsILoadInfo::SEC_NORMAL,
nsIContentPolicy::TYPE_IMAGE);
nsCOMPtr<nsIChannel> channel;
rv = protocolHandler->NewChannel(dataURI, getter_AddRefs(channel));
rv = protocolHandler->NewChannel2(dataURI, loadInfo, getter_AddRefs(channel));
NS_ENSURE_SUCCESS(rv, rv);
// Blocking stream is OK for data URIs.