mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1083422 - Add triggering Principal to nsILoadInfo - loadinfo changes (r=bz)
This commit is contained in:
parent
8ea69bae41
commit
989babd090
@ -14,18 +14,22 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
LoadInfo::LoadInfo(nsIPrincipal* aPrincipal,
|
||||
LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsINode* aLoadingContext,
|
||||
nsSecurityFlags aSecurityFlags,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
nsIURI* aBaseURI)
|
||||
: mPrincipal(aPrincipal)
|
||||
: mLoadingPrincipal(aLoadingPrincipal)
|
||||
, mTriggeringPrincipal(aTriggeringPrincipal ?
|
||||
aTriggeringPrincipal : aLoadingPrincipal)
|
||||
, mLoadingContext(do_GetWeakReference(aLoadingContext))
|
||||
, mSecurityFlags(aSecurityFlags)
|
||||
, mContentPolicyType(aContentPolicyType)
|
||||
, mBaseURI(aBaseURI)
|
||||
{
|
||||
MOZ_ASSERT(aPrincipal);
|
||||
MOZ_ASSERT(aLoadingPrincipal);
|
||||
MOZ_ASSERT(mTriggeringPrincipal);
|
||||
// if the load is sandboxed, we can not also inherit the principal
|
||||
if (mSecurityFlags & nsILoadInfo::SEC_SANDBOXED) {
|
||||
mSecurityFlags ^= nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL;
|
||||
@ -39,16 +43,29 @@ LoadInfo::~LoadInfo()
|
||||
NS_IMPL_ISUPPORTS(LoadInfo, nsILoadInfo)
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetLoadingPrincipal(nsIPrincipal** aPrincipal)
|
||||
LoadInfo::GetLoadingPrincipal(nsIPrincipal** aLoadingPrincipal)
|
||||
{
|
||||
NS_ADDREF(*aPrincipal = mPrincipal);
|
||||
NS_ADDREF(*aLoadingPrincipal = mLoadingPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
LoadInfo::LoadingPrincipal()
|
||||
{
|
||||
return mPrincipal;
|
||||
return mLoadingPrincipal;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadInfo::GetTriggeringPrincipal(nsIPrincipal** aTriggeringPrincipal)
|
||||
{
|
||||
NS_ADDREF(*aTriggeringPrincipal = mTriggeringPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIPrincipal*
|
||||
LoadInfo::TriggeringPrincipal()
|
||||
{
|
||||
return mTriggeringPrincipal;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -26,8 +26,9 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSILOADINFO
|
||||
|
||||
// aPrincipal MUST NOT BE NULL.
|
||||
LoadInfo(nsIPrincipal* aPrincipal,
|
||||
// aLoadingPrincipal MUST NOT BE NULL.
|
||||
LoadInfo(nsIPrincipal* aLoadingPrincipal,
|
||||
nsIPrincipal* aTriggeringPrincipal,
|
||||
nsINode* aLoadingContext,
|
||||
nsSecurityFlags aSecurityFlags,
|
||||
nsContentPolicyType aContentPolicyType,
|
||||
@ -36,7 +37,8 @@ public:
|
||||
private:
|
||||
~LoadInfo();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
|
||||
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
|
||||
nsWeakPtr mLoadingContext;
|
||||
nsSecurityFlags mSecurityFlags;
|
||||
nsContentPolicyType mContentPolicyType;
|
||||
|
@ -17,7 +17,7 @@ typedef unsigned long nsSecurityFlags;
|
||||
/**
|
||||
* An nsILoadOwner represents per-load information about who started the load.
|
||||
*/
|
||||
[scriptable, builtinclass, uuid(b22b8ee7-047a-4351-a749-13c6d39f6b17)]
|
||||
[scriptable, builtinclass, uuid(da363267-236d-49bf-83a2-33da8d892728)]
|
||||
interface nsILoadInfo : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -72,6 +72,25 @@ interface nsILoadInfo : nsISupports
|
||||
[noscript, notxpcom, nostdcall, binaryname(LoadingPrincipal)]
|
||||
nsIPrincipal binaryLoadingPrincipal();
|
||||
|
||||
/**
|
||||
* The triggeringPrincipal is the principal that triggerd the load.
|
||||
* Most likely the triggeringPrincipal and the loadingPrincipal are the same,
|
||||
* in which case triggeringPrincipal returns the loadingPrincipal.
|
||||
* In some cases the loadingPrincipal and the triggeringPrincipal are different
|
||||
* however, e.g. a stylesheet may import a subresource. In that case the
|
||||
* stylesheet principal is the triggeringPrincipal and the document that loads
|
||||
* the stylesheet provides a loadingContext and hence the loadingPrincipal.
|
||||
*
|
||||
* If triggeringPrincipal and loadingPrincipal are the same, then
|
||||
* triggeringPrincipal returns loadingPrincipal.
|
||||
*/
|
||||
readonly attribute nsIPrincipal triggeringPrincipal;
|
||||
|
||||
/**
|
||||
* A C++-friendly version of triggeringPrincipal.
|
||||
*/
|
||||
[noscript, notxpcom, nostdcall, binaryname(TriggeringPrincipal)]
|
||||
nsIPrincipal binaryTriggeringPrincipal();
|
||||
|
||||
/**
|
||||
* The loadingDocument of the channel.
|
||||
|
Loading…
Reference in New Issue
Block a user