Bug 1124472 - Add telemetry for the Saved Passwords dialog. r=dolske
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Sat, 28 Mar 2015 21:50:40 -0700
changeset 265245 671d6f9f0d85294fd1211f218c88e786a3cd9c7d
parent 265241 385840329d91d1b469111b1e0471d41e36e257be
child 265246 f9ea7af9d7a9f7f5e18e34daf1f180cd32245d3a
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs1124472
milestone39.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 1124472 - Add telemetry for the Saved Passwords dialog. r=dolske
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/content/passwordManagerCommon.js
toolkit/components/telemetry/Histograms.json
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -21,18 +21,22 @@ function SignonsStartup() {
   let treecols = document.getElementsByTagName("treecols")[0];
   treecols.addEventListener("click", HandleTreeColumnClick.bind(null, SignonColumnSort));
 
   LoadSignons();
 
   // filter the table if requested by caller
   if (window.arguments &&
       window.arguments[0] &&
-      window.arguments[0].filterString)
+      window.arguments[0].filterString) {
     setFilter(window.arguments[0].filterString);
+    Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(1);
+  } else {
+    Services.telemetry.getHistogramById("PWMGR_MANAGE_OPENED").add(0);
+  }
 
   FocusFilterBox();
 }
 
 function setFilter(aFilterString) {
   document.getElementById("filter").value = aFilterString;
   _filterPasswords();
 }
@@ -149,48 +153,51 @@ function DeleteAllSignons() {
                          null, null, null, null, dummy) == 1) // 1 == "No" button
     return;
 
   var syncNeeded = (signonsTreeView._filterSet.length != 0);
   DeleteAllFromTree(signonsTree, signonsTreeView,
                         signonsTreeView._filterSet.length ? signonsTreeView._filterSet : signons,
                         deletedSignons, "removeSignon", "removeAllSignons");
   FinalizeSignonDeletions(syncNeeded);
