blob: 25c5d24072788b32e4bcf136c7eb5a37b9d39148 [file] [log] [blame]
Philip Jägenstedtc053f402014-01-22 17:02:181<!DOCTYPE html>
2<html>
3<head>
Ms2ger91fef142014-11-01 09:24:374 <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ägenstedtc053f402014-01-22 17:02:187 <script src="/resources/testharness.js"></script>
James Grahama3d9d8e2014-06-09 13:06:488 <script src="/resources/testharnessreport.js"></script>
Philip Jägenstedtc053f402014-01-22 17:02:189 <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 Grahama3d9d8e2014-06-09 13:06:4831 if (xhr.readyState == 4)
Philip Jägenstedtc053f402014-01-22 17:02:1832 {
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>