blob: 0189948e3313095292ece66612fc11686c267183 [file] [log] [blame]
<html>
<body>
<pre id='console'></pre>
<script type="text/javascript">
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function errorHandler(event)
{
log("FAIL: Network error. ");
if (window.testRunner)
testRunner.notifyDone();
}
var filename = "filename=preflightCacheTimeout.txt";
var xhr = new XMLHttpRequest;
xhr.onerror = errorHandler;
start = function()
{
// Temp file removed. We can start the test now.
if (xhr.readyState == xhr.DONE) {
firstRequest();
}
}
xhr.open("GET", "/resources/reset-temp-file.php?" + filename, true);
xhr.onreadystatechange = start;
xhr.send();
function firstRequest()
{
xhr.onreadystatechange = function()
{
if (xhr.readyState == xhr.DONE) {
log(xhr.responseText);
log("PASS: First request complete");
setTimeout(secondRequest, 3000); // 5 seconds
}
}
xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php?" + filename, true);
xhr.send();
}
function secondRequest()
{
xhr.onreadystatechange = function()
{
if (xhr.readyState == xhr.DONE) {
log(xhr.responseText);
log("PASS: Second request complete")
if (window.testRunner)
testRunner.notifyDone();
}
}
xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache-timeout.php?" + filename, true);
xhr.send();
}
</script>
</body>
</html>