| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 | 3 |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 var navigate = true; | 6 var navigate = true; |
| 7 | 7 |
| 8 // TODO(gcasto): Not sure why this is necessary, but calling | 8 // TODO(gcasto): Not sure why this is necessary, but calling |
| 9 // window.domAutomationController directly in setTimeout seemt to causes the | 9 // window.domAutomationController directly in setTimeout seemt to causes the |
| 10 // function to be evaluated inline. | 10 // function to be evaluated inline. |
| 11 function delayedUpload() { | 11 function delayedUpload() { |
| 12 window.domAutomationController.send("FETCH_FINISHED"); | 12 window.domAutomationController.send("FETCH_FINISHED"); |
| 13 } | 13 } |
| 14 | 14 |
| 15 function send_fetch() { | 15 function send_fetch() { |
| 16 fetch("done.html") | 16 fetch("done.html") |
| 17 .then( | 17 .then( |
| 18 function(response) { | 18 function(response) { |
| 19 if (navigate) { | 19 if (navigate) { |
| 20 window.top.location.href = "done.html"; | 20 window.top.location.href = "done.html"; |
| 21 } else { | 21 } else { |
| 22 // Pretend like auth succeeded by hiding the login and signup forms. | 22 // Pretend like auth succeeded by hiding the login and signup forms. |
| 23 document.getElementById("testform").style.display = "none"; | 23 document.getElementById("testform").style.display = "none"; |
| 24 document.getElementById("signup_testform").style.display = "none"; | 24 document.getElementById("signup_testform").style.display = "none"; |
| 25 window.domAutomationController.setAutomationId(0); | |
| 26 // Delay upload so that handler in PasswordAutofillAgent can be run | 25 // Delay upload so that handler in PasswordAutofillAgent can be run |
| 27 // first. This will happen immediately after JS execution ends, so | 26 // first. This will happen immediately after JS execution ends, so |
| 28 // this shouldn't introduce any timing dependent flakes. | 27 // this shouldn't introduce any timing dependent flakes. |
| 29 setTimeout(delayedUpload, 0); | 28 setTimeout(delayedUpload, 0); |
| 30 } | 29 } |
| 31 } | 30 } |
| 32 ) | 31 ) |
| 33 } | 32 } |
| 34 | 33 |
| 35 </script> | 34 </script> |
| 36 </head> | 35 </head> |
| 37 <body> | 36 <body> |
| 38 <form onsubmit="send_fetch(); return false;" id="testform"> | 37 <form onsubmit="send_fetch(); return false;" id="testform"> |
| 39 <input type="text" id="username_field" name="username_field"> | 38 <input type="text" id="username_field" name="username_field"> |
| 40 <input type="password" id="password_field" name="password_field"> | 39 <input type="password" id="password_field" name="password_field"> |
| 41 <input type="submit" id="submit_button" name="submit_button"> | 40 <input type="submit" id="submit_button" name="submit_button"> |
| 42 </form> | 41 </form> |
| 43 | 42 |
| 44 <form action="password_fetch_submit.html" onsubmit="send_fetch(); return false;" | 43 <form action="password_fetch_submit.html" onsubmit="send_fetch(); return false;" |
| 45 id="signup_testform"> | 44 id="signup_testform"> |
| 46 <input type="text" id="signup_username_field" name="signup_username_field"> | 45 <input type="text" id="signup_username_field" name="signup_username_field"> |
| 47 <input type="password" id="signup_password_field" | 46 <input type="password" id="signup_password_field" |
| 48 name="signup_password_field" autocomplete="new-password"> | 47 name="signup_password_field" autocomplete="new-password"> |
| 49 <input type="password" id="confirmation_password_field" | 48 <input type="password" id="confirmation_password_field" |
| 50 name="confirmation_password_field" autocomplete="new-password"> | 49 name="confirmation_password_field" autocomplete="new-password"> |
| 51 <input type="submit" id="signup_submit_button" name="signup_submit_button"> | 50 <input type="submit" id="signup_submit_button" name="signup_submit_button"> |
| 52 </form> | 51 </form> |
| 53 </body> | 52 </body> |
| 54 </html> | 53 </html> |
| OLD | NEW |