9 // TODO(gcasto): Not sure why this is necessary, but calling
10 // window.domAutomationController directly in setTimeout seemt to causes the
11 // function to be evaluated inline.
12 function delayedUpload() {
13 window
.domAutomationController
.send("XHR_FINISHED");
16 function state_changed(xhr
) {
17 if (xhr
.readyState
== 4) {
19 window
.top
.location
.href
= "done.html";
21 // Pretend like auth succeeded by hiding the login and signup forms.
22 document
.getElementById("testform").style
.display
= "none";
23 document
.getElementById("signup_testform").style
.display
= "none";
24 window
.domAutomationController
.setAutomationId(0);
25 // Delay upload so that handler in PasswordAutofillAgent can be run
26 // first. This will happen immediately after JS execution ends, so this
27 // shouldn't introduce any timing dependent flakes.
28 setTimeout(delayedUpload
, 0);
34 var xhr
= new XMLHttpRequest();
35 xhr
.onreadystatechange = function() { state_changed(xhr
); };
36 xhr
.open("GET", "password_xhr_submit.html", true);
43 <form onsubmit=
"send_xhr(); return false;" id=
"testform">
44 <input type=
"text" id=
"username_field" name=
"username_field">
45 <input type=
"password" id=
"password_field" name=
"password_field">
46 <input type=
"submit" id=
"submit_button" name=
"submit_button">
49 <form action=
"password_xhr_submit.html" onsubmit=
"send_xhr(); return false;"
51 <input type=
"text" id=
"signup_username_field" name=
"signup_username_field">
52 <input type=
"password" id=
"signup_password_field"
53 name=
"signup_password_field" autocomplete=
"new-password">
54 <input type=
"password" id=
"confirmation_password_field"
55 name=
"confirmation_password_field" autocomplete=
"new-password">
56 <input type=
"submit" id=
"signup_submit_button" name=
"signup_submit_button">