Bug 1596988 - remove telemetry ping 'AUTOPLAY_SITES_SETTING_CHANGE'. r=Ehsan
authoralwu <alwu@mozilla.com>
Tue, 19 Nov 2019 14:39:16 +0000
changeset 502664 b468fa7a97ad57b9aa9241d88623ecad78ef8992
parent 502663 ad32f331d00a2c42544570e740e6e6687cd71cd1
child 502665 9b33becd0b685f8a4c795076fa6852dcfbdd1b6c
push id100968
push useralwu@mozilla.com
push dateTue, 19 Nov 2019 20:47:22 +0000
treeherderautoland@b468fa7a97ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1596988
milestone72.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 1596988 - remove telemetry ping 'AUTOPLAY_SITES_SETTING_CHANGE'. r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D53752
extensions/permissions/nsPermissionManager.cpp
toolkit/components/telemetry/Histograms.json
--- a/extensions/permissions/nsPermissionManager.cpp
+++ b/extensions/permissions/nsPermissionManager.cpp
@@ -730,70 +730,16 @@ static bool IsPersistentExpire(uint32_t 
 #ifdef ANDROID
   for (const auto& perm : kGeckoViewRestrictedPermissions) {
     res = res && !perm.Equals(aType);
   }
 #endif
   return res;
 }
 
-static void UpdateAutoplayTelemetry(const nsACString& aType,
-                                    uint32_t aOldPermission,
-                                    uint32_t aNewPermission,
-                                    uint32_t aExpireType) {
-  if (!aType.EqualsLiteral("autoplay-media")) {
-    return;
-  }
-
-  if (aExpireType != nsIPermissionManager::EXPIRE_NEVER) {
-    return;
-  }
-
-  // Add permission
-  if (aOldPermission == nsIPermissionManager::UNKNOWN_ACTION) {
-    if (aNewPermission == nsIPermissionManager::ALLOW_ACTION) {
-      AccumulateCategorical(
-          mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::AddAllow);
-    } else if (aNewPermission == nsIPermissionManager::DENY_ACTION) {
-      AccumulateCategorical(
-          mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::AddBlock);
-    }
-    return;
-  }
-
-  // Remove permission
-  if (aNewPermission == nsIPermissionManager::UNKNOWN_ACTION) {
-    if (aOldPermission == nsIPermissionManager::ALLOW_ACTION) {
-      AccumulateCategorical(
-          mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::
-              RemoveAllow);
-    } else if (aOldPermission == nsIPermissionManager::DENY_ACTION) {
-      AccumulateCategorical(
-          mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::
-              RemoveBlock);
-    }
-    return;
-  }
-
-  // Change permission
-  if (aNewPermission == nsIPermissionManager::ALLOW_ACTION &&
-      aOldPermission == nsIPermissionManager::DENY_ACTION) {
-    AccumulateCategorical(
-        mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::AddAllow);
-    AccumulateCategorical(
-        mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::RemoveBlock);
-  } else if (aNewPermission == nsIPermissionManager::DENY_ACTION &&
-             aOldPermission == nsIPermissionManager::ALLOW_ACTION) {
-    AccumulateCategorical(
-        mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::AddBlock);
-    AccumulateCategorical(
-        mozilla::Telemetry::LABELS_AUTOPLAY_SITES_SETTING_CHANGE::RemoveAllow);
-  }
-}
-
 }  // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
 
 nsPermissionManager::PermissionKey*
 nsPermissionManager::PermissionKey::CreateFromPrincipal(
     nsIPrincipal* aPrincipal, nsresult& aResult) {
   nsAutoCString origin;
@@ -1842,18 +1788,16 @@ nsresult nsPermissionManager::AddInterna
 
   switch (op) {
     case eOperationNone: {
       // nothing to do
       return NS_OK;
     }
 
     case eOperationAdding: {
-      UpdateAutoplayTelemetry(aType, nsIPermissionManager::UNKNOWN_ACTION,
-                              aPermission, aExpireType);
       if (aDBOperation == eWriteToDB) {
         // we'll be writing to the database - generate a known unique id
         id = ++mLargestID;
       } else {
         // we're reading from the database - use the id already assigned
         id = aID;
       }
 
@@ -1888,19 +1832,16 @@ nsresult nsPermissionManager::AddInterna
 
       // If the type we want to remove is EXPIRE_POLICY, we need to reject
       // attempts to change the permission.
       if (entry->GetPermissions()[index].mExpireType == EXPIRE_POLICY) {
         NS_WARNING("Attempting to remove EXPIRE_POLICY permission");
         break;
       }
 
-      UpdateAutoplayTelemetry(aType, oldPermissionEntry.mPermission,
-                              nsIPermissionManager::UNKNOWN_ACTION,
-                              aExpireType);
       entry->GetPermissions().RemoveElementAt(index);
 
       // Record a count of the number of preload permissions present in the
       // content process.
       if (IsPreloadPermission(mTypeArray[typeIndex])) {
         sPreloadPermissionCount--;
       }
 
@@ -1930,19 +1871,16 @@ nsresult nsPermissionManager::AddInterna
 
       // If the existing type is EXPIRE_POLICY, we need to reject attempts to
       // change the permission.
       if (entry->GetPermissions()[index].mExpireType == EXPIRE_POLICY) {
         NS_WARNING("Attempting to modify EXPIRE_POLICY permission");
         break;
       }
 
-      UpdateAutoplayTelemetry(aType, entry->GetPermissions()[index].mPermission,
-                              aPermission, aExpireType);
-
       // If the new expireType is EXPIRE_SESSION, then we have to keep a
       // copy of the previous permission/expireType values. This cached value
       // will be used when restoring the permissions of an app.
       if (entry->GetPermissions()[index].mExpireType !=
               nsIPermissionManager::EXPIRE_SESSION &&
           aExpireType == nsIPermissionManager::EXPIRE_SESSION) {
         entry->GetPermissions()[index].mNonSessionPermission =
             entry->GetPermissions()[index].mPermission;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -14716,30 +14716,16 @@
     ],
     "expires_in_version": "70",
     "kind": "categorical",
     "labels": ["NeverBlocked", "AllowedAfterBlocked", "NeverAllowed"],
     "bug_numbers": [1512277],
     "description": "The number of times an AudioContext is allowed to start after being blocked, or the number of AudioContexts attempting to start which were never blocked or never allowed.",
     "releaseChannelCollection": "opt-out"
   },
-  "AUTOPLAY_SITES_SETTING_CHANGE": {
-    "record_in_processes": ["main", "content"],
-    "products": ["firefox", "fennec", "geckoview"],
-    "alert_emails": [
-      "alwu@mozilla.com",
-      "cpearce@mozilla.com"
-    ],
-    "expires_in_version": "71",
-    "kind": "categorical",
-    "labels": ["AddAllow", "RemoveAllow", "AddBlock", "RemoveBlock"],
-    "bug_numbers": [1520361],
-    "description": "The number of times the user adds a site to the allow list, removes a site from the allow list, adds a site to the block list and removes a site from the block list.",
-    "releaseChannelCollection": "opt-out"
-  },
   "MEDIA_PLAYED_TIME_AFTER_AUTOPLAY_BLOCKED": {
     "record_in_processes": ["main", "content"],
     "products": ["firefox", "fennec", "geckoview"],
     "alert_emails": [
       "alwu@mozilla.com",
       "cpearce@mozilla.com",
       "nohlmeier@mozilla.com"
     ],