+  Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED_ALL").add(1);
 }
 
 function TogglePasswordVisible() {
   if (showingPasswords || masterPasswordLogin(AskUserShowPasswords)) {
     showingPasswords = !showingPasswords;
     document.getElementById("togglePasswords").label = kSignonBundle.getString(showingPasswords ? "hidePasswords" : "showPasswords");
     document.getElementById("togglePasswords").accessKey = kSignonBundle.getString(showingPasswords ? "hidePasswordsAccessKey" : "showPasswordsAccessKey");
     document.getElementById("passwordCol").hidden = !showingPasswords;
     _filterPasswords();
   }
 
   // Notify observers that the password visibility toggling is
   // completed.  (Mostly useful for tests)
   Components.classes["@mozilla.org/observer-service;1"]
             .getService(Components.interfaces.nsIObserverService)
             .notifyObservers(null, "passwordmgr-password-toggle-complete", null);
+  Services.telemetry.getHistogramById("PWMGR_MANAGE_VISIBILITY_TOGGLED").add(showingPasswords);
 }
 
 function AskUserShowPasswords() {
   var prompter = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
   var dummy = { value: false };
 
   // Confirm the user wants to display passwords
   return prompter.confirmEx(window,
           null,
           kSignonBundle.getString("noMasterPasswordPrompt"), prompter.STD_YES_NO_BUTTONS,
           null, null, null, null, dummy) == 0;    // 0=="Yes" button
 }
 
 function FinalizeSignonDeletions(syncNeeded) {
   for (var s=0; s<deletedSignons.length; s++) {
     passwordmanager.removeLogin(deletedSignons[s]);
+    Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED").add(1);
   }
   // If the deletion has been performed in a filtered view, reflect the deletion in the unfiltered table.
   // See bug 405389.
   if (syncNeeded) {
     try {
       signons = passwordmanager.getAllLogins();
     } catch (e) {
       signons = [];
@@ -352,25 +359,27 @@ function CopyPassword() {
   if (!showingPasswords && !masterPasswordLogin())
     return;
   // Copy selected signon's password to clipboard
   var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
                   getService(Components.interfaces.nsIClipboardHelper);
   var row = document.getElementById("signonsTree").currentIndex;
   var password = signonsTreeView.getCellText(row, {id : "passwordCol" });
   clipboard.copyString(password, document);
+  Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_PASSWORD").add(1);
 }
 
 function CopyUsername() {
   // Copy selected signon's username to clipboard
   var clipboard = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
                   getService(Components.interfaces.nsIClipboardHelper);
   var row = document.getElementById("signonsTree").currentIndex;
   var username = signonsTreeView.getCellText(row, {id : "userCol" });
   clipboard.copyString(username);
+  Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_USERNAME").add(1);
 }
 
 function UpdateCopyPassword() {
   var singleSelection = (signonsTreeView.selection.count == 1);
   var passwordMenuitem = document.getElementById("context-copypassword");
   var usernameMenuitem = document.getElementById("context-copyusername");
   if (singleSelection) {
     usernameMenuitem.removeAttribute("disabled");
--- a/toolkit/components/passwordmgr/content/passwordManagerCommon.js
+++ b/toolkit/components/passwordmgr/content/passwordManagerCommon.js
@@ -1,14 +1,16 @@
 /* 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/. */
 
 /*** =================== INITIALISATION CODE =================== ***/
 
+Components.utils.import("resource://gre/modules/Services.jsm");
+
 var kObserverService;
 
 // interface variables
 var passwordmanager     = null;
 
 // password-manager lists
 var signons             = [];
 var rejects             = [];
@@ -164,16 +166,17 @@ function HandleTreeColumnClick(sortFunct
   }
 
   let sortField = event.target.getAttribute("data-field-name");
   if (!sortField) {
     return;
   }
 
   sortFunction(sortField);
+  Services.telemetry.getKeyedHistogramById("PWMGR_MANAGE_SORTED").add(sortField);
 }
 
 function SortTree(tree, view, table, column, lastSortColumn, lastSortAscending, updateSelection) {
 
   // remember which item was selected so we can restore it after the sort
   var selections = GetTreeSelections(tree);
   var selectedNumber = selections.length ? table[selections[0]].number : -1;
 
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7613,16 +7613,53 @@
     "description": "The effect of the form action on signon autofill. (0=No effect, 1=Fewer logins after considering the form action, 2=No logins match form origin and action."
   },
   "PWMGR_FORM_AUTOFILL_RESULT": {
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values" : 20,
     "description": "The result of auto-filling a login form. See http://mzl.la/1Mbs6jL for bucket descriptions."
   },
+  "PWMGR_MANAGE_COPIED_PASSWORD": {
+    "expires_in_version": "never",
+    "kind": "count",
+    "description": "Count of passwords copied from the password management interface"
+  },
+  "PWMGR_MANAGE_COPIED_USERNAME": {
+    "expires_in_version": "never",
+    "kind": "count",
+    "description": "Count of usernames copied from the password management interface"
+  },
+  "PWMGR_MANAGE_DELETED": {
+    "expires_in_version": "never",
+    "kind": "count",
+    "description": "Count of passwords deleted from the password management interface (including via Remove All)"
+  },
+  "PWMGR_MANAGE_DELETED_ALL": {
+    "expires_in_version": "never",
+    "kind": "count",
+    "description": "Count of times that Remove All was used from the password management interface"
+  },
+  "PWMGR_MANAGE_OPENED": {
+    "expires_in_version": "never",
+    "kind": "enumerated",
+    "n_values" : 5,
+    "description": "Accumulates how the password management interface was opened. (0=Preferences, 1=Page Info)"
+  },
+  "PWMGR_MANAGE_SORTED": {
+    "expires_in_version": "never",
+    "keyed": true,
+    "kind": "count",
+    "description": "Reports the column that logins are sorted by"
+  },
+  "PWMGR_MANAGE_VISIBILITY_TOGGLED": {
+    "expires_in_version": "never",
+    "kind": "boolean",
+    "description": "Whether the visibility of passwords was toggled (0=Hide, 1=Show)"
+  },
   "PWMGR_NUM_PASSWORDS_PER_HOSTNAME": {
     "expires_in_version": "never",
     "kind": "linear",
     "high": 21,
     "n_buckets" : 20,
     "description": "The number of passwords per hostname"
   },
   "PWMGR_NUM_SAVED_PASSWORDS": {