Bug 1532734 - Rename Fingerprinting to FingerprintingProtection, r=dimi
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 05 Mar 2019 19:10:43 +0000
changeset 520379 97e21604ea3668584c23e025e09961009c49406a
parent 520378 cb4c115a9f5914abf07a620880c197864ef8001f
child 520380 31694cc74f7d2aaf3178ffa5ccb29b58486d89a1
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdimi
bugs1532734
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 1532734 - Rename Fingerprinting to FingerprintingProtection, r=dimi Differential Revision: https://phabricator.services.mozilla.com/D22144
netwerk/url-classifier/UrlClassifierFeatureFactory.cpp
netwerk/url-classifier/UrlClassifierFeatureFingerprinting.cpp
netwerk/url-classifier/UrlClassifierFeatureFingerprinting.h
netwerk/url-classifier/UrlClassifierFeatureFingerprintingProtection.cpp
netwerk/url-classifier/UrlClassifierFeatureFingerprintingProtection.h
netwerk/url-classifier/moz.build
--- a/netwerk/url-classifier/UrlClassifierFeatureFactory.cpp
+++ b/netwerk/url-classifier/UrlClassifierFeatureFactory.cpp
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/net/UrlClassifierFeatureFactory.h"
 
 // List of Features
 #include "UrlClassifierFeatureCryptomining.h"
-#include "UrlClassifierFeatureFingerprinting.h"
+#include "UrlClassifierFeatureFingerprintingProtection.h"
 #include "UrlClassifierFeatureFlash.h"
 #include "UrlClassifierFeatureLoginReputation.h"
 #include "UrlClassifierFeaturePhishingProtection.h"
 #include "UrlClassifierFeatureTrackingProtection.h"
 #include "UrlClassifierFeatureTrackingAnnotation.h"
 #include "UrlClassifierFeatureCustomTables.h"
 
 #include "nsAppRunner.h"
