tizen beta release
[profile/ivi/webkit-efl.git] / LayoutTests / http / tests / websocket / tests / hixie76 / url-parsing.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("Test WebSocket URL parsing.");
11
12 // Invalid url will fail to be parsed.
13 shouldThrow('new WebSocket("ws://javascript:a")');
14
15 // Can't use relative URLs - because spec says so, and because the scheme is different anyway.
16 shouldThrow('new WebSocket("/applet")');
17
18 // Non ws URL is not allowed.
19 shouldThrow('new WebSocket("javascript:a")');
20
21 // UA is allowed to block access to some ports, which we do.
22 shouldThrow('new WebSocket("ws://127.0.0.1:25/")');
23
24 // Resolve the url string using the resolve a Web address algorithm.
25 // Use 127.0.0.1:8880 and existing ws handler to make sure we don't receive unexpected response (so no console message appears)
26 shouldBe('(new WebSocket("ws://127.0.0.1:8880/a/../websocket/tests/hixie76/simple")).URL', '"ws://127.0.0.1:8880/websocket/tests/hixie76/simple"');
27 shouldBe('(new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/simple?")).URL', '"ws://127.0.0.1:8880/websocket/tests/hixie76/simple?"');
28 shouldBe('(new WebSocket("ws://127.0.0.1:8880/websocket/tests/hixie76/simple?k=v")).URL', '"ws://127.0.0.1:8880/websocket/tests/hixie76/simple?k=v"');
29
30 // draft-hixie-thewebsocketprotocol-60 says If /url/ has a <fragment>
31 // component, then fail the parsing Web Socket URLs, so throw a SYNTAX_ERR
32 // exception.
33 shouldThrow('new WebSocket("ws://127.0.0.1/path#")');
34 shouldThrow('new WebSocket("ws://127.0.0.1/path#fragment")');
35
36 </script>
37 <script src="../../../../js-test-resources/js-test-post.js"></script>
38 </body>
39 </html>