From 5313976923a537dfedb6e952736f29bd56e15b4c Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Sun, 7 Sep 2008 00:01:11 -0700 Subject: [PATCH] Bug 447788 - Login not filled if existing form username differs in case. r=gavin. --- toolkit/components/passwordmgr/src/nsLoginManager.js | 8 ++++---- toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/toolkit/components/passwordmgr/src/nsLoginManager.js b/toolkit/components/passwordmgr/src/nsLoginManager.js index b235e1d72..ee6259a82 100644 --- a/toolkit/components/passwordmgr/src/nsLoginManager.js +++ b/toolkit/components/passwordmgr/src/nsLoginManager.js @@ -1091,13 +1091,13 @@ LoginManager.prototype = { // If username was specified in the form, only fill in the // password if we find a matching login. - var username = usernameField.value; + var username = usernameField.value.toLowerCase(); var matchingLogin; var found = logins.some(function(l) { - matchingLogin = l; - return (l.username == username); - }); + matchingLogin = l; + return (l.username.toLowerCase() == username); + }); if (found) selectedLogin = matchingLogin; else diff --git a/toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html b/toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html index a5835ab29..54117e704 100644 --- a/toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html +++ b/toolkit/components/passwordmgr/test/test_basic_form_1pw_2.html @@ -58,6 +58,12 @@ Login Manager test: forms with 1 password field, part 2 +
9 + + + +
+
@@ -68,11 +74,14 @@ Login Manager test: forms with 1 password field, part 2
 function startTest() {
     var f;
 
+    // Test various combinations of disabled/readonly inputs
     checkForm(1, "testpass"); // control
     checkUnmodifiedForm(2);
     checkUnmodifiedForm(3);
     checkForm(4, "testuser", "testpass"); // control
     for (f = 5;  f <= 8;  f++) { checkUnmodifiedForm(f); }
+    // Test case-insensitive comparison of username field
+    checkForm(9, "testuser", "testpass");
 
     SimpleTest.finish();
 }
-- 
2.11.4.GIT