5 <p>Test bug
13141 : XMLHttpRequest should set readyState to
0 after abort()
</p>
6 <p>Updated for bug
16989: Add send() flag checks in XmlHttpRequest
</p>
7 <p>Should see
"PASS" two times:
</p>
10 <script type=
"text/javascript">
11 function log(message
) {
12 document
.getElementById("ans").appendChild(document
.createTextNode(message
));
13 document
.getElementById("ans").appendChild(document
.createElement("br"));
16 // Used to detect if a readystate event is dispatched
17 function catchReadystateEventAbort() {
18 log("FAILED (readystate event send)");
21 function testAbortDoNotDispatchEvent(num
)
25 if (window
.XMLHttpRequest
) {
26 xhr
= new XMLHttpRequest();
29 xhr
= new ActiveXObject("Msxml2.XMLHTTP");
31 xhr
= new ActiveXObject("Microsoft.XMLHTTP");
35 xhr
.onreadystatechange = function () {
36 if (this.readyState
== num
) {
38 this.onreadystatechange
= catchReadystateEventAbort
;
40 if (this.readyState
== 0)
46 if (finishedTests
== abortToDo
.length
&& window
.testRunner
)
47 testRunner
.notifyDone();
50 xhr
.open("GET", "resources/1251.html", true);
52 // We want to be able to test in the OPENED state with the send() flag to false
53 // so do not call send in that case
58 if (window
.testRunner
) {
59 testRunner
.dumpAsText();
60 testRunner
.waitUntilDone();
63 var finishedTests
= 0;
65 var abortToDo
= ['1', '4'];
67 for (i
= 0; i
< abortToDo
.length
; i
++)
68 testAbortDoNotDispatchEvent(abortToDo
[i
]);