Bug 1318194 - Always lists matching logins regardless of page security, r=MattN draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 18 Nov 2016 16:33:13 +0800
changeset 441029 2a1c0a7563dc86767875ba95fa43fe56f6d798f4
parent 440163 c27117f67fa3ff30bbd34bcd6c7536c0d10bd4ad
child 441118 0073a0b7fcb7b9f302d7efcfe6fe7a76a8c0004a
push id36335
push userbmo:timdream@gmail.com
push dateFri, 18 Nov 2016 08:33:47 +0000
reviewersMattN
bugs1318194
milestone53.0a1
Bug 1318194 - Always lists matching logins regardless of page security, r=MattN 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
@@ -1289,23 +1289,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("");
 });