Bug 1507540 part 1. Use more notxpcom attributes in caps/. r=mrbkap
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 19 Nov 2018 20:17:52 -0500
changeset 503587 edff28b27f207b3d6e592b131bd0f7bf94da9982
parent 503586 c1d4918380adbf58e0fb231fb8de6940fce5f7c3
child 503588 a1e826769668287bd7250e85fa529a6c66bfb495
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1507540
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1507540 part 1. Use more notxpcom attributes in caps/. r=mrbkap
caps/ContentPrincipal.cpp
caps/ContentPrincipal.h
caps/DomainPolicy.cpp
caps/ExpandedPrincipal.cpp
caps/ExpandedPrincipal.h
caps/NullPrincipal.cpp
caps/NullPrincipal.h
caps/SystemPrincipal.cpp
caps/SystemPrincipal.h
caps/nsIDomainPolicy.idl
caps/nsIPrincipal.idl
gfx/thebes/gfxFontSrcPrincipal.cpp
--- a/caps/ContentPrincipal.cpp
+++ b/caps/ContentPrincipal.cpp
@@ -334,23 +334,22 @@ ContentPrincipal::MayLoadInternal(nsIURI
       NS_URIIsLocalFile(aURI) &&
       NS_RelaxStrictFileOriginPolicy(aURI, mCodebase)) {
     return true;
   }
 
   return false;
 }
 
