OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>XMLHttpRequest: setting withCredentials while sending data</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("Setting withCredentials, post-send() (async)"); |
| 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 assert_throws('InvalidStateError', () => { xhr.withCredentials = true; }
); |
| 17 }); |
| 18 xhr.onloadend = testAsync.step_func(() => { |
| 19 assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
| 20 testAsync.done(); |
| 21 }); |
| 22 xhr.send(); |
| 23 }); |
| 24 |
| 25 var testSync = async_test("Setting withCredentials, post-send() (sync)"); |
| 26 testSync.step(() => { |
| 27 var xhr = new XMLHttpRequest(); |
| 28 xhr.open("POST", "resources/delay.php?iteration=1&delay=1000", false); |
| 29 xhr.onprogress = testSync.step_func(() => { |
| 30 assert_throws('InvalidStateError', () => { xhr.withCredentials = true })
; |
| 31 }); |
| 32 xhr.onloadend = testSync.step_func(() => { |
| 33 assert_equals(xhr.readyState, XMLHttpRequest.DONE); |
| 34 testSync.done(); |
| 35 }); |
| 36 xhr.send(); |
| 37 }); |
| 38 </script> |
| 39 </body> |
| 40 </html> |
OLD | NEW |