From 9b971f4a503b927932e4ae014770f8cedc9b2e8d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Fri, 3 May 2013 14:47:09 -0700 Subject: [PATCH] Bug 829872 - Add convenience version of Equals/Subsumes to nsIPrincipal. r=bz --- caps/idl/nsIPrincipal.idl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/caps/idl/nsIPrincipal.idl b/caps/idl/nsIPrincipal.idl index 64d06d52b280..9cea30c1b9a7 100644 --- a/caps/idl/nsIPrincipal.idl +++ b/caps/idl/nsIPrincipal.idl @@ -36,6 +36,18 @@ interface nsIPrincipal : nsISerializable */ boolean equalsIgnoringDomain(in nsIPrincipal other); + %{C++ + inline bool Equals(nsIPrincipal* aOther) { + bool equal = false; + return NS_SUCCEEDED(Equals(aOther, &equal)) && equal; + } + + inline bool EqualsIgnoringDomain(nsIPrincipal* aOther) { + bool equal = false; + return NS_SUCCEEDED(EqualsIgnoringDomain(aOther, &equal)) && equal; + } + %} + /** * Returns a hash value for the principal. */ @@ -100,6 +112,18 @@ interface nsIPrincipal : nsISerializable */ boolean subsumesIgnoringDomain(in nsIPrincipal other); + %{C++ + inline bool Subsumes(nsIPrincipal* aOther) { + bool subsumes = false; + return NS_SUCCEEDED(Subsumes(aOther, &subsumes)) && subsumes; + } + + inline bool SubsumesIgnoringDomain(nsIPrincipal* aOther) { + bool subsumes = false; + return NS_SUCCEEDED(SubsumesIgnoringDomain(aOther, &subsumes)) && subsumes; + } + %} + /** * Checks whether this principal is allowed to load the network resource * located at the given URI under the same-origin policy. This means that