-NS_IMETHODIMP
-ContentPrincipal::GetHashValue(uint32_t* aValue)
+uint32_t
+ContentPrincipal::GetHashValue()
 {
   MOZ_ASSERT(mCodebase, "Need a codebase");
 
-  *aValue = nsScriptSecurityManager::HashPrincipalByOrigin(this);
-  return NS_OK;
+  return nsScriptSecurityManager::HashPrincipalByOrigin(this);
 }
 
 NS_IMETHODIMP
 ContentPrincipal::GetDomain(nsIURI** aDomain)
 {
   if (!mDomain) {
     *aDomain = nullptr;
     return NS_OK;
--- a/caps/ContentPrincipal.h
+++ b/caps/ContentPrincipal.h
@@ -18,17 +18,17 @@
 
 namespace mozilla {
 
 class ContentPrincipal final : public BasePrincipal
 {
 public:
   NS_DECL_NSISERIALIZABLE
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
-  NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
+  uint32_t GetHashValue() override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
   NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
   NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
   NS_IMETHOD GetSiteOrigin(nsACString& aSiteOrigin) override;
   bool IsCodebasePrincipal() const override { return true; }
 
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -234,23 +234,16 @@ DomainSet::ContainsSuperDomain(nsIURI* a
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // No match.
     return NS_OK;
 
 }
 
-NS_IMETHODIMP
-DomainSet::GetType(uint32_t* aType)
-{
-    *aType = mType;
-    return NS_OK;
-}
-
 void
 DomainSet::CloneSet(InfallibleTArray<URIParams>* aDomains)
 {
     for (auto iter = mHashTable.Iter(); !iter.Done(); iter.Next()) {
         nsIURI* key = iter.Get()->GetKey();
 
         URIParams uri;
         SerializeURI(key, uri);
--- a/caps/ExpandedPrincipal.cpp
+++ b/caps/ExpandedPrincipal.cpp
@@ -139,18 +139,18 @@ ExpandedPrincipal::MayLoadInternal(nsIUR
     if (BasePrincipal::Cast(mPrincipals[i])->MayLoadInternal(uri)) {
       return true;
     }
   }
 
   return false;
 }
 
-NS_IMETHODIMP
-ExpandedPrincipal::GetHashValue(uint32_t* result)
+uint32_t
+ExpandedPrincipal::GetHashValue()
 {
   MOZ_CRASH("extended principal should never be used as key in a hash map");
 }
 
 NS_IMETHODIMP
 ExpandedPrincipal::GetURI(nsIURI** aURI)
 {
   *aURI = nullptr;
--- a/caps/ExpandedPrincipal.h
+++ b/caps/ExpandedPrincipal.h
@@ -27,17 +27,17 @@ public:
   ExpandedPrincipal();
 
   NS_DECL_NSIEXPANDEDPRINCIPAL
   NS_DECL_NSISERIALIZABLE
 
   NS_IMETHOD_(MozExternalRefCountType) AddRef() override { return nsJSPrincipals::AddRef(); };
   NS_IMETHOD_(MozExternalRefCountType) Release() override { return nsJSPrincipals::Release(); };
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
-  NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
+  uint32_t GetHashValue() override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
   NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
   NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
   virtual bool AddonHasPermission(const nsAtom* aPerm) override;
   virtual nsresult GetScriptLocation(nsACString &aStr) override;
 
--- a/caps/NullPrincipal.cpp
+++ b/caps/NullPrincipal.cpp
@@ -134,21 +134,20 @@ NullPrincipal::GetScriptLocation(nsACStr
 {
   return mURI->GetSpec(aStr);
 }
 
 /**
  * nsIPrincipal implementation
  */
 
-NS_IMETHODIMP
-NullPrincipal::GetHashValue(uint32_t *aResult)
+uint32_t
+NullPrincipal::GetHashValue()
 {
-  *aResult = (NS_PTR_TO_INT32(this) >> 2);
-  return NS_OK;
+  return (NS_PTR_TO_INT32(this) >> 2);
 }
 
 NS_IMETHODIMP
 NullPrincipal::SetCsp(nsIContentSecurityPolicy* aCsp)
 {
   // Never destroy an existing CSP on the principal.
   // This method should only be called in rare cases.
 
--- a/caps/NullPrincipal.h
+++ b/caps/NullPrincipal.h
@@ -43,17 +43,17 @@ public:
   {
   }
 
   static PrincipalKind Kind() { return eNullPrincipal; }
 
   NS_DECL_NSISERIALIZABLE
 
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
-  NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
+  uint32_t GetHashValue() override;
   NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
   NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
   NS_IMETHOD GetAddonId(nsAString& aAddonId) override;
 
   static already_AddRefed<NullPrincipal>
--- a/caps/SystemPrincipal.cpp
+++ b/caps/SystemPrincipal.cpp
@@ -47,21 +47,20 @@ SystemPrincipal::GetScriptLocation(nsACS
     aStr.AssignLiteral(SYSTEM_PRINCIPAL_SPEC);
     return NS_OK;
 }
 
 ///////////////////////////////////////
 // Methods implementing nsIPrincipal //
 ///////////////////////////////////////
 
-NS_IMETHODIMP
-SystemPrincipal::GetHashValue(uint32_t *result)
+uint32_t
+SystemPrincipal::GetHashValue()
 {
-    *result = NS_PTR_TO_INT32(this);
-    return NS_OK;
+    return NS_PTR_TO_INT32(this);
 }
 
 NS_IMETHODIMP
 SystemPrincipal::GetURI(nsIURI** aURI)
 {
     *aURI = nullptr;
     return NS_OK;
 }
--- a/caps/SystemPrincipal.h
+++ b/caps/SystemPrincipal.h
@@ -30,17 +30,17 @@ class SystemPrincipal final : public Bas
 
 public:
   static already_AddRefed<SystemPrincipal> Create();
 
   static PrincipalKind Kind() { return eSystemPrincipal; }
 
   NS_DECL_NSISERIALIZABLE
   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
-  NS_IMETHOD GetHashValue(uint32_t* aHashValue) override;
+  uint32_t GetHashValue() override;
   NS_IMETHOD GetURI(nsIURI** aURI) override;
   NS_IMETHOD GetDomain(nsIURI** aDomain) override;
   NS_IMETHOD SetDomain(nsIURI* aDomain) override;
   NS_IMETHOD GetCsp(nsIContentSecurityPolicy** aCsp) override;
   NS_IMETHOD SetCsp(nsIContentSecurityPolicy* aCsp) override;
   NS_IMETHOD EnsureCSP(nsIDocument* aDocument, nsIContentSecurityPolicy** aCSP) override;
   NS_IMETHOD GetPreloadCsp(nsIContentSecurityPolicy** aPreloadCSP) override;
   NS_IMETHOD EnsurePreloadCSP(nsIDocument* aDocument, nsIContentSecurityPolicy** aCSP) override;
--- a/caps/nsIDomainPolicy.idl
+++ b/caps/nsIDomainPolicy.idl
@@ -44,21 +44,16 @@ interface nsIDomainPolicy : nsISupports
     [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone);
     [noscript, notxpcom] void applyClone(in DomainPolicyCloneConstPtr aClone);
 };
 
 [scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)]
 interface nsIDomainSet : nsISupports
 {
     /*
-     * The type of the set. See: DomainSetType
-     */
-    [noscript] readonly attribute uint32_t type;
-
-    /*
      * Add a domain to the set. No-op if it already exists.
      */
     void add(in nsIURI aDomain);
 
     /*
      * Remove a domain from the set. No-op if it doesn't exist.
      */
     void remove(in nsIURI aDomain);
--- a/caps/nsIPrincipal.idl
+++ b/caps/nsIPrincipal.idl
@@ -64,17 +64,17 @@ interface nsIPrincipal : nsISerializable
     %{C++
       DECL_FAST_INLINE_HELPER(Equals)
       DECL_FAST_INLINE_HELPER(EqualsConsideringDomain)
     %}
 
     /**
      * Returns a hash value for the principal.
      */
-    [noscript] readonly attribute unsigned long hashValue;
+    [notxpcom, nostdcall] readonly attribute unsigned long hashValue;
 
     /**
      * The codebase URI to which this principal pertains.  This is
      * generally the document URI.
      */
     readonly attribute nsIURI URI;
 
     /**
--- a/gfx/thebes/gfxFontSrcPrincipal.cpp
+++ b/gfx/thebes/gfxFontSrcPrincipal.cpp
@@ -13,19 +13,17 @@ using mozilla::BasePrincipal;
 
 gfxFontSrcPrincipal::gfxFontSrcPrincipal(nsIPrincipal* aPrincipal)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(aPrincipal);
 
   mPrincipal = aPrincipal;
 
-  uint32_t hash = 0;
-  mPrincipal->GetHashValue(&hash);
-  mHash = hash;
+  mHash = mPrincipal->GetHashValue();
 }
 
 gfxFontSrcPrincipal::~gfxFontSrcPrincipal()
 {
   NS_ReleaseOnMainThreadSystemGroup("gfxFontSrcPrincipal::mPrincipal",
                                     mPrincipal.forget());
 }