Bug 1182966 - Part 2: Stop referring to the nsI class for no apparent reason in DomainPolicy. r=mrbkap
authorAndrew McCreight <continuation@gmail.com>
Tue, 14 Jul 2015 07:59:00 -0400
changeset 253165 7de43f04cd0a68453f047897ae3255af85b53823
parent 253164 c25cbd21c1689948575f21a68f8600433796ba7c
child 253166 20e4f7dcee9cade91490699efc2c61e62b65e44d
push id62371
push userryanvm@gmail.com
push dateThu, 16 Jul 2015 17:10:09 +0000
treeherdermozilla-inbound@16b99cdb36fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1182966
milestone42.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 1182966 - Part 2: Stop referring to the nsI class for no apparent reason in DomainPolicy. r=mrbkap
caps/DomainPolicy.cpp
caps/DomainPolicy.h
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -57,41 +57,41 @@ DomainPolicy::~DomainPolicy()
     MOZ_ASSERT(!mBlacklist && !mSuperBlacklist &&
                !mWhitelist && !mSuperWhitelist);
 }
 
 
 NS_IMETHODIMP
 DomainPolicy::GetBlacklist(nsIDomainSet** aSet)
 {
-    nsCOMPtr<nsIDomainSet> set = mBlacklist;
+    nsCOMPtr<nsIDomainSet> set = mBlacklist.get();
     set.forget(aSet);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 DomainPolicy::GetSuperBlacklist(nsIDomainSet** aSet)
 {
-    nsCOMPtr<nsIDomainSet> set = mSuperBlacklist;
+    nsCOMPtr<nsIDomainSet> set = mSuperBlacklist.get();
     set.forget(aSet);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 DomainPolicy::GetWhitelist(nsIDomainSet** aSet)
 {
-    nsCOMPtr<nsIDomainSet> set = mWhitelist;
+    nsCOMPtr<nsIDomainSet> set = mWhitelist.get();
     set.forget(aSet);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 DomainPolicy::GetSuperWhitelist(nsIDomainSet** aSet)
 {
-    nsCOMPtr<nsIDomainSet> set = mSuperWhitelist;
+    nsCOMPtr<nsIDomainSet> set = mSuperWhitelist.get();
     set.forget(aSet);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 DomainPolicy::Deactivate()
 {
     // Clear the hashtables first to free up memory, since script might
@@ -117,20 +117,20 @@ DomainPolicy::Deactivate()
     }
     return NS_OK;
 }
 
 void
 DomainPolicy::CloneDomainPolicy(DomainPolicyClone* aClone)
 {
     aClone->active() = true;
-    static_cast<DomainSet*>(mBlacklist.get())->CloneSet(&aClone->blacklist());
-    static_cast<DomainSet*>(mSuperBlacklist.get())->CloneSet(&aClone->superBlacklist());
-    static_cast<DomainSet*>(mWhitelist.get())->CloneSet(&aClone->whitelist());
-    static_cast<DomainSet*>(mSuperWhitelist.get())->CloneSet(&aClone->superWhitelist());
+    mBlacklist->CloneSet(&aClone->blacklist());
+    mSuperBlacklist->CloneSet(&aClone->superBlacklist());
+    mWhitelist->CloneSet(&aClone->whitelist());
+    mSuperWhitelist->CloneSet(&aClone->superWhitelist());
 }
 
 static
 void
 CopyURIs(const InfallibleTArray<URIParams>& aDomains, nsIDomainSet* aSet)
 {
     for (uint32_t i = 0; i < aDomains.Length(); i++) {
         nsCOMPtr<nsIURI> uri = DeserializeURI(aDomains[i]);
--- a/caps/DomainPolicy.h
+++ b/caps/DomainPolicy.h
@@ -28,32 +28,16 @@ enum DomainSetChangeType{
 enum DomainSetType{
     NO_TYPE,
     BLACKLIST,
     SUPER_BLACKLIST,
     WHITELIST,
     SUPER_WHITELIST
 };
 
-class DomainPolicy : public nsIDomainPolicy
-{
-public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIDOMAINPOLICY
-    DomainPolicy();
-
-private:
-    virtual ~DomainPolicy();
-
-    nsCOMPtr<nsIDomainSet> mBlacklist;
-    nsCOMPtr<nsIDomainSet> mSuperBlacklist;
-    nsCOMPtr<nsIDomainSet> mWhitelist;
-    nsCOMPtr<nsIDomainSet> mSuperWhitelist;
-};
-
 class DomainSet : public nsIDomainSet
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIDOMAINSET
 
     explicit DomainSet(DomainSetType aType)
         : mType(aType)
@@ -62,11 +46,27 @@ public:
     void CloneSet(InfallibleTArray<mozilla::ipc::URIParams>* aDomains);
 
 protected:
     virtual ~DomainSet() {}
     nsTHashtable<nsURIHashKey> mHashTable;
     DomainSetType mType;
 };
 
+class DomainPolicy : public nsIDomainPolicy
+{
+public:
+    NS_DECL_ISUPPORTS
+    NS_DECL_NSIDOMAINPOLICY
+    DomainPolicy();
+
+private:
+    virtual ~DomainPolicy();
+
+    nsRefPtr<DomainSet> mBlacklist;
+    nsRefPtr<DomainSet> mSuperBlacklist;
+    nsRefPtr<DomainSet> mWhitelist;
+    nsRefPtr<DomainSet> mSuperWhitelist;
+};
+
 } /* namespace mozilla */
 
 #endif /* DomainPolicy_h__ */