Bug 708901 - Migrate to nsTHashSet in toolkit/components/url-classifier. r=gcp

Depends on D109328

Differential Revision: https://phabricator.services.mozilla.com/D108604
This commit is contained in:
Simon Giesecke 2021-03-23 10:36:40 +00:00
Родитель 76ee0ac27d
Коммит 3cafaea14a
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -34,6 +34,7 @@
#include "nsPIDOMWindow.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadManager.h"
#include "nsTHashSet.h"
#include "Classifier.h"
#include "Entries.h"
#include "prprf.h"
@ -844,7 +845,7 @@ nsresult nsUrlClassifierUtils::ReadProvidersFromPrefs(ProviderDictType& aDict) {
NS_ENSURE_SUCCESS(rv, rv);
// Collect providers from childArray.
nsTHashtable<nsCStringHashKey> providers;
nsTHashSet<nsCString> providers;
for (auto& child : childArray) {
auto dotPos = child.FindChar('.');
if (dotPos < 0) {
@ -853,16 +854,15 @@ nsresult nsUrlClassifierUtils::ReadProvidersFromPrefs(ProviderDictType& aDict) {
nsDependentCSubstring provider = Substring(child, 0, dotPos);
providers.PutEntry(provider);
providers.Insert(provider);
}
// Now we have all providers. Check which one owns |aTableName|.
// e.g. The owning lists of provider "google" is defined in
// "browser.safebrowsing.provider.google.lists".
for (auto itr = providers.Iter(); !itr.Done(); itr.Next()) {
auto entry = itr.Get();
nsCString provider(entry->GetKey());
nsPrintfCString owninListsPref("%s.lists", provider.get());
for (const auto& provider : providers) {
nsPrintfCString owninListsPref("%s.lists",
nsPromiseFlatCString{provider}.get());
nsAutoCString owningLists;
nsresult rv = prefBranch->GetCharPref(owninListsPref.get(), owningLists);