Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <form method="GET" target="target"> | 7 <form method="GET" target="target"> |
| 8 <input name="query" value="AAA" /> | 8 <input name="query" value="AAA" /> |
| 9 <input type="submit" id="submitButton"/> | 9 <input type="submit" id="submitButton"/> |
| 10 </form> | 10 </form> |
| 11 <form method="GET" target="target1"> | 11 <form method="GET" target="target1"> |
| 12 <input name="query1" value="AAA" /> | 12 <input name="query1" value="AAA" /> |
| 13 <input type="submit" id="submitButton1"/> | 13 <input type="submit" id="submitButton1"/> |
| 14 </form> | 14 </form> |
| 15 <iframe id="target" name="target"></iframe> | 15 <iframe id="target" name="target"></iframe> |
| 16 <iframe id="target1" name="target1"></iframe> | 16 <iframe id="target1" name="target1"></iframe> |
| 17 <script> | 17 <script> |
| 18 description('Test that form submit within onsubmit event handlers are not delaye d and sends the form data when invoked'); | 18 description('Test that form submit within onsubmit event handlers are not delaye d and sends the form data when invoked'); |
| 19 var count = 2; | 19 var count = 2; |
| 20 | |
| 21 function asyncTest(query) { | |
| 22 if (query === '?query=AAA' || query === '?query=BBB') { | |
|
tkent
2014/03/17 20:56:19
Did you run this test? Shouldn't '?query=BBB' be
Habib Virji
2014/03/18 08:49:04
Done. Apologise, I did test was query1, but by mis
| |
| 23 if (--count == 0) { | |
| 24 testPassed('Both query events received, with correct values: AAA and BBB'); | |
| 25 finishJSTest(); | |
| 26 } | |
| 27 } | |
| 28 } | |
| 29 | |
| 20 document.forms[0].onsubmit = function (event) { | 30 document.forms[0].onsubmit = function (event) { |
| 21 document.forms[0].submit(); | 31 document.forms[0].submit(); |
| 22 document.forms[0].children.query.value = 'BBB'; | 32 document.forms[0].children.query.value = 'BBB'; |
| 23 return false; | 33 return false; |
| 24 } | 34 } |
| 25 | 35 |
| 26 document.forms[1].onsubmit = function (event) { | 36 document.forms[1].onsubmit = function (event) { |
| 27 document.forms[1].submit(); | 37 document.forms[1].submit(); |
| 28 document.forms[1].children.query1.value = 'BBB'; | 38 document.forms[1].children.query1.value = 'BBB'; |
| 29 return true; | 39 return true; |
| 30 } | 40 } |
| 31 | 41 |
| 32 document.getElementById('target').onload = function(event) { | 42 document.getElementById('target').onload = function(event) { |
| 33 shouldBeEqualToString('event.target.contentWindow.location.search', '?query= AAA'); | 43 // This should return back query AAA |
| 34 if (--count == 0) | 44 asyncTest(event.target.contentWindow.location.search); |
| 35 finishJSTest(); | |
| 36 } | 45 } |
| 37 | 46 |
| 38 document.getElementById('target1').onload = function(event) { | 47 document.getElementById('target1').onload = function(event) { |
| 39 shouldBeEqualToString('event.target.contentWindow.location.search', '?query1 =BBB'); | 48 // This should return back query BBB |
| 40 if (--count == 0) | 49 asyncTest(event.target.contentWindow.location.search); |
| 41 finishJSTest(); | |
| 42 } | 50 } |
| 43 | 51 |
| 44 window.onload = function() { | 52 window.onload = function() { |
| 53 document.getElementById('submitButton').click(); | |
| 45 document.getElementById('submitButton1').click(); | 54 document.getElementById('submitButton1').click(); |
| 46 document.getElementById('submitButton').click(); | |
| 47 } | 55 } |
| 48 | 56 |
| 49 if (window.testRunner) | 57 if (window.testRunner) |
| 50 window.jsTestIsAsync = true; | 58 window.jsTestIsAsync = true; |
| 51 </script> | 59 </script> |
| 52 </body> | 60 </body> |
| 53 </html> | 61 </html> |
| 54 | 62 |
| 55 | 63 |
| 56 | 64 |
| 57 | 65 |
| OLD | NEW |