mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Backed out changeset a2146311e4fa (bug 1104623) for memory leaks
This commit is contained in:
parent
688f5952cb
commit
6a0a1f7c96
@ -122,10 +122,4 @@ LoadInfo::GetBaseURI(nsIURI** aBaseURI)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIURI*
|
||||
LoadInfo::BaseURI()
|
||||
{
|
||||
return mBaseURI;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -17,7 +17,7 @@ typedef unsigned long nsSecurityFlags;
|
||||
/**
|
||||
* An nsILoadOwner represents per-load information about who started the load.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(768a1f20-57d4-462a-812a-41c04e5d1e19)]
|
||||
[scriptable, builtinclass, uuid(da363267-236d-49bf-83a2-33da8d892728)]
|
||||
interface nsILoadInfo : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -156,7 +156,7 @@ interface nsILoadInfo : nsISupports
|
||||
* The contentPolicyType of the channel, used for security checks
|
||||
* like Mixed Content Blocking and Content Security Policy.
|
||||
*/
|
||||
readonly attribute nsContentPolicyType contentPolicyType;
|
||||
readonly attribute nsContentPolicyType contentPolicyType;
|
||||
|
||||
%{ C++
|
||||
inline nsContentPolicyType GetContentPolicyType()
|
||||
@ -173,11 +173,5 @@ interface nsILoadInfo : nsISupports
|
||||
* This attribute may be null. The value of this attribute may be
|
||||
* ignored if the base URI can be inferred by the channel's URI.
|
||||
*/
|
||||
readonly attribute nsIURI baseURI;
|
||||
|
||||
/**
|
||||
* A C++-friendly version of baseURI.
|
||||
*/
|
||||
[noscript, notxpcom, nostdcall, binaryname(BaseURI)]
|
||||
nsIURI binaryBaseURI();
|
||||
readonly attribute nsIURI baseURI;
|
||||
};
|
||||
|
@ -200,17 +200,13 @@ NS_NewFileURI(nsIURI* *result,
|
||||
inline nsresult
|
||||
NS_NewChannelInternal(nsIChannel** outChannel,
|
||||
nsIURI* aUri,
|
||||
nsINode* aRequestingNode,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsSecurityFlags aSecurityFlags,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
nsIURI* aBaseURI = nullptr,
|
||||
nsILoadInfo* aLoadInfo,
|
||||
nsILoadGroup* aLoadGroup = nullptr,
|
||||
nsIInterfaceRequestor* aCallbacks = nullptr,
|
||||
nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL,
|
||||
nsIIOService* aIoService = nullptr)
|
||||
{
|
||||
NS_ASSERTION(aLoadInfo, "Can not create channel without aLoadInfo!");
|
||||
NS_ENSURE_ARG_POINTER(outChannel);
|
||||
|
||||
nsCOMPtr<nsIIOService> grip;
|
||||
@ -238,31 +234,11 @@ NS_NewChannelInternal(nsIChannel** outChannel,
|
||||
rv = channel->SetLoadFlags(aLoadFlags | (normalLoadFlags & nsIChannel::LOAD_REPLACE));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Some channels might already have a loadInfo attached at this
|
||||
// point (see bug 1104623). We have to make sure to update
|
||||
// security flags in such cases before we set the loadinfo.
|
||||
// Once bug 1087442 lands, this problem disappears because we
|
||||
// attach the loadinfo in each individual protocol handler.
|
||||
nsCOMPtr<nsILoadInfo> loadInfo;
|
||||
channel->GetLoadInfo(getter_AddRefs(loadInfo));
|
||||
if (loadInfo) {
|
||||
aSecurityFlags |= loadInfo->GetSecurityFlags();
|
||||
}
|
||||
|
||||
// create a new Loadinfo with the potentially updated securityFlags
|
||||
loadInfo =
|
||||
new mozilla::LoadInfo(aRequestingPrincipal, aTriggeringPrincipal,
|
||||
aRequestingNode, aSecurityFlags,
|
||||
aContentPolicyType, aBaseURI);
|
||||
if (!loadInfo) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
channel->SetLoadInfo(loadInfo);
|
||||
channel->SetLoadInfo(aLoadInfo);
|
||||
|
||||
// If we're sandboxed, make sure to clear any owner the channel
|
||||
// might already have.
|
||||
if (loadInfo->GetLoadingSandboxed()) {
|
||||
if (aLoadInfo->GetLoadingSandboxed()) {
|
||||
channel->SetOwner(nullptr);
|
||||
}
|
||||
|
||||
@ -273,27 +249,31 @@ NS_NewChannelInternal(nsIChannel** outChannel,
|
||||
inline nsresult
|
||||
NS_NewChannelInternal(nsIChannel** outChannel,
|
||||
nsIURI* aUri,
|
||||
nsILoadInfo* aLoadInfo,
|
||||
nsINode* aRequestingNode,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsSecurityFlags aSecurityFlags,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
nsILoadGroup* aLoadGroup = nullptr,
|
||||
nsIInterfaceRequestor* aCallbacks = nullptr,
|
||||
nsLoadFlags aLoadFlags = nsIRequest::LOAD_NORMAL,
|
||||
nsIIOService* aIoService = nullptr)
|
||||
{
|
||||
MOZ_ASSERT(aLoadInfo, "Can not create a channel without a loadInfo");
|
||||
nsresult rv = NS_NewChannelInternal(outChannel,
|
||||
aUri,
|
||||
aLoadInfo->LoadingNode(),
|
||||
aLoadInfo->LoadingPrincipal(),
|
||||
aLoadInfo->TriggeringPrincipal(),
|
||||
aLoadInfo->GetSecurityFlags(),
|
||||
aLoadInfo->GetContentPolicyType(),
|
||||
aLoadInfo->BaseURI(),
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
aIoService);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
NS_ASSERTION(aRequestingPrincipal, "Can not create channel without a requesting Principal!");
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new mozilla::LoadInfo(aRequestingPrincipal, aTriggeringPrincipal,
|
||||
aRequestingNode, aSecurityFlags, aContentPolicyType);
|
||||
if (!loadInfo) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
return NS_NewChannelInternal(outChannel,
|
||||
aUri,
|
||||
loadInfo,
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
aIoService);
|
||||
}
|
||||
|
||||
inline nsresult /*NS_NewChannelWithNodeAndTriggeringPrincipal */
|
||||
@ -317,7 +297,6 @@ NS_NewChannelWithTriggeringPrincipal(nsIChannel** outChannel,
|
||||
aTriggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aBaseURI
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
@ -344,7 +323,6 @@ NS_NewChannelWithTriggeringPrincipal(nsIChannel** outChannel,
|
||||
aTriggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aBaseURI
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
@ -370,7 +348,6 @@ NS_NewChannel(nsIChannel** outChannel,
|
||||
nullptr, // aTriggeringPrincipal
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aBaseURI
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
@ -395,7 +372,6 @@ NS_NewChannel(nsIChannel** outChannel,
|
||||
nullptr, // aTriggeringPrincipal
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aBaseURI
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
@ -430,7 +406,6 @@ NS_OpenURIInternal(nsIInputStream** outStream,
|
||||
aTriggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aBaseURI
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags,
|
||||
@ -987,7 +962,6 @@ NS_NewStreamLoaderInternal(nsIStreamLoader** outStream,
|
||||
nullptr, // aTriggeringPrincipal
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aBaseURI
|
||||
aLoadGroup,
|
||||
aCallbacks,
|
||||
aLoadFlags);
|
||||
|
Loading…
Reference in New Issue
Block a user