<html>
<body>
<p>This test that the loadstart 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 loadstartHandler(evt)
    {
        log("PASS: loadstart event fired.");
    }

    function readystatechangeHandler(evt)
    {
        if (xhr.readyState == xhr.DONE) {
            if (window.testRunner)
                testRunner.notifyDone();
        }
    }

    xhr = new XMLHttpRequest;
    xhr.onloadstart = loadstartHandler;
    xhr.onreadystatechange = readystatechangeHandler;
    xhr.open("GET", "resources/get.txt", true);
    xhr.send();
</script>
</body>
</html>
