blob: 82e4c4784b963d0279f3211219213d2a8e4380ab [file] [log] [blame]
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function log(text) {
document.body.appendChild(document.createTextNode(text));
document.body.appendChild(document.createElement("br"));
}
function runTest(shouldAbort) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
log("Asynchronous onreadystatechange status: " + xhr.status + ", readyState:" + xhr.readyState + ", responseText: " + xhr.responseText);
}
xhr.ontimeout = function () {
log("timeout - this should not be called.");
};
xhr.onerror = function () {
log("onerror was called.");
if (shouldAbort) // The second time this is called.
testRunner.notifyDone();
};
xhr.open("GET", "resources/url-blocking-test.js", true);
xhr.timeout = 1; // 1 ms should be too late if it is blocked.
try {
xhr.send();
} catch (error) {
log("Asynchronous error: " + error);
}
if (shouldAbort)
xhr.abort(); // This should not crash, obviously.
log("Finished runTest. Waiting for callbacks");
}
function runTests() {
runTest(false);
runTest(true);
}
</script>
</head>
<body onload="runTests()">
</body>