Bug 1124888 - Record the effect of the saved formSubmitURL on autofilling login forms. r=dolske, a=lmandel
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Fri, 20 Feb 2015 16:21:05 -0800
changeset 250141 191548235ce3
parent 250140 c16968de534c
child 250142 ae07b3862c27
push id4513
push userryanvm@gmail.com
push date2015-03-02 19:36 +0000
treeherdermozilla-beta@824656d7ad0d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, lmandel
bugs1124888
milestone37.0
Bug 1124888 - Record the effect of the saved formSubmitURL on autofilling login forms. r=dolske, a=lmandel
toolkit/components/passwordmgr/LoginManagerParent.jsm
toolkit/components/telemetry/Histograms.json
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -102,18 +102,19 @@ var LoginManagerParent = {
   findLogins: function(showMasterPassword, formOrigin, actionOrigin,
                        requestId, target) {
     if (!showMasterPassword && !Services.logins.isLoggedIn) {
       target.sendAsyncMessage("RemoteLogins:loginsFound",
                               { requestId: requestId, logins: [] });
       return;
     }
 
+    let allLoginsCount = Services.logins.countLogins(formOrigin, "", null);
     // If there are no logins for this site, bail out now.
-    if (!Services.logins.countLogins(formOrigin, "", null)) {
+    if (!allLoginsCount) {
       target.sendAsyncMessage("RemoteLogins:loginsFound",
                               { requestId: requestId, logins: [] });
       return;
     }
 
     // If we're currently displaying a master password prompt, defer
     // processing this form until the user handles the prompt.
     if (Services.logins.uiBusy) {
@@ -147,16 +148,26 @@ var LoginManagerParent = {
       Services.obs.addObserver(observer, "passwordmgr-crypto-login", false);
       Services.obs.addObserver(observer, "passwordmgr-crypto-loginCanceled", false);
       return;
     }
 
     var logins = Services.logins.findLogins({}, formOrigin, actionOrigin, null);
     target.sendAsyncMessage("RemoteLogins:loginsFound",
                             { requestId: requestId, logins: logins });
+
+    const PWMGR_FORM_ACTION_EFFECT =  Services.telemetry.getHistogramById("PWMGR_FORM_ACTION_EFFECT");
+    if (logins.length == 0) {
+      PWMGR_FORM_ACTION_EFFECT.add(2);
+    } else if (logins.length == allLoginsCount) {
+      PWMGR_FORM_ACTION_EFFECT.add(0);
+    } else {
+      // logins.length < allLoginsCount
+      PWMGR_FORM_ACTION_EFFECT.add(1);
+    }
   },
 
   doAutocompleteSearch: function({ formOrigin, actionOrigin,
                                    searchString, previousResult,
                                    rect, requestId, remote }, target) {
     // Note: previousResult is a regular object, not an
     // nsIAutoCompleteResult.
     var result;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -7197,16 +7197,22 @@
   "PWMGR_BLOCKLIST_NUM_SITES": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 100,
     "n_buckets" : 10,
     "extended_statistics_ok": true,
     "description": "The number of sites for which the user has explicitly rejected saving logins"
   },
+  "PWMGR_FORM_ACTION_EFFECT": {
+    "expires_in_version": "never",
+    "kind": "enumerated",
+    "n_values" : 5,
+    "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_NUM_PASSWORDS_PER_HOSTNAME": {
     "expires_in_version": "never",