OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 |
| 3 <script src="/js-test-resources/js-test.js"></script> |
| 4 <script> |
| 5 description('Test for ArrayBuffer POST in XMLHttpRequest send'); |
| 6 window.jsTestIsAsync = true; |
| 7 |
| 8 new Promise(function(resolve, reject) { |
| 9 var array = new Uint8Array([0, 1, 2, 25, 45, 58, 255]); |
| 10 var xhr = new XMLHttpRequest; |
| 11 xhr.open('POST', 'resources/post-echo-as-ascii.cgi', true); |
| 12 xhr.onreadystatechange = function() { |
| 13 if (xhr.readyState === 4) { |
| 14 debug('xhr.readyState = ' + xhr.readyState + ': responseURL = ' + xh
r.responseURL); |
| 15 resolve(xhr); |
| 16 } |
| 17 } |
| 18 xhr.send(new DataView(array.buffer)); |
| 19 }).then(function(xhr) { |
| 20 window.status = xhr.status; |
| 21 shouldBeEqualToString('status', '200'); |
| 22 responseText = xhr.responseText; |
| 23 shouldBeEqualToString('responseText', '0 1 2 25 45 58 255'); |
| 24 }).catch(function(reason) { |
| 25 testFailed(String(reason)); |
| 26 }).then(finishJSTest, finishJSTest); |
| 27 |
| 28 </script> |
OLD | NEW |