blob: a7020f6d9ad15fb04f8e5ad88744b5daebfd0fd5 [file] [log] [blame]
<html><head></head><body>
<p>Test bug 12914 : Trying to access XMLHttpRequest.responseText or
responseXML when they are not available should raise an exception </p>
<p>Should see "PASS" four times:</p>
<div id="ans"></div>
<script type="text/javascript">
function log(message) {
document.getElementById("ans").appendChild(document.createTextNode(message));
document.getElementById("ans").appendChild(document.createElement("br"));
}
function test(num)
{
var xhr;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (ex) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
xhr.onreadystatechange = function () {
if (this.readyState == num) {
++finishedTests;
try {
// force the evaluation for Opera
var response = this.responseText;
log("PASS");
} catch (e) {
log("FAILED");
}
}
if (finishedTests == 4 && window.testRunner)
testRunner.notifyDone();
}
xhr.open("GET", "resources/1251.html", true);
if (num != 1)
xhr.send(null);
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var finishedTests = 0;
for (i = 1; i < 5; i++) {
test(i);
}
</script>
</body></html>