mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1107638 - Add innerWindowID to LoadInfo (r=sicking,jduell)
This commit is contained in:
parent
69be1e0363
commit
9bf28aea8a
@ -28,6 +28,8 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
, mSecurityFlags(aSecurityFlags)
|
||||
, mContentPolicyType(aContentPolicyType)
|
||||
, mBaseURI(aBaseURI)
|
||||
, mInnerWindowID(aLoadingContext ?
|
||||
aLoadingContext->OwnerDoc()->InnerWindowID() : 0)
|
||||
{
|
||||
MOZ_ASSERT(mLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
@ -43,6 +45,21 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
}
|
||||
}
|
||||
|
||||
LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsSecurityFlags aSecurityFlags,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
uint32_t aInnerWindowID)
|
||||
: mLoadingPrincipal(aLoadingPrincipal)
|
||||
, mTriggeringPrincipal(aTriggeringPrincipal)
|
||||
, mSecurityFlags(aSecurityFlags)
|
||||
, mContentPolicyType(aContentPolicyType)
|
||||
, mInnerWindowID(aInnerWindowID)
|
||||
{
|
||||
MOZ_ASSERT(mLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
}
|
||||
|
||||
LoadInfo::~LoadInfo()
|
||||
{
|
||||
}
|
||||
@ -135,4 +152,11 @@ LoadInfo::BaseURI()
|
||||
return mBaseURI;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetInnerWindowID(uint32_t* outInnerWindowID)
|
||||
{
|
||||
*outInnerWindowID = mInnerWindowID;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -17,6 +17,11 @@ class nsINode;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace net {
|
||||
class HttpChannelParent;
|
||||
class FTPChannelParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that provides an nsILoadInfo implementation.
|
||||
*/
|
||||
@ -35,6 +40,18 @@ public:
|
||||
nsIURI* aBaseURI = nullptr);
|
||||
|
||||
private:
|
||||
// private constructor that is only allowed to be called from within
|
||||
// HttpChannelParent and FTPChannelParent declared as friends undeneath.
|
||||
// In e10s we can not serialize nsINode, hence we store the innerWindowID.
|
||||
LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsSecurityFlags aSecurityFlags,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
uint32_t aInnerWindowID);
|
||||
|
||||
friend class net::HttpChannelParent;
|
||||
friend class net::FTPChannelParent;
|
||||
|
||||
~LoadInfo();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||
@ -43,6 +60,7 @@ private:
|
||||
nsSecurityFlags mSecurityFlags;
|
||||
nsContentPolicyType mContentPolicyType;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
uint32_t mInnerWindowID;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -180,4 +180,24 @@ interface nsILoadInfo : nsISupports
|
||||
*/
|
||||
[noscript, notxpcom, nostdcall, binaryname(BaseURI)]
|
||||
nsIURI binaryBaseURI();
|
||||
|
||||
/**
|
||||
* The innerWindowId of the loadingDocument, used to identify
|
||||
* the loadingDocument in e10s where the loadingDocument is
|
||||
* not available.
|
||||
*
|
||||
* Warning: If the loadingDocument is null, then the
|
||||
* innerWindowId is 0.
|
||||
*/
|
||||
readonly attribute unsigned long innerWindowID;
|
||||
|
||||
%{ C++
|
||||
inline uint32_t GetInnerWindowID()
|
||||
{
|
||||
uint32_t result;
|
||||
mozilla::DebugOnly<nsresult> rv = GetInnerWindowID(&result);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
return result;
|
||||
}
|
||||
%}
|
||||
};
|
||||
|
@ -57,6 +57,7 @@ struct HttpChannelOpenArgs
|
||||
PrincipalInfo triggeringPrincipalInfo;
|
||||
uint32_t securityFlags;
|
||||
uint32_t contentPolicyType;
|
||||
uint32_t innerWindowID;
|
||||
};
|
||||
|
||||
struct HttpChannelConnectArgs
|
||||
@ -84,6 +85,7 @@ struct FTPChannelOpenArgs
|
||||
PrincipalInfo triggeringPrincipalInfo;
|
||||
uint32_t securityFlags;
|
||||
uint32_t contentPolicyType;
|
||||
uint32_t innerWindowID;
|
||||
};
|
||||
|
||||
struct FTPChannelConnectArgs
|
||||
|
@ -163,6 +163,7 @@ propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
|
||||
openArgs.securityFlags() = aLoadInfo->GetSecurityFlags();
|
||||
openArgs.contentPolicyType() = aLoadInfo->GetContentPolicyType();
|
||||
openArgs.innerWindowID() = aLoadInfo->GetInnerWindowID();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -173,6 +174,7 @@ propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
openArgs.triggeringPrincipalInfo() = requestingPrincipalInfo;
|
||||
openArgs.securityFlags() = nsILoadInfo::SEC_NORMAL;
|
||||
openArgs.contentPolicyType() = nsIContentPolicy::TYPE_OTHER;
|
||||
openArgs.innerWindowID() = 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "nsIOService.h"
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
@ -88,7 +89,7 @@ FTPChannelParent::Init(const FTPChannelCreationArgs& aArgs)
|
||||
const FTPChannelOpenArgs& a = aArgs.get_FTPChannelOpenArgs();
|
||||
return DoAsyncOpen(a.uri(), a.startPos(), a.entityID(), a.uploadStream(),
|
||||
a.requestingPrincipalInfo(), a.triggeringPrincipalInfo(),
|
||||
a.securityFlags(), a.contentPolicyType());
|
||||
a.securityFlags(), a.contentPolicyType(), a.innerWindowID());
|
||||
}
|
||||
case FTPChannelCreationArgs::TFTPChannelConnectArgs:
|
||||
{
|
||||
@ -109,7 +110,8 @@ FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType)
|
||||
const uint32_t& aContentPolicyType,
|
||||
const uint32_t& aInnerWindowID)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
if (!uri)
|
||||
@ -148,19 +150,16 @@ FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
||||
if (NS_FAILED(rv)) {
|
||||
return SendFailedAsyncOpen(rv);
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new mozilla::LoadInfo(requestingPrincipal, triggeringPrincipal,
|
||||
aSecurityFlags, aContentPolicyType,
|
||||
aInnerWindowID);
|
||||
|
||||
nsCOMPtr<nsIChannel> chan;
|
||||
rv = NS_NewChannelWithTriggeringPrincipal(getter_AddRefs(chan),
|
||||
uri,
|
||||
requestingPrincipal,
|
||||
triggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // aLoadGroup
|
||||
nullptr, // aCallbacks
|
||||
nsIRequest::LOAD_NORMAL,
|
||||
ios);
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(chan), uri, loadInfo,
|
||||
nullptr, nullptr,
|
||||
nsIRequest::LOAD_NORMAL, ios);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
@ -68,7 +68,8 @@ protected:
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType);
|
||||
const uint32_t& aContentPolicyType,
|
||||
const uint32_t& aInnerWindowID);
|
||||
|
||||
// used to connect redirected-to channel in parent with just created
|
||||
// ChildChannel. Used during HTTP->FTP redirects.
|
||||
|
@ -1275,6 +1275,7 @@ propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
|
||||
openArgs.securityFlags() = aLoadInfo->GetSecurityFlags();
|
||||
openArgs.contentPolicyType() = aLoadInfo->GetContentPolicyType();
|
||||
openArgs.innerWindowID() = aLoadInfo->GetInnerWindowID();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1285,6 +1286,7 @@ propagateLoadInfo(nsILoadInfo *aLoadInfo,
|
||||
openArgs.triggeringPrincipalInfo() = requestingPrincipalInfo;
|
||||
openArgs.securityFlags() = nsILoadInfo::SEC_NORMAL;
|
||||
openArgs.contentPolicyType() = nsIContentPolicy::TYPE_OTHER;
|
||||
openArgs.innerWindowID() = 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsICachingChannel.h"
|
||||
|
||||
#include "mozilla/LoadInfo.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
@ -106,7 +106,7 @@ HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs)
|
||||
a.entityID(), a.chooseApplicationCache(),
|
||||
a.appCacheClientID(), a.allowSpdy(), a.fds(),
|
||||
a.requestingPrincipalInfo(), a.triggeringPrincipalInfo(),
|
||||
a.securityFlags(), a.contentPolicyType());
|
||||
a.securityFlags(), a.contentPolicyType(), a.innerWindowID());
|
||||
}
|
||||
case HttpChannelCreationArgs::THttpChannelConnectArgs:
|
||||
{
|
||||
@ -196,7 +196,8 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType)
|
||||
const uint32_t& aContentPolicyType,
|
||||
const uint32_t& aInnerWindowID)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
if (!uri) {
|
||||
@ -246,17 +247,14 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
loadFlags |= nsICachingChannel::LOAD_NO_NETWORK_IO;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsILoadInfo> loadInfo =
|
||||
new mozilla::LoadInfo(requestingPrincipal, triggeringPrincipal,
|
||||
aSecurityFlags, aContentPolicyType,
|
||||
aInnerWindowID);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_NewChannelWithTriggeringPrincipal(getter_AddRefs(channel),
|
||||
uri,
|
||||
requestingPrincipal,
|
||||
triggeringPrincipal,
|
||||
aSecurityFlags,
|
||||
aContentPolicyType,
|
||||
nullptr, // loadGroup
|
||||
nullptr, // aCallbacks
|
||||
loadFlags,
|
||||
ios);
|
||||
rv = NS_NewChannelInternal(getter_AddRefs(channel), uri, loadInfo,
|
||||
nullptr, nullptr, loadFlags, ios);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
@ -114,7 +114,8 @@ protected:
|
||||
const ipc::PrincipalInfo& aRequestingPrincipalInfo,
|
||||
const ipc::PrincipalInfo& aTriggeringPrincipalInfo,
|
||||
const uint32_t& aSecurityFlags,
|
||||
const uint32_t& aContentPolicyType);
|
||||
const uint32_t& aContentPolicyType,
|
||||
const uint32_t& aInnerWindowID);
|
||||
|
||||
virtual bool RecvSetPriority(const uint16_t& priority) MOZ_OVERRIDE;
|
||||
virtual bool RecvSetClassOfService(const uint32_t& cos) MOZ_OVERRIDE;
|
||||
|
Loading…
Reference in New Issue
Block a user