<!DOCTYPE html> <script src="/js-test-resources/js-test.js"></script> <script> description('Test for ArrayBuffer POST in XMLHttpRequest send'); window.jsTestIsAsync = true; new Promise(function(resolve, reject) { var array = new Uint8Array([0, 1, 2, 25, 45, 58, 255]); var xhr = new XMLHttpRequest; xhr.open('POST', 'resources/post-echo-as-ascii.cgi', true); xhr.onreadystatechange = function() { if (xhr.readyState === 4) { debug('xhr.readyState = ' + xhr.readyState + ': responseURL = ' + xhr.responseURL); resolve(xhr); } } xhr.send(new DataView(array.buffer)); }).then(function(xhr) { window.status = xhr.status; shouldBeEqualToString('status', '200'); responseText = xhr.responseText; shouldBeEqualToString('responseText', '0 1 2 25 45 58 255'); }).catch(function(reason) { testFailed(String(reason)); }).then(finishJSTest, finishJSTest); </script>