Bug 1286118 - Add telemetry probe to measure changes to permissions after initial prompt. r=florian
MozReview-Commit-ID: 9Y4XaY71dhh
--- 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)"
}
}