RESOLVED FIXED Bug 32144
Add test for WebSocket.url attribute
https://bugs.webkit.org/show_bug.cgi?id=32144
Summary Add test for WebSocket.url attribute
Fumitoshi Ukai
Reported 2009-12-03 21:23:02 PST
Add test for WebSocket.url attribute to check it correctly set to resolved URL.
Attachments
Add test for WebSocket.URL attribute. (2.93 KB, patch)
2009-12-03 21:59 PST, Fumitoshi Ukai
no flags
Fragments now make WebSocket URL parsing fail. (6.47 KB, patch)
2009-12-06 17:56 PST, Fumitoshi Ukai
ap: review+
ap: commit-queue-
Fumitoshi Ukai
Comment 1 2009-12-03 21:59:34 PST
Created attachment 44293 [details] Add test for WebSocket.URL attribute.
WebKit Review Bot
Comment 2 2009-12-03 22:04:36 PST
style-queue ran check-webkit-style on attachment 44293 [details] without any errors.
Darin Fisher (:fishd, Google)
Comment 3 2009-12-04 00:02:06 PST
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?
Alexey Proskuryakov
Comment 4 2009-12-04 14:35:17 PST
Comment on attachment 44293 [details] Add test for WebSocket.URL attribute. I suggest adding these cases to existing WebSocket url-parsing test.
Alexey Proskuryakov
Comment 5 2009-12-04 15:47:57 PST
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.
Fumitoshi Ukai
Comment 6 2009-12-06 17:56:39 PST
Created attachment 44371 [details] Fragments now make WebSocket URL parsing fail.
WebKit Review Bot
Comment 7 2009-12-06 17:57:21 PST
style-queue ran check-webkit-style on attachment 44371 [details] without any errors.
Alexey Proskuryakov
Comment 8 2009-12-07 10:32:12 PST
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.
Fumitoshi Ukai
Comment 9 2009-12-07 20:21:32 PST
Note You need to log in before you can comment on or make changes to this bug.