OLD | NEW |
| (Empty) |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
2 <html> | |
3 <head> | |
4 <script src="/js-test-resources/js-test.js"></script> | |
5 </head> | |
6 <body> | |
7 <div id="description"></div> | |
8 <div id="console"></div> | |
9 <script type="text/javascript"> | |
10 description("WebSocket Cross Origin test"); | |
11 | |
12 window.jsTestIsAsync = true; | |
13 | |
14 var origin; | |
15 | |
16 function endTest() | |
17 { | |
18 shouldBe("origin", '"http://127.0.0.1:8000"'); | |
19 clearTimeout(timeoutID); | |
20 finishJSTest(); | |
21 } | |
22 | |
23 var url = "ws://localhost:8880/origin-test"; | |
24 debug("document.domain=" + document.domain); | |
25 debug("ws.url=" + url); | |
26 var ws = new WebSocket(url); | |
27 | |
28 ws.onopen = function() | |
29 { | |
30 debug("Connected"); | |
31 }; | |
32 | |
33 ws.onmessage = function (messageEvent) | |
34 { | |
35 origin = messageEvent.data; | |
36 ws.close(); | |
37 }; | |
38 | |
39 ws.onclose = function() | |
40 { | |
41 endTest(); | |
42 }; | |
43 | |
44 function timeOutCallback() | |
45 { | |
46 debug("Timed out in state: " + ws.readyState); | |
47 endTest(); | |
48 } | |
49 | |
50 var timeoutID = setTimeout(timeOutCallback, 3000); | |
51 | |
52 </script> | |
53 </body> | |
54 </html> | |
OLD | NEW |