| 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" action="data:text/html,a"> |
| 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" action="data:text/html,b"> |
| 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; | |
| 20 | |
| 21 function asyncTest(query) { | |
| 22 if (query === '?query=AAA' || query === '?query1=BBB') { | |
| 23 if (--count == 0) { | |
| 24 testPassed('Both query events received, with correct values: AAA and
BBB'); | |
| 25 finishJSTest(); | |
| 26 } | |
| 27 } | |
| 28 } | |
| 29 | 19 |
| 30 document.forms[0].onsubmit = function (event) { | 20 document.forms[0].onsubmit = function (event) { |
| 31 document.forms[0].submit(); | 21 document.forms[0].submit(); |
| 32 document.forms[0].children.query.value = 'BBB'; | 22 document.forms[0].children.query.value = 'BBB'; |
| 33 return false; | 23 return false; |
| 34 } | 24 } |
| 35 | 25 |
| 36 document.forms[1].onsubmit = function (event) { | 26 document.forms[1].onsubmit = function (event) { |
| 37 document.forms[1].submit(); | 27 document.forms[1].submit(); |
| 38 document.forms[1].children.query1.value = 'BBB'; | 28 document.forms[1].children.query1.value = 'BBB'; |
| 39 return true; | 29 return true; |
| 40 } | 30 } |
| 41 | 31 |
| 42 document.getElementById('target').onload = function(event) { | 32 window.onload = function() { |
| 43 // This should return back query AAA | 33 document.getElementById('target').onload = function(event) { |
| 44 asyncTest(event.target.contentWindow.location.search); | 34 // This should return back query AAA |
| 45 } | 35 shouldBeEqualToString('event.target.contentWindow.location.search', '?qu
ery=AAA'); |
| 36 document.getElementById('submitButton1').click(); |
| 37 } |
| 46 | 38 |
| 47 document.getElementById('target1').onload = function(event) { | 39 document.getElementById('target1').onload = function(event) { |
| 48 // This should return back query BBB | 40 // This should return back query BBB |
| 49 asyncTest(event.target.contentWindow.location.search); | 41 shouldBeEqualToString('event.target.contentWindow.location.search', '?qu
ery1=BBB'); |
| 50 } | 42 finishJSTest(); |
| 43 } |
| 51 | 44 |
| 52 window.onload = function() { | |
| 53 document.getElementById('submitButton').click(); | 45 document.getElementById('submitButton').click(); |
| 54 document.getElementById('submitButton1').click(); | |
| 55 } | 46 } |
| 56 | 47 |
| 57 if (window.testRunner) | 48 if (window.testRunner) |
| 58 window.jsTestIsAsync = true; | 49 window.jsTestIsAsync = true; |
| 59 </script> | 50 </script> |
| 60 </body> | 51 </body> |
| 61 </html> | 52 </html> |
| 62 | 53 |
| 63 | 54 |
| 64 | 55 |
| 65 | 56 |
| OLD | NEW |