blob: c66a6102c2cfe3030704513b6d9a709eb45ec8e5 [file] [log] [blame]
<html>
<head></head>
<body>
<p> Test bug 16989 : Add send() flag checks in XmlHttpRequest </p>
<p> You should see PASS two 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"));
}
if (window.testRunner)
testRunner.dumpAsText();
var xhr;
if (window.XMLHttpRequest) {
xhr = new XMLHttpRequest();
} else {
try {
xhr = new ActiveXObject("Msxml2.XMLHTTP");
} catch (ex) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
}
// First test : test open method send() flag check
xhr.open("GET", "resources/endlessxml.php", true);
xhr.send(null);
try {
if (xhr.readyState == 1)
xhr.send(null);
log("FAILED");
} catch (e) {
// Call abort to prevent triggering some readystate events
xhr.abort();
log("PASS");
}
// Second test : test setResponseHeader method send() flag check
xhr.open("GET", "resources/endlessxml.php", true);
xhr.setRequestHeader("Test1", "Test1");
xhr.send(null);
try {
// makes sure readyState is opened (bug in Opera)
if (xhr.readyState == 1)
xhr.setRequestHeader("Test", "Test");
log("FAILED");
} catch (e) {
// Call abort to prevent triggering some readystate events
xhr.abort();
log("PASS");
}
if (window.testRunner)
testRunner.notifyDone();
</script>
</body>
</html>