OLD | NEW |
(Empty) | |
| 1 if (self.importScripts) |
| 2 importScripts("/js-test-resources/js-test.js"); |
| 3 |
| 4 description("Test that EventSource tries to reconnect if there's no server respo
nse when making cross-origin requests."); |
| 5 |
| 6 self.jsTestIsAsync = true; |
| 7 |
| 8 var count = 0; |
| 9 var hosts = ["http://127.0.0.1:12345/event-stream", "http://localhost:54321/even
t-stream"]; |
| 10 |
| 11 var es; |
| 12 |
| 13 function runTest() { |
| 14 shouldNotThrow("es = new EventSource(\"" + hosts[count] + "\")"); |
| 15 es.onerror = function () { |
| 16 if (es.readyState == es.CONNECTING) { |
| 17 testPassed("got error event and readyState is CONNECTING"); |
| 18 es.close(); |
| 19 } else |
| 20 shouldBeTrue("es.readyState !== es.CLOSED"); |
| 21 if (++count == hosts.length) { |
| 22 finishJSTest(); |
| 23 return; |
| 24 } |
| 25 setTimeout(runTest); |
| 26 }; |
| 27 } |
| 28 runTest(); |
OLD | NEW |