Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / web-apps / 002.html
blob40561f8dd62f3e11acc4de90276e8266e5363892
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
2 <html lang="en">
3 <head>
4 <title>multiple open()s</title>
5 </head>
6 <body>
7 <p>Script did not run.</p>
8 <script type="text/javascript">
9 if (window.testRunner)
10 testRunner.dumpAsText();
12 var p = document.getElementsByTagName('p')[0];
13 p.firstChild.data = 'FAIL: Test script failed and window.onerror not supported.';
14 window.onerror = function (error, file, line) { p.firstChild.data = 'FAIL: ' + error + ' (line ' + line + ')'; }
15 //window.XMLHttpRequest = function () { return new ActiveXObject("Microsoft.XMLHTTP"); }
16 var r = new XMLHttpRequest();
17 if (r.readyState != 0) { throw "readyState wrong after creation: should be 0, was " + r.readyState; }
18 r.open('GET', '002a.txt', false);
19 if (r.readyState != 1) { throw "readyState wrong after open(): should be 1, was " + r.readyState; }
20 r.open('GET', '002b.txt', false);
21 if (r.readyState != 1) { throw "readyState wrong after second open(): should be 1, was " + r.readyState; }
22 r.send();
23 if (r.readyState != 4) { throw "readyState wrong after sync send(): should be 4, was " + r.readyState; }
24 if (r.responseText != 'TWO') { throw "Wrong file downloaded: " + r.responseText; }
25 r.open('GET', '002c.txt', false);
26 if (r.readyState != 1) { throw "readyState wrong after third open(): should be 1, was " + r.readyState; }
27 r.send();
28 if (r.readyState != 4) { throw "readyState wrong after second sync send(): should be 4, was " + r.readyState; }
29 if (r.responseText == 'TWOTHREE') { throw "responseText not cleared by open()"; }
30 if (r.responseText != 'THREE') { throw "Wrong file downloaded: " + r.responseText; }
31 p.firstChild.data = 'PASS';
32 </script>
33 </body>
34 </html>