Andrew Top | 61a8495 | 2019-04-30 15:07:33 -0700 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>EventSource: BOM</title> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| 7 | </head> |
| 8 | <body> |
| 9 | <div id="log"></div> |
| 10 | <script> |
| 11 | var test = async_test(), |
| 12 | hasbeenone = false, |
| 13 | hasbeentwo = false |
| 14 | test.step(function() { |
| 15 | var source = new EventSource("resources/message.py?message=%EF%BB%BFdata%3A1%0A%0A%EF%BB%BFdata%3A2%0A%0Adata%3A3") |
| 16 | source.addEventListener("message", listener, false) |
| 17 | }) |
| 18 | function listener(e) { |
| 19 | test.step(function() { |
| 20 | if(e.data == "1") |
| 21 | hasbeenone = true |
| 22 | if(e.data == "2") |
| 23 | hasbeentwo = true |
| 24 | if(e.data == "3") { |
| 25 | assert_true(hasbeenone) |
| 26 | assert_false(hasbeentwo) |
| 27 | this.close() |
| 28 | test.done() |
| 29 | } |
| 30 | }, this) |
| 31 | } |
| 32 | </script> |
| 33 | </body> |
| 34 | </html> |
| 35 | |