OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="/js-test-resources/js-test.js"></script> | 4 <script src="/js-test-resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="description"></div> | 7 <div id="description"></div> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 <script type="text/javascript"> | 9 <script type="text/javascript"> |
10 description("Test WebSocket URL parsing."); | 10 description("Test WebSocket URL parsing."); |
(...skipping 11 matching lines...) Expand all Loading... |
22 shouldThrow('new WebSocket("/applet")'); | 22 shouldThrow('new WebSocket("/applet")'); |
23 | 23 |
24 // Non ws URL is not allowed. | 24 // Non ws URL is not allowed. |
25 shouldThrow('new WebSocket("javascript:a")'); | 25 shouldThrow('new WebSocket("javascript:a")'); |
26 | 26 |
27 // UA is allowed to block access to some ports, which we do. | 27 // UA is allowed to block access to some ports, which we do. |
28 shouldThrow('new WebSocket("ws://127.0.0.1:25/")'); | 28 shouldThrow('new WebSocket("ws://127.0.0.1:25/")'); |
29 | 29 |
30 // Resolve the url string using the resolve a Web address algorithm. | 30 // Resolve the url string using the resolve a Web address algorithm. |
31 // Use 127.0.0.1:8880 and existing ws handler to make sure we don't receive unex
pected response (so no console message appears) | 31 // Use 127.0.0.1:8880 and existing ws handler to make sure we don't receive unex
pected response (so no console message appears) |
32 shouldBe('(new WebSocket("ws://127.0.0.1:8880/a/../simple")).URL', '"ws://127.0.
0.1:8880/simple"'); | 32 shouldBe('(new WebSocket("ws://127.0.0.1:8880/a/../simple")).url', '"ws://127.0.
0.1:8880/simple"'); |
33 shouldBe('(new WebSocket("ws://127.0.0.1:8880/simple?")).URL', '"ws://127.0.0.1:
8880/simple?"'); | 33 shouldBe('(new WebSocket("ws://127.0.0.1:8880/simple?")).url', '"ws://127.0.0.1:
8880/simple?"'); |
34 shouldBe('(new WebSocket("ws://127.0.0.1:8880/simple?k=v")).URL', '"ws://127.0.0
.1:8880/simple?k=v"'); | 34 shouldBe('(new WebSocket("ws://127.0.0.1:8880/simple?k=v")).url', '"ws://127.0.0
.1:8880/simple?k=v"'); |
35 | 35 |
36 // The WebSocket API specification says If /url/ has a <fragment> | 36 // The WebSocket API specification says If /url/ has a <fragment> |
37 // component, then fail the parsing WebSocket URLs, so throw a SYNTAX_ERR | 37 // component, then fail the parsing WebSocket URLs, so throw a SYNTAX_ERR |
38 // exception. | 38 // exception. |
39 shouldThrow('new WebSocket("ws://127.0.0.1/path#")'); | 39 shouldThrow('new WebSocket("ws://127.0.0.1/path#")'); |
40 shouldThrow('new WebSocket("ws://127.0.0.1/path#fragment")'); | 40 shouldThrow('new WebSocket("ws://127.0.0.1/path#fragment")'); |
41 | 41 |
42 shouldThrow('new WebSocket("ws:://127.0.0.1/")'); | 42 shouldThrow('new WebSocket("ws:://127.0.0.1/")'); |
43 | 43 |
44 </script> | 44 </script> |
45 </body> | 45 </body> |
46 </html> | 46 </html> |
OLD | NEW |