Bug 1564248 - Re-add contentblocking.exceptions and extend the measurement to 75. r=Ehsan a=lizzard
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 26 Sep 2019 08:09:17 +0000
changeset 555390 5b82d3ffac78eb7c57c566e95d75386269617ff0
parent 555389 3aaaeea6dd03afc04cc06274e5d8cd6065c7c147
child 555391 6601e4d9a9807d67f057dff8abc737b8cb05cd24
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan, lizzard
bugs1564248
milestone70.0
Bug 1564248 - Re-add contentblocking.exceptions and extend the measurement to 75. r=Ehsan a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D47073
browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
browser/components/BrowserGlue.jsm
toolkit/components/telemetry/Scalars.yaml
--- a/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_telemetry.js
@@ -36,16 +36,20 @@ add_task(async function setup() {
   let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
   ok(TrackingProtection, "TP is attached to the browser window");
   ok(!TrackingProtection.enabled, "TP is not enabled");
 
   let enabledCounts = Services.telemetry
     .getHistogramById("TRACKING_PROTECTION_ENABLED")
     .snapshot().values;
   is(enabledCounts[0], 1, "TP was not enabled on start up");
+
+  let scalars = Services.telemetry.getSnapshotForScalars("main", false).parent;
+
+  is(scalars["contentblocking.exceptions"], 0, "no CB exceptions at startup");
 });
 
 add_task(async function testShieldHistogram() {
   Services.prefs.setBoolPref(PREF, true);
   let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser);
 
   // Reset these to make counting easier
   getShieldHistogram().clear();
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -1753,16 +1753,24 @@ BrowserGlue.prototype = {
       .getHistogramById("TRACKING_PROTECTION_PBM_DISABLED")
       .add(!tpPBDisabled);
 
     let cookieBehavior = Services.prefs.getIntPref(
       "network.cookie.cookieBehavior"
     );
     Services.telemetry.getHistogramById("COOKIE_BEHAVIOR").add(cookieBehavior);
 
+    let exceptions = 0;
+    for (let permission of Services.perms.enumerator) {
+      if (permission.type == "trackingprotection") {
+        exceptions++;
+      }
+    }
+    Services.telemetry.scalarSet("contentblocking.exceptions", exceptions);
+
     let fpEnabled = Services.prefs.getBoolPref(
       "privacy.trackingprotection.fingerprinting.enabled"
     );
     let cmEnabled = Services.prefs.getBoolPref(
       "privacy.trackingprotection.cryptomining.enabled"
     );
     let categoryPref;
     switch (
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -621,16 +621,33 @@ pwmgr:
       - passwords-dev@mozilla.org
     release_channel_collection: opt-out
     products:
       - 'firefox'
     record_in_processes:
       - main
 
 contentblocking:
+  exceptions:
+    bug_numbers:
+      - 1484251
+      - 1564248
+    description: >
+      How many tracking protection/content blocking exceptions a user has at startup.
+    expires: "75"
+    kind: uint
+    notification_emails:
+      - jhofmann@mozilla.com
+      - chsiang@mozilla.com
+      - seceng-telemetry@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - main
+    products:
+      - 'firefox'
   cryptomining_blocking_enabled:
     bug_numbers:
       - 1522919
     description: >
       True if cryptominer blocking is enabled globally at startup.
     expires: never
     kind: boolean
     notification_emails: