Bug 882467 - Mixed Content Telemetry - How many times do users click Disable Protection r=dolske
authorDavid Dahl <ddahl@mozilla.com>
Thu, 05 Sep 2013 18:18:04 -0500
changeset 158701 cd2e84ff64ddd150c428ba07e1e085ceede7ed65
parent 158700 cca8f2b78300e3d736ac7a1a2f1bb52decb5a577
child 158702 e7bd5af466abd029d9af297136bc4684b7c1f60d
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs882467
milestone26.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 882467 - Mixed Content Telemetry - How many times do users click Disable Protection r=dolske
browser/base/content/browser.js
content/base/src/nsDocument.cpp
toolkit/components/telemetry/Histograms.json
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6601,16 +6601,21 @@ var gIdentityHandler = {
       accessKey: gNavigatorBundle.getString("mixedContentBlocked.keepBlockingButton.accesskey"),
       callback: function() { /* NOP */ }
     };
     let secondaryActions = [
       {
         label: gNavigatorBundle.getString("mixedContentBlocked.unblock.label"),
         accessKey: gNavigatorBundle.getString("mixedContentBlocked.unblock.accesskey"),
         callback: function() {
+          // Use telemetry to measure how often unblocking happens
+          const kMIXED_CONTENT_UNBLOCK_EVENT = 2;
+          let histogram =
+            Services.telemetry.getHistogramById("MIXED_CONTENT_UNBLOCK_COUNTER");
+          histogram.add(kMIXED_CONTENT_UNBLOCK_EVENT);
           // Reload the page with the content unblocked
           BrowserReloadWithFlags(nsIWebNavigation.LOAD_FLAGS_ALLOW_MIXED_CONTENT);
         }
       }
     ];
     let options = {
       dismissed: true,
     };
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -1426,16 +1426,19 @@ nsDocument::~nsDocument()
     nsCOMPtr<nsIURI> uri;
     principal->GetURI(getter_AddRefs(uri));
     bool isAboutScheme = true;
     if (uri) {
       uri->SchemeIs("about", &isAboutScheme);
     }
 
     if (!isAboutScheme) {
+      // Record the page load
+      uint32_t pageLoaded = 1;
+      Accumulate(Telemetry::MIXED_CONTENT_UNBLOCK_COUNTER, pageLoaded);
       // Record the mixed content status of the docshell in Telemetry
       enum {
         NO_MIXED_CONTENT = 0, // There is no Mixed Content on the page
         MIXED_DISPLAY_CONTENT = 1, // The page attempted to load Mixed Display Content
         MIXED_ACTIVE_CONTENT = 2, // The page attempted to load Mixed Active Content
         MIXED_DISPLAY_AND_ACTIVE_CONTENT = 3 // The page attempted to load Mixed Display & Mixed Active Content
       };
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3888,16 +3888,21 @@
     "kind": "boolean",
     "description": "The result of the startup default desktop browser check."
   },
   "MIXED_CONTENT_PAGE_LOAD": {
     "kind": "enumerated",
     "n_values": 4,
     "description": "Accumulates type of content (mixed, mixed passive, unmixed) per page load"
   },
+  "MIXED_CONTENT_UNBLOCK_COUNTER": {
+    "kind": "enumerated",
+    "n_values": 3,
+    "description": "A simple counter of daily mixed-content unblock operations and top documents loaded"
+  },
   "NTLM_MODULE_USED": {
     "kind": "enumerated",
     "n_values": 8,
     "description": "The module used for the NTLM protocol (Windows_API, Kerberos, Samba_auth or Generic) and whether or not the authentication was used to connect to a proxy server. This data is collected only once per session (at first NTLM authentification)."
   },
   "FX_THUMBNAILS_BG_QUEUE_SIZE_ON_CAPTURE": {
     "kind": "exponential",
     "high": 100,