Skip to content

Commit

Permalink
Bug 708901 - Migrate to nsTHashSet in caps. r=ckerschb
Browse files Browse the repository at this point in the history
  • Loading branch information
sigiesec committed Mar 24, 2021
1 parent 15d3d06 commit 8118f95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions caps/DomainPolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ NS_IMETHODIMP
DomainSet::Add(nsIURI* aDomain) {
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.PutEntry(clone);
mHashTable.Insert(clone);
if (XRE_IsParentProcess()) {
return BroadcastDomainSetChange(mType, ADD_DOMAIN, aDomain);
}
Expand All @@ -159,7 +159,7 @@ NS_IMETHODIMP
DomainSet::Remove(nsIURI* aDomain) {
nsCOMPtr<nsIURI> clone = GetCanonicalClone(aDomain);
NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE);
mHashTable.RemoveEntry(clone);
mHashTable.Remove(clone);
if (XRE_IsParentProcess()) {
return BroadcastDomainSetChange(mType, REMOVE_DOMAIN, aDomain);
}
Expand Down Expand Up @@ -215,10 +215,7 @@ DomainSet::ContainsSuperDomain(nsIURI* aDomain, bool* aContains) {
}

void DomainSet::CloneSet(nsTArray<RefPtr<nsIURI>>* aDomains) {
for (auto iter = mHashTable.Iter(); !iter.Done(); iter.Next()) {
nsIURI* key = iter.Get()->GetKey();
aDomains->AppendElement(key);
}
AppendToArray(*aDomains, mHashTable);
}

} /* namespace mozilla */
4 changes: 2 additions & 2 deletions caps/DomainPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define DomainPolicy_h__

#include "nsIDomainPolicy.h"
#include "nsTHashtable.h"
#include "nsTHashSet.h"
#include "nsURIHashKey.h"

namespace mozilla {
Expand Down Expand Up @@ -40,7 +40,7 @@ class DomainSet final : public nsIDomainSet {

protected:
virtual ~DomainSet() {}
nsTHashtable<nsURIHashKey> mHashTable;
nsTHashSet<nsURIHashKey> mHashTable;
DomainSetType mType;
};

Expand Down

0 comments on commit 8118f95

Please sign in to comment.