@@ -24,17 +24,17 @@ namespace net {
 /* static */
 void UrlClassifierFeatureFactory::Shutdown() {
   // We want to expose Features only in the parent process.
   if (!XRE_IsParentProcess()) {
     return;
   }
 
   UrlClassifierFeatureCryptomining::MaybeShutdown();
-  UrlClassifierFeatureFingerprinting::MaybeShutdown();
+  UrlClassifierFeatureFingerprintingProtection::MaybeShutdown();
   UrlClassifierFeatureFlash::MaybeShutdown();
   UrlClassifierFeatureLoginReputation::MaybeShutdown();
   UrlClassifierFeaturePhishingProtection::MaybeShutdown();
   UrlClassifierFeatureTrackingAnnotation::MaybeShutdown();
   UrlClassifierFeatureTrackingProtection::MaybeShutdown();
 }
 
 /* static */
@@ -52,18 +52,18 @@ void UrlClassifierFeatureFactory::GetFea
   // feature ordering.
 
   // Cryptomining
   feature = UrlClassifierFeatureCryptomining::MaybeCreate(aChannel);
   if (feature) {
     aFeatures.AppendElement(feature);
   }
 
-  // Fingerprinting
-  feature = UrlClassifierFeatureFingerprinting::MaybeCreate(aChannel);
+  // Fingerprinting Protection
+  feature = UrlClassifierFeatureFingerprintingProtection::MaybeCreate(aChannel);
   if (feature) {
     aFeatures.AppendElement(feature);
   }
 
   // Tracking Protection
   feature = UrlClassifierFeatureTrackingProtection::MaybeCreate(aChannel);
   if (feature) {
     aFeatures.AppendElement(feature);
@@ -103,18 +103,19 @@ UrlClassifierFeatureFactory::GetFeatureB
   nsCOMPtr<nsIUrlClassifierFeature> feature;
 
   // Cryptomining
   feature = UrlClassifierFeatureCryptomining::GetIfNameMatches(aName);
   if (feature) {
     return feature.forget();
   }
 
-  // Fingerprinting
-  feature = UrlClassifierFeatureFingerprinting::GetIfNameMatches(aName);
+  // Fingerprinting Protection
+  feature =
+      UrlClassifierFeatureFingerprintingProtection::GetIfNameMatches(aName);
   if (feature) {
     return feature.forget();
   }
 
   // Tracking Protection
   feature = UrlClassifierFeatureTrackingProtection::GetIfNameMatches(aName);
   if (feature) {
     return feature.forget();
@@ -155,18 +156,18 @@ void UrlClassifierFeatureFactory::GetFea
 
   // Cryptomining
   nsAutoCString name;
   name.Assign(UrlClassifierFeatureCryptomining::Name());
   if (!name.IsEmpty()) {
     aArray.AppendElement(name);
   }
 
-  // Fingerprinting
-  name.Assign(UrlClassifierFeatureFingerprinting::Name());
+  // Fingerprinting Protection
+  name.Assign(UrlClassifierFeatureFingerprintingProtection::Name());
   if (!name.IsEmpty()) {
     aArray.AppendElement(name);
   }
 
   // Tracking Protection
   name.Assign(UrlClassifierFeatureTrackingProtection::Name());
   if (!name.IsEmpty()) {
     aArray.AppendElement(name);
rename from netwerk/url-classifier/UrlClassifierFeatureFingerprinting.cpp
rename to netwerk/url-classifier/UrlClassifierFeatureFingerprintingProtection.cpp
--- a/netwerk/url-classifier/UrlClassifierFeatureFingerprinting.cpp
+++ b/netwerk/url-classifier/UrlClassifierFeatureFingerprintingProtection.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "UrlClassifierFeatureFingerprinting.h"
+#include "UrlClassifierFeatureFingerprintingProtection.h"
 
 #include "mozilla/AntiTrackingCommon.h"
 #include "mozilla/net/UrlClassifierCommon.h"
 #include "mozilla/StaticPrefs.h"
 #include "nsContentUtils.h"
 #include "nsNetUtil.h"
 
 namespace mozilla {
@@ -25,64 +25,70 @@ namespace {
   "urlclassifier.features.fingerprinting.blacklistHosts"
 #define URLCLASSIFIER_FINGERPRINTING_WHITELIST \
   "urlclassifier.features.fingerprinting.whitelistTables"
 #define URLCLASSIFIER_FINGERPRINTING_WHITELIST_TEST_ENTRIES \
   "urlclassifier.features.fingerprinting.whitelistHosts"
 #define TABLE_FINGERPRINTING_BLACKLIST_PREF "fingerprinting-blacklist-pref"
 #define TABLE_FINGERPRINTING_WHITELIST_PREF "fingerprinting-whitelist-pref"
 
-StaticRefPtr<UrlClassifierFeatureFingerprinting> gFeatureFingerprinting;
+StaticRefPtr<UrlClassifierFeatureFingerprintingProtection>
+    gFeatureFingerprintingProtection;
 
 }  // namespace
 
-UrlClassifierFeatureFingerprinting::UrlClassifierFeatureFingerprinting()
+UrlClassifierFeatureFingerprintingProtection::
+    UrlClassifierFeatureFingerprintingProtection()
     : UrlClassifierFeatureBase(
           NS_LITERAL_CSTRING(FINGERPRINTING_FEATURE_NAME),
           NS_LITERAL_CSTRING(URLCLASSIFIER_FINGERPRINTING_BLACKLIST),
           NS_LITERAL_CSTRING(URLCLASSIFIER_FINGERPRINTING_WHITELIST),
           NS_LITERAL_CSTRING(
               URLCLASSIFIER_FINGERPRINTING_BLACKLIST_TEST_ENTRIES),
           NS_LITERAL_CSTRING(
               URLCLASSIFIER_FINGERPRINTING_WHITELIST_TEST_ENTRIES),
           NS_LITERAL_CSTRING(TABLE_FINGERPRINTING_BLACKLIST_PREF),
           NS_LITERAL_CSTRING(TABLE_FINGERPRINTING_WHITELIST_PREF),
           EmptyCString()) {}
 
-/* static */ const char* UrlClassifierFeatureFingerprinting::Name() {
+/* static */ const char* UrlClassifierFeatureFingerprintingProtection::Name() {
   return FINGERPRINTING_FEATURE_NAME;
 }
 
 /* static */
-void UrlClassifierFeatureFingerprinting::MaybeInitialize() {
-  UC_LOG(("UrlClassifierFeatureFingerprinting: MaybeInitialize"));
+void UrlClassifierFeatureFingerprintingProtection::MaybeInitialize() {
+  UC_LOG(("UrlClassifierFeatureFingerprintingProtection: MaybeInitialize"));
 
-  if (!gFeatureFingerprinting) {
-    gFeatureFingerprinting = new UrlClassifierFeatureFingerprinting();
-    gFeatureFingerprinting->InitializePreferences();
+  if (!gFeatureFingerprintingProtection) {
+    gFeatureFingerprintingProtection =
+        new UrlClassifierFeatureFingerprintingProtection();
+    gFeatureFingerprintingProtection->InitializePreferences();
   }
 }
 
 /* static */
-void UrlClassifierFeatureFingerprinting::MaybeShutdown() {
-  UC_LOG(("UrlClassifierFeatureFingerprinting: MaybeShutdown"));
+void UrlClassifierFeatureFingerprintingProtection::MaybeShutdown() {
+  UC_LOG(("UrlClassifierFeatureFingerprintingProtection: MaybeShutdown"));
 
-  if (gFeatureFingerprinting) {
-    gFeatureFingerprinting->ShutdownPreferences();
-    gFeatureFingerprinting = nullptr;
+  if (gFeatureFingerprintingProtection) {
+    gFeatureFingerprintingProtection->ShutdownPreferences();
+    gFeatureFingerprintingProtection = nullptr;
   }
 }
 
 /* static */
-already_AddRefed<UrlClassifierFeatureFingerprinting>
-UrlClassifierFeatureFingerprinting::MaybeCreate(nsIChannel* aChannel) {
+already_AddRefed<UrlClassifierFeatureFingerprintingProtection>
+UrlClassifierFeatureFingerprintingProtection::MaybeCreate(
+    nsIChannel* aChannel) {
   MOZ_ASSERT(aChannel);
 
-  UC_LOG(("UrlClassifierFeatureFingerprinting: MaybeCreate for channel %p",
-          aChannel));
+  UC_LOG(
+      ("UrlClassifierFeatureFingerprintingProtection: MaybeCreate for channel "
+       "%p",
+       aChannel));
 
   if (!StaticPrefs::privacy_trackingprotection_fingerprinting_enabled()) {
     return nullptr;
   }
 
   nsCOMPtr<nsIURI> chanURI;
   nsresult rv = aChannel->GetURI(getter_AddRefs(chanURI));
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -92,54 +98,57 @@ UrlClassifierFeatureFingerprinting::Mayb
   bool isThirdParty =
       nsContentUtils::IsThirdPartyWindowOrChannel(nullptr, aChannel, chanURI);
   if (!isThirdParty) {
     if (UC_LOG_ENABLED()) {
       nsCString spec = chanURI->GetSpecOrDefault();
       spec.Truncate(
           std::min(spec.Length(), UrlClassifierCommon::sMaxSpecLength));
       UC_LOG(
-          ("UrlClassifierFeatureFingerprinting: Skipping fingerprinting checks "
+          ("UrlClassifierFeatureFingerprintingProtection: Skipping "
+           "fingerprinting checks "
            "for first party or top-level load channel[%p] "
            "with uri %s",
            aChannel, spec.get()));
     }
 
     return nullptr;
   }
 
   if (!UrlClassifierCommon::ShouldEnableClassifier(aChannel)) {
     return nullptr;
   }
 
   MaybeInitialize();
-  MOZ_ASSERT(gFeatureFingerprinting);
+  MOZ_ASSERT(gFeatureFingerprintingProtection);
 
-  RefPtr<UrlClassifierFeatureFingerprinting> self = gFeatureFingerprinting;
+  RefPtr<UrlClassifierFeatureFingerprintingProtection> self =
+      gFeatureFingerprintingProtection;
   return self.forget();
 }
 
 /* static */
 already_AddRefed<nsIUrlClassifierFeature>
-UrlClassifierFeatureFingerprinting::GetIfNameMatches(const nsACString& aName) {
+UrlClassifierFeatureFingerprintingProtection::GetIfNameMatches(
+    const nsACString& aName) {
   if (!aName.EqualsLiteral(FINGERPRINTING_FEATURE_NAME)) {
     return nullptr;
   }
 
   MaybeInitialize();
-  MOZ_ASSERT(gFeatureFingerprinting);
+  MOZ_ASSERT(gFeatureFingerprintingProtection);
 
-  RefPtr<UrlClassifierFeatureFingerprinting> self = gFeatureFingerprinting;
+  RefPtr<UrlClassifierFeatureFingerprintingProtection> self =
+      gFeatureFingerprintingProtection;
   return self.forget();
 }
 
 NS_IMETHODIMP
-UrlClassifierFeatureFingerprinting::ProcessChannel(nsIChannel* aChannel,
-                                                   const nsACString& aList,
-                                                   bool* aShouldContinue) {
+UrlClassifierFeatureFingerprintingProtection::ProcessChannel(
+    nsIChannel* aChannel, const nsACString& aList, bool* aShouldContinue) {
   NS_ENSURE_ARG_POINTER(aChannel);
   NS_ENSURE_ARG_POINTER(aShouldContinue);
 
   bool isAllowListed =
       IsAllowListed(aChannel, AntiTrackingCommon::eFingerprinting);
 
   // This is a blocking feature.
   *aShouldContinue = isAllowListed;
@@ -153,34 +162,35 @@ UrlClassifierFeatureFingerprinting::Proc
     UrlClassifierCommon::NotifyChannelClassifierProtectionDisabled(
         aChannel, nsIWebProgressListener::STATE_LOADED_FINGERPRINTING_CONTENT);
   } else {
     UrlClassifierCommon::SetBlockedContent(aChannel,
                                            NS_ERROR_FINGERPRINTING_URI, aList,
                                            EmptyCString(), EmptyCString());
 
     UC_LOG(
-        ("UrlClassifierFeatureFingerprinting::ProcessChannel, cancelling "
+        ("UrlClassifierFeatureFingerprintingProtection::ProcessChannel, "
+         "cancelling "
          "channel[%p]",
          aChannel));
     nsCOMPtr<nsIHttpChannelInternal> httpChannel = do_QueryInterface(aChannel);
 
     if (httpChannel) {
       Unused << httpChannel->CancelByChannelClassifier(
           NS_ERROR_FINGERPRINTING_URI);
     } else {
       Unused << aChannel->Cancel(NS_ERROR_FINGERPRINTING_URI);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-UrlClassifierFeatureFingerprinting::GetURIByListType(
+UrlClassifierFeatureFingerprintingProtection::GetURIByListType(
     nsIChannel* aChannel, nsIUrlClassifierFeature::listType aListType,
     nsIURI** aURI) {
   NS_ENSURE_ARG_POINTER(aChannel);
   NS_ENSURE_ARG_POINTER(aURI);
 
   if (aListType == nsIUrlClassifierFeature::blacklist) {
     return aChannel->GetURI(aURI);
   }
rename from netwerk/url-classifier/UrlClassifierFeatureFingerprinting.h
rename to netwerk/url-classifier/UrlClassifierFeatureFingerprintingProtection.h
--- a/netwerk/url-classifier/UrlClassifierFeatureFingerprinting.h
+++ b/netwerk/url-classifier/UrlClassifierFeatureFingerprintingProtection.h
@@ -1,46 +1,46 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef mozilla_net_UrlClassifierFeatureFingerprinting_h
-#define mozilla_net_UrlClassifierFeatureFingerprinting_h
+#ifndef mozilla_net_UrlClassifierFeatureFingerprintingProtection_h
+#define mozilla_net_UrlClassifierFeatureFingerprintingProtection_h
 
 #include "UrlClassifierFeatureBase.h"
 
 class nsIChannel;
 
 namespace mozilla {
 namespace net {
 
-class UrlClassifierFeatureFingerprinting final
+class UrlClassifierFeatureFingerprintingProtection final
     : public UrlClassifierFeatureBase {
  public:
   static const char* Name();
 
   static void MaybeShutdown();
 
-  static already_AddRefed<UrlClassifierFeatureFingerprinting> MaybeCreate(
-      nsIChannel* aChannel);
+  static already_AddRefed<UrlClassifierFeatureFingerprintingProtection>
+  MaybeCreate(nsIChannel* aChannel);
 
   static already_AddRefed<nsIUrlClassifierFeature> GetIfNameMatches(
       const nsACString& aName);
 
   NS_IMETHOD ProcessChannel(nsIChannel* aChannel, const nsACString& aList,
                             bool* aShouldContinue) override;
 
   NS_IMETHOD GetURIByListType(nsIChannel* aChannel,
                               nsIUrlClassifierFeature::listType aListType,
                               nsIURI** aURI) override;
 
  private:
-  UrlClassifierFeatureFingerprinting();
+  UrlClassifierFeatureFingerprintingProtection();
 
   static void MaybeInitialize();
 };
 
 }  // namespace net
 }  // namespace mozilla
 
-#endif  // mozilla_net_UrlClassifierFeatureFingerprinting_h
+#endif  // mozilla_net_UrlClassifierFeatureFingerprintingProtection_h
--- a/netwerk/url-classifier/moz.build
+++ b/netwerk/url-classifier/moz.build
@@ -20,17 +20,17 @@ DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITI
 UNIFIED_SOURCES += [
     'AsyncUrlChannelClassifier.cpp',
     'nsChannelClassifier.cpp',
     'UrlClassifierCommon.cpp',
     'UrlClassifierFeatureBase.cpp',
     'UrlClassifierFeatureCryptomining.cpp',
     'UrlClassifierFeatureCustomTables.cpp',
     'UrlClassifierFeatureFactory.cpp',
-    'UrlClassifierFeatureFingerprinting.cpp',
+    'UrlClassifierFeatureFingerprintingProtection.cpp',
     'UrlClassifierFeatureFlash.cpp',
     'UrlClassifierFeatureLoginReputation.cpp',
     'UrlClassifierFeaturePhishingProtection.cpp',
     'UrlClassifierFeatureResult.cpp',
     'UrlClassifierFeatureTrackingAnnotation.cpp',
     'UrlClassifierFeatureTrackingProtection.cpp',
 ]