58 lines
1.6 KiB
HTML
58 lines
1.6 KiB
HTML
<html>
|
|
<body>
|
|
<p>Test EventSource constructor functionality. Should print a series of PASS messages followed by DONE.</p>
|
|
<div id="result"></div>
|
|
<script>
|
|
function log(msg) {
|
|
document.getElementById("result").innerHTML += msg + "<br>";
|
|
}
|
|
|
|
if (window.testRunner) {
|
|
testRunner.dumpAsText();
|
|
testRunner.waitUntilDone();
|
|
}
|
|
|
|
try {
|
|
new EventSource();
|
|
log("FAIL: no exception when trying to construct an EventSource without argument");
|
|
}
|
|
catch (ex) {
|
|
log("PASS: missing argument to EventSource constructor resulted in an exception (" + ex + ")");
|
|
}
|
|
|
|
try {
|
|
new EventSource("");
|
|
log("PASS: no exception when passing an empty string to the EventSource constructor");
|
|
}
|
|
catch (ex) {
|
|
log("FAIL: passing an empty string to the EventSource constructor resulted in an exception (" + ex + ")");
|
|
}
|
|
|
|
try {
|
|
new EventSource("http://webserver:eighty/");
|
|
log("FAIL: no exception when passing an invalid URL to the EventSource constructor");
|
|
}
|
|
catch (ex) {
|
|
log("PASS: passing an invalid URL to the EventSource constructor resulted in an exception (" + ex + ")");
|
|
}
|
|
|
|
try {
|
|
var es = new EventSource("http://127.0.0.1/", {"withCredentials": false});
|
|
es.close();
|
|
if (!es.withCredentials) {
|
|
log("PASS: no exception when passing a second argument to the EventSource constructor");
|
|
log("DONE");
|
|
} else
|
|
log("FAIL: the 'withCredentials' property is unexpectedly true");
|
|
}
|
|
catch (ex) {
|
|
log("FAIL: passing a second argument to the EventSource constructor resulted in an exception (" + ex + ")");
|
|
}
|
|
|
|
if (window.testRunner)
|
|
testRunner.notifyDone();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|