<html>
<body>
<p>Test EventSource with non-HTTP protocol schemes in the URL. Should print a series of PASS messages followed by DONE.</p>
<script>
function log(msg) {
    document.body.innerHTML += msg + "<br>";
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var count = 0;
new EventSource("ftp://127.0.0.1").onerror =
new EventSource("file:///etc/motd").onerror =
new EventSource("localhost:8080/").onerror =
new EventSource("tel:1234").onerror = function () {
    if (this.readyState == EventSource.CLOSED) {
        log("PASS: got error event and readyState is CLOSED");
    } else {
        log("FAIL: got error event but readyState is not CLOSED");
        this.close();
    }
    if (count++ == 3) {
        log("DONE");
        end();
    }
};

function end() {
    if (window.testRunner)
        testRunner.notifyDone();
}
</script>
</body>
</html>
