<p>Test that custom headers are not sent with OPTIONS preflight request.</p>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

function resetStatus()
{
    var req = new XMLHttpRequest;
    req.open("GET", "/resources/reset-temp-file.py?filename=access-control-preflight-headers-async-status", false);
    req.send();
}

function sendRequest()
{
    var req = new XMLHttpRequest;
    req.open("GET", "http://localhost:8000/xmlhttprequest/resources/no-custom-header.py?filename=access-control-preflight-headers-async-status");
    req.setRequestHeader("X-Custom-Header", "foobar");
    req.onerror = function() {
        document.body.appendChild(document.createTextNode("FAIL: onerror called"));
        if (window.testRunner)
            testRunner.notifyDone();
    }
    req.onload = function() {
        document.body.appendChild(document.createTextNode(req.responseText));
        if (window.testRunner)
            testRunner.notifyDone();
    }
    req.send();
}

resetStatus();
sendRequest();
</script>
