mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1083422 - Add triggering Principal to nsILoadInfo - e10s changes (r=jduell)
* * * [mq]: tmp
This commit is contained in:
parent
d5cbc137e2
commit
59e7c4cbd1
@ -52,6 +52,7 @@ struct HttpChannelOpenArgs
|
||||
bool allowSpdy;
|
||||
OptionalFileDescriptorSet fds;
|
||||
PrincipalInfo requestingPrincipalInfo;
|
||||
PrincipalInfo triggeringPrincipalInfo;
|
||||
uint32_t securityFlags;
|
||||
uint32_t contentPolicyType;
|
||||
};
|
||||
@ -78,6 +79,7 @@ struct FTPChannelOpenArgs
|
||||
nsCString entityID;
|
||||
OptionalInputStreamParams uploadStream;
|
||||
PrincipalInfo requestingPrincipalInfo;
|
||||
PrincipalInfo triggeringPrincipalInfo;
|
||||
uint32_t securityFlags;
|
||||
uint32_t contentPolicyType;
|
||||
};
|
||||
|
@ -149,12 +149,18 @@ void
|
||||
propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
FTPChannelOpenArgs& openArgs)
|
||||
{
|
||||
mozilla::ipc::PrincipalInfo principalInfo;
|
||||
mozilla::ipc::PrincipalInfo requestingPrincipalInfo;
|
||||
mozilla::ipc::PrincipalInfo triggeringPrincipalInfo;
|
||||
|
||||
if (aLoadInfo) {
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(aLoadInfo->LoadingPrincipal(),
|
||||
&principalInfo);
|
||||
openArgs.requestingPrincipalInfo() = principalInfo;
|
||||
&requestingPrincipalInfo);
|
||||
openArgs.requestingPrincipalInfo() = requestingPrincipalInfo;
|
||||
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(aLoadInfo->TriggeringPrincipal(),
|
||||
&triggeringPrincipalInfo);
|
||||
openArgs.triggeringPrincipalInfo() = triggeringPrincipalInfo;
|
||||
|
||||
openArgs.securityFlags() = aLoadInfo->GetSecurityFlags();
|
||||
openArgs.contentPolicyType() = aLoadInfo->GetContentPolicyType();
|
||||
return;
|
||||
@ -162,8 +168,9 @@ propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
|
||||
// use default values if no loadInfo is provided
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(nsContentUtils::GetSystemPrincipal(),
|
||||
&principalInfo);
|
||||
openArgs.requestingPrincipalInfo() = principalInfo;
|
||||
&requestingPrincipalInfo);
|
||||
openArgs.requestingPrincipalInfo() = requestingPrincipalInfo;
|
||||
openArgs.triggeringPrincipalInfo() = requestingPrincipalInfo;
|
||||
openArgs.securityFlags() = nsILoadInfo::SEC_NORMAL;
|
||||
openArgs.contentPolicyType() = nsIContentPolicy::TYPE_OTHER;
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ FTPChannelParent::Init(const FTPChannelCreationArgs& aArgs)
|
||||
{
|
||||
const FTPChannelOpenArgs& a = aArgs.get_FTPChannelOpenArgs();
|
||||
return DoAsyncOpen(a.uri(), a.startPos(), a.entityID(), a.uploadStream(),
|
||||
a.requestingPrincipalInfo(), a.securityFlags(),
|
||||
a.contentPolicyType());
|
||||
a.requestingPrincipalInfo(), a.triggeringPrincipalInfo(),
|
||||
a.securityFlags(), a.contentPolicyType());
|
||||
}
|
||||
case FTPChannelCreationArgs::TFTPChannelConnectArgs:
|
||||
{
|
||||
@ -107,6 +107,7 @@ FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
||||
const nsCString& aEntityID,
|
||||
const OptionalInputStreamParams& aUploadStream,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType)
|
||||
{
|
||||
@ -142,11 +143,18 @@ FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
||||
if (NS_FAILED(rv)) {
|
||||
return SendFailedAsyncOpen(rv);
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal =
|
||||
mozilla::ipc::PrincipalInfoToPrincipal(aTriggeringPrincipalInfo, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return SendFailedAsyncOpen(rv);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIChannel> chan;
|
||||
rv = NS_NewChannel(getter_AddRefs(chan),
|
||||
rv = NS_NewChannelWithTriggeringPrincipal(getter_AddRefs(chan),
|
||||
uri,
|
||||
requestingPrincipal,
|
||||
triggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aLoadGroup
|
||||
|
@ -66,6 +66,7 @@ protected:
|
||||
const nsCString& aEntityID,
|
||||
const OptionalInputStreamParams& aUploadStream,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType);
|
||||
|
||||
|
@ -1244,12 +1244,18 @@ void
|
||||
propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
HttpChannelOpenArgs& openArgs)
|
||||
{
|
||||
mozilla::ipc::PrincipalInfo principalInfo;
|
||||
mozilla::ipc::PrincipalInfo requestingPrincipalInfo;
|
||||
mozilla::ipc::PrincipalInfo triggeringPrincipalInfo;
|
||||
|
||||
if (aLoadInfo) {
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(aLoadInfo->LoadingPrincipal(),
|
||||
&principalInfo);
|
||||
openArgs.requestingPrincipalInfo() = principalInfo;
|
||||
&requestingPrincipalInfo);
|
||||
openArgs.requestingPrincipalInfo() = requestingPrincipalInfo;
|
||||
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(aLoadInfo->TriggeringPrincipal(),
|
||||
&triggeringPrincipalInfo);
|
||||
openArgs.triggeringPrincipalInfo() = triggeringPrincipalInfo;
|
||||
|
||||
openArgs.securityFlags() = aLoadInfo->GetSecurityFlags();
|
||||
openArgs.contentPolicyType() = aLoadInfo->GetContentPolicyType();
|
||||
return;
|
||||
@ -1257,8 +1263,9 @@ propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
|
||||
// use default values if no loadInfo is provided
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(nsContentUtils::GetSystemPrincipal(),
|
||||
&principalInfo);
|
||||
openArgs.requestingPrincipalInfo() = principalInfo;
|
||||
&requestingPrincipalInfo);
|
||||
openArgs.requestingPrincipalInfo() = requestingPrincipalInfo;
|
||||
openArgs.triggeringPrincipalInfo() = requestingPrincipalInfo;
|
||||
openArgs.securityFlags() = nsILoadInfo::SEC_NORMAL;
|
||||
openArgs.contentPolicyType() = nsIContentPolicy::TYPE_OTHER;
|
||||
}
|
||||
|
@ -105,8 +105,8 @@ HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs)
|
||||
a.thirdPartyFlags(), a.resumeAt(), a.startPos(),
|
||||
a.entityID(), a.chooseApplicationCache(),
|
||||
a.appCacheClientID(), a.allowSpdy(), a.fds(),
|
||||
a.requestingPrincipalInfo(), a.securityFlags(),
|
||||
a.contentPolicyType());
|
||||
a.requestingPrincipalInfo(), a.triggeringPrincipalInfo(),
|
||||
a.securityFlags(), a.contentPolicyType());
|
||||
}
|
||||
case HttpChannelCreationArgs::THttpChannelConnectArgs:
|
||||
{
|
||||
@ -192,6 +192,7 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
const bool& allowSpdy,
|
||||
const OptionalFileDescriptorSet& aFds,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType)
|
||||
{
|
||||
@ -223,6 +224,11 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
if (NS_FAILED(rv)) {
|
||||
return SendFailedAsyncOpen(rv);
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal =
|
||||
mozilla::ipc::PrincipalInfoToPrincipal(aTriggeringPrincipalInfo, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return SendFailedAsyncOpen(rv);
|
||||
}
|
||||
|
||||
bool appOffline = false;
|
||||
uint32_t appId = GetAppId();
|
||||
@ -239,9 +245,10 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_NewChannel(getter_AddRefs(channel),
|
||||
rv = NS_NewChannelWithTriggeringPrincipal(getter_AddRefs(channel),
|
||||
uri,
|
||||
requestingPrincipal,
|
||||
triggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // loadGroup
|
||||
|
@ -110,6 +110,7 @@ protected:
|
||||
const bool& allowSpdy,
|
||||
const OptionalFileDescriptorSet& aFds,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType);
|
||||
|
||||
|
@ -23,6 +23,7 @@ parent:
|
||||
|
||||
Init(URIParams uri,
|
||||
PrincipalInfo requestingPrincipalInfo,
|
||||
PrincipalInfo triggeringPrincipalInfo,
|
||||
uint32_t securityFlags,
|
||||
uint32_t contentPolicyType);
|
||||
AsyncOpen(URIParams originalURI,
|
||||
|
@ -93,25 +93,31 @@ WyciwygChannelChild::Init(nsIURI* uri)
|
||||
SerializeURI(uri, serializedUri);
|
||||
|
||||
// propagate loadInfo
|
||||
mozilla::ipc::PrincipalInfo principalInfo;
|
||||
mozilla::ipc::PrincipalInfo requestingPrincipalInfo;
|
||||
mozilla::ipc::PrincipalInfo triggeringPrincipalInfo;
|
||||
uint32_t securityFlags;
|
||||
uint32_t policyType;
|
||||
if (mLoadInfo) {
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(mLoadInfo->LoadingPrincipal(),
|
||||
&principalInfo);
|
||||
&requestingPrincipalInfo);
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(mLoadInfo->TriggeringPrincipal(),
|
||||
&triggeringPrincipalInfo);
|
||||
securityFlags = mLoadInfo->GetSecurityFlags();
|
||||
policyType = mLoadInfo->GetContentPolicyType();
|
||||
}
|
||||
else {
|
||||
// use default values if no loadInfo is provided
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(nsContentUtils::GetSystemPrincipal(),
|
||||
&principalInfo);
|
||||
&requestingPrincipalInfo);
|
||||
mozilla::ipc::PrincipalToPrincipalInfo(nsContentUtils::GetSystemPrincipal(),
|
||||
&triggeringPrincipalInfo);
|
||||
securityFlags = nsILoadInfo::SEC_NORMAL;
|
||||
policyType = nsIContentPolicy::TYPE_OTHER;
|
||||
}
|
||||
|
||||
SendInit(serializedUri,
|
||||
principalInfo,
|
||||
requestingPrincipalInfo,
|
||||
triggeringPrincipalInfo,
|
||||
securityFlags,
|
||||
policyType);
|
||||
return NS_OK;
|
||||
|
@ -62,6 +62,7 @@ NS_IMPL_ISUPPORTS(WyciwygChannelParent,
|
||||
bool
|
||||
WyciwygChannelParent::RecvInit(const URIParams& aURI,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType)
|
||||
{
|
||||
@ -86,10 +87,17 @@ WyciwygChannelParent::RecvInit(const URIParams& aURI,
|
||||
return SendCancelEarly(rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> triggeringPrincipal =
|
||||
mozilla::ipc::PrincipalInfoToPrincipal(aTriggeringPrincipalInfo, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return SendCancelEarly(rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> chan;
|
||||
rv = NS_NewChannel(getter_AddRefs(chan),
|
||||
rv = NS_NewChannelWithTriggeringPrincipal(getter_AddRefs(chan),
|
||||
uri,
|
||||
requestingPrincipal,
|
||||
triggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // loadGroup
|
||||
|
@ -37,6 +37,7 @@ protected:
|
||||
|
||||
virtual bool RecvInit(const URIParams& uri,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType) MOZ_OVERRIDE;
|
||||
virtual bool RecvAsyncOpen(const URIParams& original,
|
||||
|
Loading…
Reference in New Issue
Block a user