| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| Ms2ger | 91fef14 | 2014-11-01 09:24:37 | [diff] [blame] | 4 | <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[4]/dl[1]/dd[1]"/> |
| 5 | <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[3]"/> |
| 6 | <link rel="help" href="https://xhr.spec.whatwg.org/#the-response-attribute" data-tested-assertations="following::ol[1]/li[3]"/> |
| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 7 | <script src="/resources/testharness.js"></script> |
| James Graham | a3d9d8e | 2014-06-09 13:06:48 | [diff] [blame] | 8 | <script src="/resources/testharnessreport.js"></script> |
| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 9 | <title>XMLHttpRequest: The send() method: ArrayBuffer data</title> |
| 10 | </head> |
| 11 | |
| 12 | <body> |
| 13 | <div id="log"></div> |
| 14 | |
| 15 | <script type="text/javascript"> |
| 16 | var test = async_test(); |
| 17 | |
| 18 | test.step(function() |
| 19 | { |
| 20 | var xhr = new XMLHttpRequest(); |
| 21 | var buf = new ArrayBuffer(5); |
| 22 | var arr = new Uint8Array(buf); |
| 23 | arr[0] = 0x48; |
| 24 | arr[1] = 0x65; |
| 25 | arr[2] = 0x6c; |
| 26 | arr[3] = 0x6c; |
| 27 | arr[4] = 0x6f; |
| 28 | |
| 29 | xhr.onreadystatechange = function() |
| 30 | { |
| James Graham | a3d9d8e | 2014-06-09 13:06:48 | [diff] [blame] | 31 | if (xhr.readyState == 4) |
| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 32 | { |
| 33 | test.step(function() |
| 34 | { |
| 35 | assert_equals(xhr.status, 200); |
| 36 | assert_equals(xhr.response, "Hello"); |
| 37 | |
| 38 | test.done(); |
| 39 | }); |
| 40 | } |
| 41 | }; |
| 42 | |
| 43 | xhr.open("POST", "./resources/content.py", true); |
| 44 | xhr.send(buf); |
| 45 | }); |
| 46 | </script> |
| 47 | </body> |
| 48 | </html> |