Bug 1522265 - Moving malware, phishing and blocked URIs to features - part 2 - factory updated, r=dimi

This commit is contained in:
Andrea Marchesini 2019-01-29 10:11:33 +01:00
Родитель f43141ec0a
Коммит 19c65633d3
4 изменённых файлов: 23 добавлений и 0 удалений

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

@ -79,6 +79,11 @@ namespace net {
aFeatures.AppendElements(flashFeatures);
}
/* static */ void UrlClassifierFeatureFactory::GetFeaturesNoChannel(
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures) {
UrlClassifierFeatureNoChannel::MaybeCreate(aFeatures);
}
/* static */
nsIUrlClassifierFeature*
UrlClassifierFeatureFactory::GetFeatureLoginReputation() {

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

@ -24,6 +24,9 @@ class UrlClassifierFeatureFactory final {
nsIChannel* aChannel,
nsTArray<nsCOMPtr<nsIUrlClassifierFeature>>& aFeatures);
static void GetFeaturesNoChannel(
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures);
static nsIUrlClassifierFeature* GetFeatureLoginReputation();
static already_AddRefed<nsIUrlClassifierFeature> GetFeatureByName(

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

@ -71,6 +71,18 @@ UrlClassifierFeatureNoChannel::UrlClassifierFeatureNoChannel(
}
}
/* static */ void UrlClassifierFeatureNoChannel::MaybeCreate(
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures) {
MaybeInitialize();
for (const NoChannelFeature& feature : sNoChannelFeaturesMap) {
if (feature.mPref()) {
MOZ_ASSERT(feature.mFeature);
aFeatures.AppendElement(feature.mFeature);
}
}
}
/* static */ already_AddRefed<nsIUrlClassifierFeature>
UrlClassifierFeatureNoChannel::GetIfNameMatches(const nsACString& aName) {
MaybeInitialize();

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

@ -20,6 +20,9 @@ class UrlClassifierFeatureNoChannel final : public UrlClassifierFeatureBase {
static void MaybeShutdown();
static void MaybeCreate(
nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures);
static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
const nsACString& aName);