<html>
<body>
<p>Test that setRequestHeader throws a SYNTAX_ERR exception when called with an empty header name.</p>
<pre id="result">FAIL: script didn't run or raised an unexpected exception.</pre>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    var result = "FAIL: no exception was caught";
    var req = new XMLHttpRequest;
    req.open("GET", "resources/print-headers.cgi", false);

    try {
        req.setRequestHeader("", "DUMMY");
    } catch (ex) {
        result = "SUCCESS: got exception " + ex;
    }
    document.getElementById("result").textContent = result;
</script>
</body>
</html>
