1 <html><head></head><body>
3 <p>Test bug
17481: Several consecutive calls to XMLHttpRequest::open should dispatch only one readyState event
</p>
4 <p>You should see
"PASS" once:
</p>
7 <script type=
"text/javascript">
10 document
.getElementById("ans").appendChild(document
.createTextNode(message
));
11 document
.getElementById("ans").appendChild(document
.createElement("br"));
14 Array
.prototype.isEqual = function(expected
)
16 if (this.length
!= expected
.length
)
18 for (i
= 0; i
< this.length
; i
++)
19 if (this[i
] != expected
[i
])
24 if (window
.testRunner
) {
25 testRunner
.dumpAsText();
26 testRunner
.waitUntilDone();
31 if (window
.XMLHttpRequest
) {
32 xhr
= new XMLHttpRequest();
35 xhr
= new ActiveXObject("Msxml2.XMLHTTP");
37 xhr
= new ActiveXObject("Microsoft.XMLHTTP");
42 expected
= ['before first open', 1, 'before second open', 'before third open'];
44 xhr
.onreadystatechange = function () {
45 results
.push(this.readyState
);
48 results
.push('before first open');
49 xhr
.open("GET", "resources/1251.html", true);
50 results
.push('before second open');
51 xhr
.open("GET", "resources/1251.html", true);
52 results
.push('before third open');
53 xhr
.open("GET", "resources/print-headers.cgi", true);
55 log(results
.isEqual(expected
) ? "PASS" : "FAILED results : " + results
+ " expected : " + expected
);
57 if (window
.testRunner
)
58 testRunner
.notifyDone();