Bug 1286118 - Add telemetry probe to measure changes to permissions after initial prompt. r=florian
authorJohann Hofmann <jhofmann@mozilla.com>
Wed, 20 Jul 2016 12:20:43 +0200
changeset 312710 9431390a4d875eb815e4a72b523b1ea5cce382a9
parent 312650 dbe4b47941c7b3d6298a0ead5e40dd828096c808
child 312711 7a5d8ff573bc76752e92d7e8a8016be90c8bc8fd
push id30654
push userphilringnalda@gmail.com
push dateMon, 05 Sep 2016 20:06:41 +0000
treeherdermozilla-central@abb69c6bc4d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1286118
milestone51.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 1286118 - Add telemetry probe to measure changes to permissions after initial prompt. r=florian MozReview-Commit-ID: 9Y4XaY71dhh
browser/base/content/browser.js
toolkit/components/telemetry/Histograms.json
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -7406,16 +7406,35 @@ var gIdentityHandler = {
           }
         }
         let mm = gBrowser.selectedBrowser.messageManager;
         mm.sendAsyncMessage("webrtc:StopSharing", windowId);
       }
       SitePermissions.remove(gBrowser.currentURI, aPermission.id);
       this._permissionJustRemoved = true;
       this.updatePermissionHint();
+
+      // Set telemetry values for clearing a permission
+      let histogram = Services.telemetry.getKeyedHistogramById("WEB_PERMISSION_CLEARED");
+
+      let permissionType = 0;
+      if (aPermission.state == SitePermissions.ALLOW) {
+        // 1 : clear permanently allowed permission
+        permissionType = 1;
+      } else if (aPermission.state == SitePermissions.BLOCK) {
+        // 2 : clear permanently blocked permission
+        permissionType = 2;
+      }
+      // 3 : TODO clear temporary allowed permission
+      // 4 : TODO clear temporary blocked permission
+
+      if (permissionType) {
+        histogram.add("(all)", permissionType);
+        histogram.add(aPermission.id, permissionType);
+      }
     });
 
     container.appendChild(img);
     container.appendChild(nameLabel);
     container.appendChild(stateLabel);
     container.appendChild(button);
 
     return container;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -10198,10 +10198,19 @@
     "cpp_guard": "ANDROID"
   },
   "NUMBER_OF_PROFILES": {
     "alert_emails": ["amarchesini@mozilla.com"],
     "expires_in_version": "58",
     "bug_numbers": [1296606],
     "kind": "count",
     "description": "Number of named profiles."
+  },
+  "WEB_PERMISSION_CLEARED": {
+    "alert_emails": ["firefox-dev@mozilla.org"],
+    "bug_numbers": [1286118],
+    "expires_in_version": "55",
+    "kind": "enumerated",
+    "keyed": true,
+    "n_values": 6,
+    "description": "Number of revoke actions on permissions in the control center, keyed by permission id. Values represent the permission type that was revoked. (0=unknown, 1=permanently allowed, 2=permanently blocked, 3=temporarily allowed, 4=temporarily blocked)"
   }
 }