Bug 32144 - Add test for WebSocket.url attribute
Summary: Add test for WebSocket.url attribute
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-03 21:23 PST by Fumitoshi Ukai
Modified: 2009-12-07 20:21 PST (History)
1 user (show)

See Also:


Attachments
Add test for WebSocket.URL attribute. (2.93 KB, patch)
2009-12-03 21:59 PST, Fumitoshi Ukai
no flags Details | Formatted Diff | Diff
Fragments now make WebSocket URL parsing fail. (6.47 KB, patch)
2009-12-06 17:56 PST, Fumitoshi Ukai
ap: review+
ap: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fumitoshi Ukai 2009-12-03 21:23:02 PST
Add test for WebSocket.url attribute to check it correctly set to resolved URL.
Comment 1 Fumitoshi Ukai 2009-12-03 21:59:34 PST
Created attachment 44293 [details]
Add test for WebSocket.URL attribute.
Comment 2 WebKit Review Bot 2009-12-03 22:04:36 PST
style-queue ran check-webkit-style on attachment 44293 [details] without any errors.
Comment 3 Darin Fisher (:fishd, Google) 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?
Comment 4 Alexey Proskuryakov 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.
Comment 5 Alexey Proskuryakov 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.
Comment 6 Fumitoshi Ukai 2009-12-06 17:56:39 PST
Created attachment 44371 [details]
Fragments now make WebSocket URL parsing fail.
Comment 7 WebKit Review Bot 2009-12-06 17:57:21 PST
style-queue ran check-webkit-style on attachment 44371 [details] without any errors.
Comment 8 Alexey Proskuryakov 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.
Comment 9 Fumitoshi Ukai 2009-12-07 20:21:32 PST
Committed r51830: <http://trac.webkit.org/changeset/51830>