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
--- 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("");
});