OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>XMLHttpRequest: send() during onloadstart</title> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
| 7 </head> |
| 8 <body> |
| 9 <script> |
| 10 var testAsync = async_test("Attempting a send() during onloadstart"); |
| 11 testAsync.step(() => { |
| 12 var xhr = new XMLHttpRequest(); |
| 13 xhr.open("POST", "resources/delay.php?iteration=1&delay=1000"); |
| 14 xhr.onloadstart = testAsync.step_func(() => { |
| 15 assert_equals(xhr.readyState, XMLHttpRequest.OPENED); |
| 16 // Step 2 of send(): "If the send() flag is set, throw an InvalidStateEr
ror exception." |
| 17 assert_throws('InvalidStateError', () => { xhr.send(); }); |
| 18 }); |
| 19 xhr.onloadend = testAsync.step_func(() => { |
| 20 assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
| 21 testAsync.done(); |
| 22 }); |
| 23 xhr.send(); |
| 24 }); |
| 25 </script> |
| 26 </body> |
| 27 </html> |
OLD | NEW |