commit-queue@webkit.org | 94db534 | 2013-04-25 09:51:36 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <body> |
| 3 | <p>Test EventSource with non-HTTP protocol schemes in the URL. Should print a series of PASS messages followed by DONE.</p> |
| 4 | <script> |
| 5 | function log(msg) { |
| 6 | document.body.innerHTML += msg + "<br>"; |
| 7 | } |
| 8 | |
| 9 | if (window.testRunner) { |
| 10 | testRunner.dumpAsText(); |
| 11 | testRunner.waitUntilDone(); |
| 12 | } |
| 13 | |
| 14 | var count = 0; |
| 15 | new EventSource("ftp://127.0.0.1").onerror = |
| 16 | new EventSource("file:///etc/motd").onerror = |
| 17 | new EventSource("localhost:8080/").onerror = |
| 18 | new EventSource("tel:1234").onerror = function () { |
| 19 | if (this.readyState == EventSource.CLOSED) { |
| 20 | log("PASS: got error event and readyState is CLOSED"); |
| 21 | } else { |
| 22 | log("FAIL: got error event but readyState is not CLOSED"); |
| 23 | this.close(); |
| 24 | } |
| 25 | if (count++ == 3) { |
| 26 | log("DONE"); |
| 27 | end(); |
| 28 | } |
| 29 | }; |
| 30 | |
| 31 | function end() { |
| 32 | if (window.testRunner) |
| 33 | testRunner.notifyDone(); |
| 34 | } |
| 35 | </script> |
| 36 | </body> |
| 37 | </html> |