Bug 1318194 - Always lists matching logins regardless of page security, r=MattN a=jcristau
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 18 Nov 2016 16:33:13 +0800
changeset 352868 1c79a62854cb048f4f9264c62441c402046ae664
parent 352867 2273338be4705845aa3242b1d548f40a2c889faa
child 352869 c642a065f38ed87fd65e062d698c4211a4065bea
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, jcristau
bugs1318194
milestone52.0a2
Bug 1318194 - Always lists matching logins regardless of page security, r=MattN a=jcristau The logic here needs update; the insecure autofill pref should only affact the actual autofill. We should always represent the list of saved login on the dropdown regardless of the pref and the page security. MozReview-Commit-ID: 6stMPQjBO14
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/test/mochitest/test_password_field_autocomplete.html
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1275,23 +1275,20 @@ UserAutoCompleteResult.prototype = {
         if (seen.has(login.username)) {
           duplicates.add(login.username);
         }
         seen.add(login.username);
       }
       return duplicates;
     }
 
-    let currentMatchingLogins = (!LoginHelper.insecureAutofill && !this._isSecure) ?
-                                [] : this._matchingLogins;
-
     this._showInsecureFieldWarning = (!this._isSecure && LoginHelper.showInsecureFieldWarning) ? 1 : 0;
-    this.logins = currentMatchingLogins.sort(loginSort);
-    this.matchCount = currentMatchingLogins.length + this._showInsecureFieldWarning;
-    this._duplicateUsernames = findDuplicates(currentMatchingLogins);
+    this.logins = this._matchingLogins.sort(loginSort);
+    this.matchCount = this._matchingLogins.length + this._showInsecureFieldWarning;
+    this._duplicateUsernames = findDuplicates(this._matchingLogins);
 
     if (this.matchCount > 0) {
       this.searchResult = Ci.nsIAutoCompleteResult.RESULT_SUCCESS;
       this.defaultIndex = 0;
     }
   },
 
   // Interfaces from idl...
--- a/toolkit/components/passwordmgr/test/mochitest/test_password_field_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_password_field_autocomplete.html
@@ -223,17 +223,22 @@ add_task(function* test_form1_enabledIns
   is(SpecialPowers.getBoolPref("signon.autofillForms.http"), false, "verify pref signon.autofillForms.http");
   let shownPromise = promiseACShown();
   doKey("down"); // open
   let results = yield shownPromise;
 
   let popupState = yield getPopupState();
   is(popupState.selectedIndex, -1, "Check no entries are selected upon opening");
 
-  let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised."];
+  let expectedMenuItems = ["This connection is not secure. Logins entered here could be compromised.",
+                           "No username (" + DATE_NOW_STRING + ")",
+                           "tempuser1",
+                           "testuser2",
+                           "testuser3",
+                           "zzzuser4"];
   checkArrayValues(results, expectedMenuItems, "Check all menuitems are displayed correctly.");
 
   doKey("down"); // select insecure warning
   checkACFormPasswordField(""); // value shouldn't update just by selecting
   doKey("return"); // not "enter"!
   yield spinEventLoop(); // let focus happen
   checkACFormPasswordField("");
 });