OLD | NEW |
---|---|
(Empty) | |
1 <html> | |
2 <head></head> | |
3 <body> | |
tyoshino (SeeGerritForStatus)
2014/10/29 04:41:07
ok to omit them. instead add DOCTYPE please.
http
Paritosh Kumar
2014/10/29 05:08:24
Done.
| |
4 | |
5 <script src="/js-test-resources/js-test.js"></script> | |
6 <script> | |
7 description('Test for ArrayBuffer Post in XMLHttpRequest send'); | |
tyoshino (SeeGerritForStatus)
2014/10/29 04:41:07
POST
Paritosh Kumar
2014/10/29 05:08:24
Done.
| |
8 window.jsTestIsAsync = true; | |
9 | |
10 new Promise(function(resolve, reject) { | |
11 var array = new Uint8Array([0, 1, 2, 25, 45, 58, 255]); | |
12 var xhr = new XMLHttpRequest; | |
13 xhr.open("POST", "resources/post-echo-as-ascii.cgi", false); | |
tyoshino (SeeGerritForStatus)
2014/10/29 04:41:07
we're moving toward deprecating sync XHR.
https://
Paritosh Kumar
2014/10/29 05:08:24
Done.
| |
14 xhr.onreadystatechange = function() { | |
15 debug('xhr.readyState = ' + xhr.readyState + ': responseURL = ' + xh r.responseURL); | |
tyoshino (SeeGerritForStatus)
2014/10/29 04:41:07
if we switch to async xhr, this can be source of f
Paritosh Kumar
2014/10/29 05:08:24
Yes, this results in failure so shifting it in if-
| |
16 if (xhr.readyState === 4) { | |
17 resolve(xhr); | |
18 } | |
19 } | |
20 xhr.send(new DataView(array.buffer)); | |
21 }).then(function(xhr) { | |
22 window.status = xhr.status; | |
23 shouldBeEqualToString('status', '200'); | |
24 responseText = xhr.responseText; | |
25 shouldBeEqualToString('responseText', '0 1 2 25 45 58 255'); | |
26 }).catch(function(reason) { | |
27 testFailed(String(reason)); | |
28 }).then(finishJSTest, finishJSTest); | |
29 | |
30 </script> | |
31 </body> | |
32 </html> | |
OLD | NEW |