From a8d362f2142ae3a26b2cd71027e124a3e2040099 Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Fri, 18 Jul 2008 14:18:05 -0700 Subject: [PATCH] Bug 327977 ? Password manager overwrites page data for password-only forms. r=gavin --- toolkit/components/passwordmgr/src/nsLoginManager.js | 5 +++++ toolkit/components/passwordmgr/test/test_basic_form_1pw.html | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/toolkit/components/passwordmgr/src/nsLoginManager.js b/toolkit/components/passwordmgr/src/nsLoginManager.js index aac41a68a..2f9817183 100644 --- a/toolkit/components/passwordmgr/src/nsLoginManager.js +++ b/toolkit/components/passwordmgr/src/nsLoginManager.js @@ -1002,6 +1002,11 @@ LoginManager.prototype = { if (passwordField == null) return [false, foundLogins]; + // If there's only a password field and it has a value, there's + // nothing for us to do. (Don't clobber the existing value) + if (!usernameField && passwordField.value) + return [false, foundLogins]; + // Need to get a list of logins if we weren't given them if (foundLogins == null) { var formOrigin = diff --git a/toolkit/components/passwordmgr/test/test_basic_form_1pw.html b/toolkit/components/passwordmgr/test/test_basic_form_1pw.html index 99754e15c..f34f04ba0 100644 --- a/toolkit/components/passwordmgr/test/test_basic_form_1pw.html +++ b/toolkit/components/passwordmgr/test/test_basic_form_1pw.html @@ -2741,8 +2741,7 @@ function startTest() { var f; for (f = 1; f <= 4; f++) { checkForm(f, "testpass"); } - todo(false, "Don't clobber prefilled differing password"); - //for (f = 5; f <= 6; f++) { checkUnmodifiedForm(f); } + for (f = 5; f <= 6; f++) { checkUnmodifiedForm(f); } for (f = 7; f <= 14; f++) { checkForm(f, "testuser", "testpass"); } todo(false, "Don't clobber prefilled differing password"); //for (f = 15; f <= 18; f++) { checkUnmodifiedForm(f); } -- 2.11.4.GIT