3 <p>Test that EventSource tries to reconnect if there's no server response when making cross-origin requests. Should print a series of PASS messages followed by DONE.</p>
4 <div id="result"></div>
7 document.getElementById("result").innerHTML += msg + "<br>";
10 if (window.testRunner) {
11 testRunner.dumpAsText();
12 testRunner.waitUntilDone();
16 if (window.testRunner)
17 testRunner.notifyDone();
21 var hosts = ["http://127.0.0.1:12345/event-stream", "http://localhost:54321/event-stream"];
23 function create_es() {
25 var es = new EventSource(hosts[count]);
28 log("FAIL: EventSource constructor threw exception: " + ex);
33 es.onerror = function () {
34 if (es.readyState == es.CONNECTING) {
35 log("PASS: got error event and readyState is CONNECTING");
41 if (es.readyState == es.CLOSED)
42 log("FAIL: got error event but readyState is CLOSED");
44 if (++count == hosts.length) {
49 setTimeout(create_es);