Bug 956382 - Remove implementations of *IgnoringDomain variants. r=mrbkap

This commit is contained in:
Bobby Holley 2014-02-13 18:57:36 -08:00
parent 1c600e7056
commit 7e6a232b92
5 changed files with 7 additions and 80 deletions

View File

@ -20,7 +20,7 @@ interface nsIContentSecurityPolicy;
[ptr] native JSPrincipals(JSPrincipals);
[ptr] native PrincipalArray(nsTArray<nsCOMPtr<nsIPrincipal> >);
[scriptable, builtinclass, uuid(0416bfa5-c94b-485c-81a7-e48305c60289)]
[scriptable, builtinclass, uuid(204555e7-04ad-4cc8-9f0e-840615cc43e8)]
interface nsIPrincipal : nsISerializable
{
/**
@ -30,11 +30,6 @@ interface nsIPrincipal : nsISerializable
*/
boolean equals(in nsIPrincipal other);
/**
* An alias for equals() (for now).
*/
boolean equalsIgnoringDomain(in nsIPrincipal other);
/**
* Like equals, but takes document.domain changes into account.
*/
@ -46,11 +41,6 @@ interface nsIPrincipal : nsISerializable
return NS_SUCCEEDED(Equals(aOther, &equal)) && equal;
}
inline bool EqualsIgnoringDomain(nsIPrincipal* aOther) {
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;
@ -100,11 +90,6 @@ interface nsIPrincipal : nsISerializable
*/
boolean subsumes(in nsIPrincipal other);
/**
* An alias for subsumes() (for now);
*/
boolean subsumesIgnoringDomain(in nsIPrincipal other);
/**
* Same as the previous method, subsumes(), but takes document.domain into
* account.
@ -117,11 +102,6 @@ interface nsIPrincipal : nsISerializable
return NS_SUCCEEDED(Subsumes(aOther, &subsumes)) && subsumes;
}
inline bool SubsumesIgnoringDomain(nsIPrincipal* aOther) {
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;

View File

@ -51,7 +51,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
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);
@ -59,7 +58,6 @@ public:
NS_IMETHOD SetDomain(nsIURI* aDomain);
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);
@ -136,7 +134,6 @@ public:
NS_DECL_NSIEXPANDEDPRINCIPAL
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);
@ -144,7 +141,6 @@ public:
NS_IMETHOD SetDomain(nsIURI* aDomain);
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);

View File

@ -133,12 +133,6 @@ nsNullPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipal::EqualsIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
{
return Equals(aOther, aResult);
}
NS_IMETHODIMP
nsNullPrincipal::EqualsConsideringDomain(nsIPrincipal *aOther, bool *aResult)
{
@ -216,12 +210,6 @@ nsNullPrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipal::SubsumesIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
{
return Subsumes(aOther, aResult);
}
NS_IMETHODIMP
nsNullPrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
{

View File

@ -307,24 +307,12 @@ nsPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsPrincipal::EqualsIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
{
return Equals(aOther, aResult);
}
NS_IMETHODIMP
nsPrincipal::Subsumes(nsIPrincipal *aOther, bool *aResult)
{
return Equals(aOther, aResult);
}
NS_IMETHODIMP
nsPrincipal::SubsumesIgnoringDomain(nsIPrincipal *aOther, bool *aResult)
{
return EqualsIgnoringDomain(aOther, aResult);
}
NS_IMETHODIMP
nsPrincipal::SubsumesConsideringDomain(nsIPrincipal *aOther, bool *aResult)
{
@ -673,15 +661,15 @@ typedef nsresult (NS_STDCALL nsIPrincipal::*nsIPrincipalMemFn)(nsIPrincipal* aOt
bool* aResult);
#define CALL_MEMBER_FUNCTION(THIS,MEM_FN) ((THIS)->*(MEM_FN))
// nsExpandedPrincipal::Equals and nsExpandedPrincipal::EqualsIgnoringDomain
// nsExpandedPrincipal::Equals and nsExpandedPrincipal::EqualsConsideringDomain
// shares the same logic. The difference only that Equals requires 'this'
// and 'aOther' to Subsume each other while EqualsIgnoringDomain requires
// bidirectional SubsumesIgnoringDomain.
// and 'aOther' to Subsume each other while EqualsConsideringDomain requires
// bidirectional SubsumesConsideringDomain.
static nsresult
Equals(nsExpandedPrincipal* aThis, nsIPrincipalMemFn aFn, nsIPrincipal* aOther,
bool* aResult)
{
// If (and only if) 'aThis' and 'aOther' both Subsume/SubsumesIgnoringDomain
// If (and only if) 'aThis' and 'aOther' both Subsume/SubsumesConsideringDomain
// each other, then they are Equal.
*aResult = false;
// Calling the corresponding subsume function on this (aFn).
@ -702,21 +690,15 @@ nsExpandedPrincipal::Equals(nsIPrincipal* aOther, bool* aResult)
return ::Equals(this, &nsIPrincipal::Subsumes, aOther, aResult);
}
NS_IMETHODIMP
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
// nsExpandedPrincipal::Subsumes and nsExpandedPrincipal::SubsumesConsideringDomain
// shares the same logic. The difference only that Subsumes calls are replaced
//with SubsumesIgnoringDomain calls in the second case.
//with SubsumesConsideringDomain calls in the second case.
static nsresult
Subsumes(nsExpandedPrincipal* aThis, nsIPrincipalMemFn aFn, nsIPrincipal* aOther,
bool* aResult)
@ -760,12 +742,6 @@ nsExpandedPrincipal::Subsumes(nsIPrincipal* aOther, bool* aResult)
return ::Subsumes(this, &nsIPrincipal::Subsumes, aOther, aResult);
}
NS_IMETHODIMP
nsExpandedPrincipal::SubsumesIgnoringDomain(nsIPrincipal* aOther, bool* aResult)
{
return ::Subsumes(this, &nsIPrincipal::SubsumesIgnoringDomain, aOther, aResult);
}
NS_IMETHODIMP
nsExpandedPrincipal::SubsumesConsideringDomain(nsIPrincipal* aOther, bool* aResult)
{

View File

@ -78,12 +78,6 @@ nsSystemPrincipal::Equals(nsIPrincipal *other, bool *result)
return NS_OK;
}
NS_IMETHODIMP
nsSystemPrincipal::EqualsIgnoringDomain(nsIPrincipal *other, bool *result)
{
return Equals(other, result);
}
NS_IMETHODIMP
nsSystemPrincipal::EqualsConsideringDomain(nsIPrincipal *other, bool *result)
{
@ -97,13 +91,6 @@ nsSystemPrincipal::Subsumes(nsIPrincipal *other, bool *result)
return NS_OK;
}
NS_IMETHODIMP
nsSystemPrincipal::SubsumesIgnoringDomain(nsIPrincipal *other, bool *result)
{
*result = true;
return NS_OK;
}
NS_IMETHODIMP
nsSystemPrincipal::SubsumesConsideringDomain(nsIPrincipal *other, bool *result)
{