<html>
<body>
<p>Test async xhr preflight cache denial.  If this test passes, there should be a single PASS below.</p>
<script>
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    var console_messages = document.createElement("ul");
    document.body.appendChild(console_messages);

    function log(message)
    {
        var item = document.createElement("li");
        item.appendChild(document.createTextNode(message));
        console_messages.appendChild(item);
    }

    xhr = new XMLHttpRequest;
    xhr.onreadystatechange = processStateChange;
    try {
        xhr.open("FOO", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi");
        xhr.send();
    } catch (e) {
        log("Got exception.");
    }

    function processStateChange() {
        if (xhr.readyState == 1)
            log("PASS");
        else if (xhr.readyState == 4) {
            if (window.testRunner)
                testRunner.notifyDone();
        }
    }
</script>
</body>
</html>
