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