1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
8 var console
= document
.getElementById('console');
9 console
.appendChild(document
.createTextNode(message
));
10 console
.appendChild(document
.createElement('br'));
13 function errorHandler()
15 log("Error handler: readyState = " + xhr
.readyState
);
16 var results
= window
.top
.document
.getElementById('results');
17 results
.innerHTML
= document
.body
.innerHTML
;
20 function readyStateHandlerDirectory()
22 log("ReadyState handler: readyState = " + xhr
.readyState
);
24 if (xhr
.readyState
== 4 && window
.testRunner
) {
25 var results
= window
.top
.document
.getElementById('results');
26 results
.innerHTML
= document
.body
.innerHTML
;
28 setTimeout("testRunner.notifyDone()", 0);
32 function testXHRDirectory()
35 log("Doing an XHR to a directory.");
36 xhr
= new XMLHttpRequest();
37 xhr
.onerror
= errorHandler
;
38 xhr
.onreadystatechange
= readyStateHandlerDirectory
;
41 xhr
.open("GET", "../resources/", false);
44 log("Exception: " + e
.message
);
48 function readyStateHandlerNonExistent()
50 log("ReadyState handler: readyState = " + xhr
.readyState
);
51 if (xhr
.readyState
== 4)
52 setTimeout("testXHRDirectory()", 0);
55 function testXHRNonExistentFile()
57 log("Doing an XHR to a nonexistent file.");
58 xhr
= new XMLHttpRequest();
59 xhr
.onerror
= errorHandler
;
60 xhr
.onreadystatechange
= readyStateHandlerNonExistent
;
63 xhr
.open("GET", "nonexistent.html", true);
66 log("Exception: " + e
.message
);
72 <body onload=
"testXHRNonExistentFile()">
73 <p> Bug
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=22475">22475</a>: REGRESSION: Async XMLHttpRequest never finishes on nonexistent files anymore
</p>
74 <p> In both cases, readyState
4 should be reached, and error handler should be invoked.
</p>