mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1152422 - Ask to save the new password in a change form with no username even if we have no logins for the site. r=dolske
This commit is contained in:
parent
af2ac81dc3
commit
c5cceb8c4e
@ -421,20 +421,12 @@ var LoginManagerParent = {
|
||||
(usernameField ? usernameField.name : ""),
|
||||
newPasswordField.name);
|
||||
|
||||
let logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
|
||||
|
||||
// If we didn't find a username field, but seem to be changing a
|
||||
// password, allow the user to select from a list of applicable
|
||||
// logins to update the password for.
|
||||
if (!usernameField && oldPasswordField) {
|
||||
|
||||
var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
|
||||
|
||||
if (logins.length == 0) {
|
||||
// Could prompt to save this as a new password-only login.
|
||||
// This seems uncommon, and might be wrong, so ignore.
|
||||
log("(no logins for this host -- pwchange ignored)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!usernameField && oldPasswordField && logins.length > 0) {
|
||||
var prompter = getPrompter();
|
||||
|
||||
if (logins.length == 1) {
|
||||
@ -452,10 +444,8 @@ var LoginManagerParent = {
|
||||
}
|
||||
|
||||
|
||||
// Look for an existing login that matches the form login.
|
||||
var existingLogin = null;
|
||||
var logins = Services.logins.findLogins({}, hostname, formSubmitURL, null);
|
||||
|
||||
// Look for an existing login that matches the form login.
|
||||
for (var i = 0; i < logins.length; i++) {
|
||||
var same, login = logins[i];
|
||||
|
||||
|
@ -13,6 +13,7 @@ support-files =
|
||||
subtst_notifications_11.html
|
||||
subtst_notifications_11_popup.html
|
||||
subtst_notifications_2.html
|
||||
subtst_notifications_2pw_0un.html
|
||||
subtst_notifications_3.html
|
||||
subtst_notifications_4.html
|
||||
subtst_notifications_5.html
|
||||
|
@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Subtest for Login Manager notifications with 2 password fields and no username</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>Subtest 24</h2>
|
||||
<form id="form" action="formsubmit.sjs">
|
||||
<input id="pass1" name="pass1" type="password" value="staticpw">
|
||||
<input id="pass" name="pass" type="password">
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
function submitForm() {
|
||||
pass.value = "notifyp2";
|
||||
form.submit();
|
||||
}
|
||||
|
||||
window.onload = submitForm;
|
||||
var form = document.getElementById("form");
|
||||
var pass = document.getElementById("pass");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -48,6 +48,9 @@ var subtests = [
|
||||
"http://test1.example.org:80" + testpath + "subtst_notifications_1.html", // 21
|
||||
"http://test1.example.org:80" + testpath + "subtst_notifications_7.html", // 22
|
||||
"http://test1.example.org:80" + testpath + "subtst_notifications_6.html", // 23
|
||||
"subtst_notifications_2pw_0un.html", // 24
|
||||
"subtst_notifications_2pw_0un.html", // 25
|
||||
"subtst_notifications_2pw_0un.html", // 26
|
||||
];
|
||||
|
||||
|
||||
@ -378,6 +381,46 @@ function checkTest() {
|
||||
popup.remove();
|
||||
break;
|
||||
|
||||
case 24:
|
||||
// Check for notification popup when a form with 2 password fields (no username) is
|
||||
// submitted and there are no saved logins.
|
||||
is(gotUser, "null", "Checking submitted username");
|
||||
is(gotPass, "notifyp2", "Checking submitted password");
|
||||
popup = getPopup(popupNotifications, "password-save");
|
||||
ok(popup, "got notification popup");
|
||||
popup.remove();
|
||||
|
||||
// Add login for the next test
|
||||
pwmgr.addLogin(login1);
|
||||
break;
|
||||
|
||||
case 25:
|
||||
// Check for notification popup when a form with 2 password fields (no username) is
|
||||
// submitted and there is a saved login with a username and different password.
|
||||
is(gotUser, "null", "Checking submitted username");
|
||||
is(gotPass, "notifyp2", "Checking submitted password");
|
||||
popup = getPopup(popupNotifications, "password-change");
|
||||
ok(popup, "got notification popup");
|
||||
popup.remove();
|
||||
// remove that login
|
||||
pwmgr.removeLogin(login1);
|
||||
|
||||
// Add login for the next test
|
||||
pwmgr.addLogin(login2B);
|
||||
break;
|
||||
|
||||
case 26:
|
||||
// Check for notification popup when a form with 2 password fields (no username) is
|
||||
// submitted and there is a saved login with no username and a different password.
|
||||
is(gotUser, "null", "Checking submitted username");
|
||||
is(gotPass, "notifyp2", "Checking submitted password");
|
||||
popup = getPopup(popupNotifications, "password-change");
|
||||
ok(popup, "got notification popup");
|
||||
popup.remove();
|
||||
// remove that login
|
||||
pwmgr.removeLogin(login2B);
|
||||
break;
|
||||
|
||||
default:
|
||||
ok(false, "Unexpected call to checkTest for test #" + testNum);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user