<html>
<body>
<p>This test that the error event is fired for XMLHttpRequests</p>
<pre id='console'></pre>
<script type="text/javascript">
    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }

    function log(message)
    {
        document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
    }

    var xhr;

    function errorHandler(evt)
    {
        log("PASS: error event fired.");
        if (window.testRunner)
            testRunner.notifyDone();
    }

    xhr = new XMLHttpRequest;
    xhr.onerror = errorHandler;
    xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-basic-denied.cgi", true);
    xhr.send();
</script>
</body>
</html>
