Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / recover-from-network-error.html
blobe58e0ff4f4570289af3950413abf4d6a30f02f5f
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <script>
5 var t = async_test("XMLHttpRequest: Recover from error by calling open() on the same XHR inside an error handler");
6 t.step(function() {
7 var req = new XMLHttpRequest;
8 req.open("GET", "http://localhost:0/", true);
9 req.onreadystatechange = t.step_func(function() {
10 if (req.readyState != XMLHttpRequest.DONE)
11 return;
13 assert_equals(0, req.status, "status of the first request should be 0");
15 req.onreadystatechange = t.step_func(function() {
16 if (req.readyState != XMLHttpRequest.DONE)
17 return;
19 assert_equals(200, req.status, "status of the second request should be 200");
20 t.done();
21 });
23 req.open("GET", "resources/zero-length.txt", true);
24 req.send();
25 });
26 req.send();
27 });
28 </script>