blob: f3ec714d3477ab2a23828de55a800d713d5f768f [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=preflightCache.txt";
var xhr = new XMLHttpRequest;
xhr.onerror = errorHandler;
start = function()
{
// reset-temp-file.php reports an error on failure, for debugging problems with BuildBot setup.
if (xhr.responseText.length > 0)
log(xhr.responseText);
// 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");
secondRequest();
}
}
xhr.open("PUT", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-preflight-cache.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.php?" + filename, true);
xhr.send();
}
</script>
</body>
</html>