Bug 1182966 - Part 1: Use nsTHashTable::Iterator in DomainSet::CloneSet. r=mrbkap
authorAndrew McCreight <continuation@gmail.com>
Tue, 14 Jul 2015 07:58:00 -0400
changeset 279093 c25cbd21c1689948575f21a68f8600433796ba7c
parent 279092 bd3b1119982a606aeae33e08c4930c9adf902ffd
child 279094 7de43f04cd0a68453f047897ae3255af85b53823
push id3577
push userkchen@mozilla.com
push dateFri, 17 Jul 2015 03:58:51 +0000
reviewersmrbkap
bugs1182966
milestone42.0a1
Bug 1182966 - Part 1: Use nsTHashTable::Iterator in DomainSet::CloneSet. r=mrbkap
caps/DomainPolicy.cpp
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -241,29 +241,22 @@ DomainSet::ContainsSuperDomain(nsIURI* a
 
 NS_IMETHODIMP
 DomainSet::GetType(uint32_t* aType)
 {
     *aType = mType;
     return NS_OK;
 }
 
-static
-PLDHashOperator
-DomainEnumerator(nsURIHashKey* aEntry, void* aUserArg)
-{
-    InfallibleTArray<URIParams>* uris = static_cast<InfallibleTArray<URIParams>*>(aUserArg);
-    nsIURI* key = aEntry->GetKey();
-
-    URIParams uri;
-    SerializeURI(key, uri);
-
-    uris->AppendElement(uri);
-    return PL_DHASH_NEXT;
-}
-
 void
 DomainSet::CloneSet(InfallibleTArray<URIParams>* aDomains)
 {
-    mHashTable.EnumerateEntries(DomainEnumerator, aDomains);
+    for (auto iter = mHashTable.Iter(); !iter.Done(); iter.Next()) {
+        nsIURI* key = iter.Get()->GetKey();
+
+        URIParams uri;
+        SerializeURI(key, uri);
+
+        aDomains->AppendElement(uri);
+    }
 }
 
 } /* namespace mozilla */