зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1025483 - fire 'input' event for password autocompletes, r=MattN
--HG-- extra : rebase_source : 2d972f2d8a6ccf78d5d43716850ae494cb73fe7d
This commit is contained in:
Родитель
7c70d0522c
Коммит
47e6eb1dac
|
@ -712,10 +712,10 @@ var LoginManagerContent = {
|
|||
usernameField.value.toLowerCase() == selectedLogin.username.toLowerCase());
|
||||
|
||||
if (!disabledOrReadOnly && !userEnteredDifferentCase) {
|
||||
usernameField.value = selectedLogin.username;
|
||||
usernameField.setUserInput(selectedLogin.username);
|
||||
}
|
||||
}
|
||||
passwordField.value = selectedLogin.password;
|
||||
passwordField.setUserInput(selectedLogin.password);
|
||||
didFillForm = true;
|
||||
} else if (selectedLogin && !autofillForm) {
|
||||
// For when autofillForm is false, but we still have the information
|
||||
|
|
|
@ -60,6 +60,7 @@ skip-if = true
|
|||
skip-if = toolkit == 'android' #TIMED_OUT
|
||||
[test_bug_654348.html]
|
||||
[test_bug_776171.html]
|
||||
[test_input_events.html]
|
||||
[test_master_password.html]
|
||||
skip-if = toolkit == 'android' #TIMED_OUT
|
||||
[test_master_password_cleanup.html]
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for input events in Login Manager</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="pwmgr_common.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="onNewEvent(event)">
|
||||
Login Manager test: input events should fire.
|
||||
|
||||
<script>
|
||||
commonInit();
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/** Test for Login Manager: form fill, should get input events. **/
|
||||
|
||||
var usernameInputFired = false;
|
||||
var passwordInputFired = false;
|
||||
var onloadFired = false;
|
||||
|
||||
function onNewEvent(e) {
|
||||
info("Got " + e.type + " event.");
|
||||
if (e.type == "load") {
|
||||
onloadFired = true;
|
||||
} else if (e.target.name == "uname") {
|
||||
ise(e.target.value, "testuser", "Should get 'testuser' as username");
|
||||
ok(!usernameInputFired, "Should not have gotten an input event for the username field yet.");
|
||||
usernameInputFired = true;
|
||||
} else if (e.target.name == "pword") {
|
||||
ise(e.target.value, "testpass", "Should get 'testpass' as password");
|
||||
ok(!passwordInputFired, "Should not have gotten an input event for the password field yet.");
|
||||
passwordInputFired = true;
|
||||
}
|
||||
if (onloadFired && usernameInputFired && passwordInputFired) {
|
||||
ok(true, "All events fired as expected, we're done.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.registerCleanupFunction(function cleanup() {
|
||||
clearTimeout(timeout);
|
||||
$_(1, "uname").removeAttribute("oninput");
|
||||
$_(1, "pword").removeAttribute("oninput");
|
||||
document.body.removeAttribute("onload");
|
||||
});
|
||||
|
||||
var timeout = setTimeout(function() {
|
||||
ok(usernameInputFired, "Username input event should have fired by now.");
|
||||
ok(passwordInputFired, "Password input event should have fired by now.");
|
||||
ok(onloadFired, "Window load event should have fired by now.");
|
||||
ok(false, "Not all events fired yet.");
|
||||
SimpleTest.finish();
|
||||
}, 10000);
|
||||
|
||||
</script>
|
||||
|
||||
<p id="display"></p>
|
||||
|
||||
<div id="content" style="display: none">
|
||||
|
||||
<form id="form1" action="formtest.js">
|
||||
<p>This is form 1.</p>
|
||||
<input type="text" name="uname" oninput="onNewEvent(event)">
|
||||
<input type="password" name="pword" oninput="onNewEvent(event)">
|
||||
|
||||
<button type="submit">Submit</button>
|
||||
<button type="reset"> Reset </button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче