Bug 774395 Measure prevalence of SSL MITM errors for updates (r=bbondy a=lsblakk)
authorDevdatta Akhawe <dev.akhawe@gmail.com>
Sat, 08 Sep 2012 09:23:42 -0700
changeset 106846 bd535573e3842c436877824ac93ca71642731611
parent 106845 d648d93f9d76e8567a0c1e3025637ff245cec3bd
child 106847 3e04584e30f7cccbc8df0d758c386c277f256e47
push id2083
push userimelven@mozilla.com
push dateThu, 13 Sep 2012 20:42:28 +0000
treeherdermozilla-aurora@bd535573e384 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy, lsblakk
bugs774395
milestone17.0a2
Bug 774395 Measure prevalence of SSL MITM errors for updates (r=bbondy a=lsblakk)
security/manager/boot/public/nsISecurityUITelemetry.idl
toolkit/mozapps/update/content/updates.js
--- a/security/manager/boot/public/nsISecurityUITelemetry.idl
+++ b/security/manager/boot/public/nsISecurityUITelemetry.idl
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-[scriptable, uuid(f277021f-8508-456e-b2b2-784c6faa0011)]
+[scriptable, uuid(39823a45-dd9e-4f8b-9b0a-0ad144eb0db6)]
 
 interface nsISecurityUITelemetry : nsISupports {
 
 /*
  * Addon installation warnings
  */
 
 // Firefox prevented this site from asking you to install addon
@@ -89,9 +89,17 @@ const uint32_t WARNING_BAD_CERT_CONFIRM_
 
 const uint32_t WARNING_GEOLOCATION_REQUEST = 46;
 const uint32_t WARNING_GEOLOCATION_REQUEST_SHARE_LOCATION = 47;
 const uint32_t WARNING_GEOLOCATION_REQUEST_ALWAYS_SHARE = 48;
 const uint32_t WARNING_GEOLOCATION_REQUEST_NEVER_SHARE = 49;
 // It would be nice to measure the two cases of user clicking
 // "not now", and user closing the popup. This is currently not implemented.
 
+/*
+ * Firefox Update Errors: UI is only thrown after 
+ * repeated errors. We only measure when the UI is shown.
+ */
+const uint32_t WARNING_INSECURE_UPDATE = 50;
+const uint32_t WARNING_NO_SECURE_UPDATE = 51;
+
+
 };
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -1665,29 +1665,35 @@ var gErrorsPage = {
  */
 var gErrorExtraPage = {
   /**
    * Initialize
    */
   onPageShow: function() {
     gUpdates.setButtons(null, null, "okButton", true);
     gUpdates.wiz.getButton("finish").focus();
+    let secHistogram = CoC["@mozilla.org/base/telemetry;1"].
+                                  getService(CoI.nsITelemetry).
+                                  getHistogramById("SECURITY_UI");
 
     if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_CERT_ERRORS))
       Services.prefs.clearUserPref(PREF_APP_UPDATE_CERT_ERRORS);
 
     if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS))
       Services.prefs.clearUserPref(PREF_APP_UPDATE_BACKGROUNDERRORS);
 
     if (gUpdates.update.errorCode == CERT_ATTR_CHECK_FAILED_HAS_UPDATE) {
       document.getElementById("errorCertAttrHasUpdateLabel").hidden = false;
+      secHistogram.add(CoI.nsISecurityUITelemetry.WARNING_INSECURE_UPDATE);
     }
     else {
-      if (gUpdates.update.errorCode == CERT_ATTR_CHECK_FAILED_NO_UPDATE)
+      if (gUpdates.update.errorCode == CERT_ATTR_CHECK_FAILED_NO_UPDATE){
         document.getElementById("errorCertCheckNoUpdateLabel").hidden = false;
+        secHistogram.add(CoI.nsISecurityUITelemetry.WARNING_NO_SECURE_UPDATE);
+      }
       else
         document.getElementById("genericBackgroundErrorLabel").hidden = false;
       var manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_MANUAL_URL);
       var errorLinkLabel = document.getElementById("errorExtraLinkLabel");
       errorLinkLabel.value = manualURL;
       errorLinkLabel.setAttribute("url", manualURL);
       errorLinkLabel.hidden = false;
     }