Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / status-after-abort.html
bloba4e26074022c210f8fd80a44bfcb011567a3f770
1 <html>
2 <body>
3 <p>Test for <a href="rdar://problem/5766352">rdar://problem/5766352</a>:
4 REGRESSION: XMLHttpRequest.abort() resets response status.
5 <div id="log"></div>
8 <script>
9 if (window.testRunner) {
10 testRunner.dumpAsText();
11 testRunner.waitUntilDone();
14 var req = null;
16 function log(message)
18 document.getElementById("log").innerHTML += message + "<br>";
21 function logStatusAndState(comment)
23 var status;
24 var statusText;
25 var readyState;
26 try
28 status = req.status;
29 } catch (ex)
31 status = "[exception]";
34 try
36 statusText = req.statusText;
37 } catch (ex)
39 statusText = "[exception]";
42 try
44 readyState = req.readyState;
45 } catch (ex)
47 readyState = "[exception]";
50 log((comment ? comment + ". ": "") + "Response status: " + status + "; statusText: '" + statusText + "'; readyState: " + readyState);
53 function callBackFunction()
55 logStatusAndState("Onreadystatechange");
57 if (req.readyState == 4)
59 log("Aborting the request...");
60 req.abort();
61 logStatusAndState("After aborting the request");
63 log("Reopening the request to check that the status is reset...");
64 req.onreadystatechange = callBackFunction;
65 req.open("GET", "foobar", true);
66 req.onreadystatechange = null;
67 req.abort();
68 log("Done.");
69 if (window.testRunner)
70 testRunner.notifyDone();
74 req = new XMLHttpRequest();
75 logStatusAndState("A newly created request");
76 req.onreadystatechange = callBackFunction;
77 log("Opening...");
78 req.open("GET","status-after-abort.html",true);
79 logStatusAndState("Opened request");
80 req.send(null);
81 logStatusAndState("Sent request");
83 </script>
85 </body>
86 </html>