зеркало из https://github.com/mozilla/gecko-dev.git
Bug 956382 - Introduce an explicit API to do principal checks with document.domain. r=mrbkap
This commit is contained in:
Родитель
3211da1532
Коммит
c5505c6f3d
|
@ -20,7 +20,7 @@ interface nsIContentSecurityPolicy;
|
|||
[ptr] native JSPrincipals(JSPrincipals);
|
||||
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
|
||||
|
||||
[scriptable, builtinclass, uuid(f09d8a53-a6c8-4f68-b329-9a76a709d24e)]
|
||||
[scriptable, builtinclass, uuid(0416bfa5-c94b-485c-81a7-e48305c60289)]
|
||||
interface nsIPrincipal : nsISerializable
|
||||
{
|
||||
/**
|
||||
|
@ -35,6 +35,11 @@ interface nsIPrincipal : nsISerializable
|
|||
*/
|
||||
boolean equalsIgnoringDomain(in nsIPrincipal other);
|
||||
|
||||
/**
|
||||
* An alias for equals() (for now).
|
||||
*/
|
||||
boolean equalsConsideringDomain(in nsIPrincipal other);
|
||||
|
||||
%{C++
|
||||
inline bool Equals(nsIPrincipal* aOther) {
|
||||
bool equal = false;
|
||||
|
@ -45,6 +50,11 @@ interface nsIPrincipal : nsISerializable
|
|||
bool equal = false;
|
||||
return NS_SUCCEEDED(EqualsIgnoringDomain(aOther, &equal)) && equal;
|
||||
}
|
||||
|
||||
inline bool EqualsConsideringDomain(nsIPrincipal* aOther) {
|
||||
bool equal = false;
|
||||
return NS_SUCCEEDED(EqualsConsideringDomain(aOther, &equal)) && equal;
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
|
@ -96,6 +106,11 @@ interface nsIPrincipal : nsISerializable
|
|||
*/
|
||||
boolean subsumesIgnoringDomain(in nsIPrincipal other);
|
||||
|
||||
/**
|
||||
* An alias for subsumes() (for now);
|
||||
*/
|
||||
boolean subsumesConsideringDomain(in nsIPrincipal other);
|
||||
|
||||
%{C++
|
||||
inline bool Subsumes(nsIPrincipal* aOther) {
|
||||
bool subsumes = false;
|
||||
|
@ -106,6 +121,11 @@ interface nsIPrincipal : nsISerializable
|
|||
bool subsumes = false;
|
||||
return NS_SUCCEEDED(SubsumesIgnoringDomain(aOther, &subsumes)) && subsumes;
|
||||
}
|
||||
|
||||
inline bool SubsumesConsideringDomain(nsIPrincipal* aOther) {
|
||||
bool subsumes = false;
|
||||
return NS_SUCCEEDED(SubsumesConsideringDomain(aOther, &subsumes)) && subsumes;
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
NS_DECL_NSISERIALIZABLE
|
||||
NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD GetHashValue(uint32_t* aHashValue);
|
||||
NS_IMETHOD GetURI(nsIURI** aURI);
|
||||
NS_IMETHOD GetDomain(nsIURI** aDomain);
|
||||
|
@ -59,6 +60,7 @@ public:
|
|||
NS_IMETHOD GetOrigin(char** aOrigin);
|
||||
NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal);
|
||||
NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix);
|
||||
NS_IMETHOD GetAppStatus(uint16_t* aAppStatus);
|
||||
|
@ -135,6 +137,7 @@ public:
|
|||
NS_DECL_NSISERIALIZABLE
|
||||
NS_IMETHOD Equals(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD EqualsConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD GetHashValue(uint32_t* aHashValue);
|
||||
NS_IMETHOD GetURI(nsIURI** aURI);
|
||||
NS_IMETHOD GetDomain(nsIURI** aDomain);
|
||||
|
@ -142,6 +145,7 @@ public:
|
|||
NS_IMETHOD GetOrigin(char** aOrigin);
|
||||
NS_IMETHOD Subsumes(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesIgnoringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD SubsumesConsideringDomain(nsIPrincipal* other, bool* _retval);
|
||||
NS_IMETHOD CheckMayLoad(nsIURI* uri, bool report, bool allowIfInheritsPrincipal);
|
||||
NS_IMETHOD GetJarPrefix(nsACString& aJarPrefix);
|
||||
NS_IMETHOD GetAppStatus(uint16_t* aAppStatus);
|
||||
|
|
|
@ -139,6 +139,12 @@ nsNullPrincipal::EqualsIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
|||
return Equals(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return Equals(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipal::GetHashValue(uint32_t *aResult)
|
||||
{
|
||||
|
@ -216,6 +222,12 @@ nsNullPrincipal::SubsumesIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
|||
return Subsumes(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return Subsumes(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNullPrincipal::CheckMayLoad(nsIURI* aURI, bool aReport, bool aAllowIfInheritsPrincipal)
|
||||
{
|
||||
|
|
|
@ -285,6 +285,12 @@ nsPrincipal::EqualsIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return Equals(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
|
@ -297,6 +303,12 @@ nsPrincipal::SubsumesIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
|
|||
return EqualsIgnoringDomain(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
|
||||
{
|
||||
return Subsumes(aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrincipal::GetURI(nsIURI** aURI)
|
||||
{
|
||||
|
@ -674,6 +686,12 @@ nsExpandedPrincipal::EqualsIgnoringDomain(nsIPrincipal* aOther, bool* aResult)
|
|||
return ::Equals(this, &nsIPrincipal::SubsumesIgnoringDomain, aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpandedPrincipal::EqualsConsideringDomain(nsIPrincipal* aOther, bool* aResult)
|
||||
{
|
||||
return ::Equals(this, &nsIPrincipal::SubsumesConsideringDomain, aOther, aResult);
|
||||
}
|
||||
|
||||
// nsExpandedPrincipal::Subsumes and nsExpandedPrincipal::SubsumesIgnoringDomain
|
||||
// shares the same logic. The difference only that Subsumes calls are replaced
|
||||
//with SubsumesIgnoringDomain calls in the second case.
|
||||
|
@ -726,6 +744,12 @@ nsExpandedPrincipal::SubsumesIgnoringDomain(nsIPrincipal* aOther, bool* aResult)
|
|||
return ::Subsumes(this, &nsIPrincipal::SubsumesIgnoringDomain, aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpandedPrincipal::SubsumesConsideringDomain(nsIPrincipal* aOther, bool* aResult)
|
||||
{
|
||||
return ::Subsumes(this, &nsIPrincipal::SubsumesConsideringDomain, aOther, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpandedPrincipal::CheckMayLoad(nsIURI* uri, bool aReport, bool aAllowIfInheritsPrincipal)
|
||||
{
|
||||
|
|
|
@ -84,6 +84,12 @@ nsSystemPrincipal::EqualsIgnoringDomain(nsIPrincipal *other, bool *result)
|
|||
return Equals(other, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemPrincipal::EqualsConsideringDomain(nsIPrincipal *other, bool *result)
|
||||
{
|
||||
return Equals(other, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemPrincipal::Subsumes(nsIPrincipal *other, bool *result)
|
||||
{
|
||||
|
@ -98,6 +104,13 @@ nsSystemPrincipal::SubsumesIgnoringDomain(nsIPrincipal *other, bool *result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemPrincipal::SubsumesConsideringDomain(nsIPrincipal *other, bool *result)
|
||||
{
|
||||
*result = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSystemPrincipal::CheckMayLoad(nsIURI* uri, bool aReport, bool aAllowIfInheritsPrincipal)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче