Bug 1522265 - Moving malware, phishing and blocked URIs to features - part 2 - factory updated, r=dimi
☠☠ backed out by 98040e23391e ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 29 Jan 2019 10:11:33 +0100
changeset 455942 6085d51681f8c763132973f65f305f1f15058135
parent 455941 e6a0832f3b1192a550136835d25550783afcbf04
child 455943 38b824df9d028df7a3e3e8e5e11e35b069056054
push id35463
push usershindli@mozilla.com
push dateTue, 29 Jan 2019 21:38:17 +0000
treeherdermozilla-central@4440fbf71c72 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1522265
milestone67.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 1522265 - Moving malware, phishing and blocked URIs to features - part 2 - factory updated, r=dimi
netwerk/url-classifier/UrlClassifierFeatureFactory.cpp
netwerk/url-classifier/UrlClassifierFeatureFactory.h
netwerk/url-classifier/UrlClassifierFeatureNoChannel.cpp
netwerk/url-classifier/UrlClassifierFeatureNoChannel.h
--- a/netwerk/url-classifier/UrlClassifierFeatureFactory.cpp
+++ b/netwerk/url-classifier/UrlClassifierFeatureFactory.cpp
@@ -74,16 +74,21 @@ namespace net {
   }
 
   // Flash
   nsTArray<nsCOMPtr<nsIUrlClassifierFeature>> flashFeatures;
   UrlClassifierFeatureFlash::MaybeCreate(aChannel, flashFeatures);
   aFeatures.AppendElements(flashFeatures);
 }
 
+/* static */ void UrlClassifierFeatureFactory::GetFeaturesNoChannel(
+    nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures) {
+  UrlClassifierFeatureNoChannel::MaybeCreate(aFeatures);
+}
+
 /* static */
 nsIUrlClassifierFeature*
 UrlClassifierFeatureFactory::GetFeatureLoginReputation() {
   return UrlClassifierFeatureLoginReputation::MaybeGetOrCreate();
 }
 
 /* static */ already_AddRefed<nsIUrlClassifierFeature>
 UrlClassifierFeatureFactory::GetFeatureByName(const nsACString& aName) {
--- a/netwerk/url-classifier/UrlClassifierFeatureFactory.h
+++ b/netwerk/url-classifier/UrlClassifierFeatureFactory.h
@@ -19,16 +19,19 @@ namespace net {
 class UrlClassifierFeatureFactory final {
  public:
   static void Shutdown();
 
   static void GetFeaturesFromChannel(
       nsIChannel* aChannel,
       nsTArray<nsCOMPtr<nsIUrlClassifierFeature>>& aFeatures);
 
+  static void GetFeaturesNoChannel(
+      nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures);
+
   static nsIUrlClassifierFeature* GetFeatureLoginReputation();
 
   static already_AddRefed<nsIUrlClassifierFeature> GetFeatureByName(
       const nsACString& aFeatureName);
 
   static void GetFeatureNames(nsTArray<nsCString>& aArray);
 
   static already_AddRefed<nsIUrlClassifierFeature> CreateFeatureWithTables(
--- a/netwerk/url-classifier/UrlClassifierFeatureNoChannel.cpp
+++ b/netwerk/url-classifier/UrlClassifierFeatureNoChannel.cpp
@@ -66,16 +66,28 @@ UrlClassifierFeatureNoChannel::UrlClassi
   for (NoChannelFeature& feature : sNoChannelFeaturesMap) {
     if (feature.mFeature) {
       feature.mFeature->ShutdownPreferences();
       feature.mFeature = nullptr;
     }
   }
 }
 
+/* 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();
 
   for (const NoChannelFeature& feature : sNoChannelFeaturesMap) {
     if (feature.mPref() && aName.Equals(feature.mName)) {
       MOZ_ASSERT(feature.mFeature);
       nsCOMPtr<nsIUrlClassifierFeature> self = feature.mFeature.get();
--- a/netwerk/url-classifier/UrlClassifierFeatureNoChannel.h
+++ b/netwerk/url-classifier/UrlClassifierFeatureNoChannel.h
@@ -15,16 +15,19 @@ namespace net {
 class UrlClassifierFeatureNoChannel final : public UrlClassifierFeatureBase {
  public:
   struct NoChannelFeature;
 
   static void GetFeatureNames(nsTArray<nsCString>& aNames);
 
   static void MaybeShutdown();
 
+  static void MaybeCreate(
+      nsTArray<RefPtr<nsIUrlClassifierFeature>>& aFeatures);
+
   static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
       const nsACString& aName);
 
   NS_IMETHOD
   ProcessChannel(nsIChannel* aChannel, const nsACString& aList,
                  bool* aShouldContinue) override;
 
   NS_IMETHOD GetURIByListType(nsIChannel* aChannel,