Add test for WebSocket.url attribute to check it correctly set to resolved URL.
Created attachment 44293 [details] Add test for WebSocket.URL attribute.
style-queue ran check-webkit-style on attachment 44293 [details] without any errors.
Comment on attachment 44293 [details] Add test for WebSocket.URL attribute. > +++ b/LayoutTests/fast/websockets/script-tests/websocket-url.js > @@ -0,0 +1,21 @@ > +description("Make sure WebSocket URL attribute is resolved URL."); > + > +var ws = new WebSocket("ws://localhost:8000"); > +shouldBe("ws.URL", '"ws://localhost:8000"'); > + > +ws = new WebSocket("ws://localhost:8000/path?"); > +shouldBe("ws.URL", '"ws://localhost:8000/path?"'); > + > +ws = new WebSocket("ws://localhost:8000/path?k=v"); > +shouldBe("ws.URL", '"ws://localhost:8000/path?k=v"'); > + > +ws = new WebSocket("ws://localhost:8000/path#fragment"); > +shouldBe("ws.URL", '"ws://localhost:8000/path#fragment"'); > + > +ws = new WebSocket("ws://localhost:8000/path/../"); > +shouldBe("ws.URL", '"ws://localhost:8000/"'); > + > +ws = new WebSocket("ws://localhost:8000/relative/../path"); > +shouldBe("ws.URL", '"ws://localhost:8000/path"'); ^^^ are these really the only interesting cases? there are loads of other interesting cases for http:// URLs, but perhaps ws:// is simpler?
Comment on attachment 44293 [details] Add test for WebSocket.URL attribute. I suggest adding these cases to existing WebSocket url-parsing test.
Comment on attachment 44293 [details] Add test for WebSocket.URL attribute. > +ws = new WebSocket("ws://localhost:8000/path#fragment"); > +shouldBe("ws.URL", '"ws://localhost:8000/path#fragment"'); The spec changed, fragments now make WebSocket URL parsing fail.
Created attachment 44371 [details] Fragments now make WebSocket URL parsing fail.
style-queue ran check-webkit-style on attachment 44371 [details] without any errors.
Comment on attachment 44371 [details] Fragments now make WebSocket URL parsing fail. // The spec says that the string passed to WebScoket constructor should be returned unchanged. This is no longer so; this comment should be removed. +shouldThrow('new WebSocket("ws://127.0.0.1/path#fragment")'); Please test empty fragment, too. r=me with these modifications.
Committed r51830: <http://trac.webkit.org/changeset/51830>