RESOLVED FIXED 101569
[WebSocket] send() and close() should not throw an exception for an unpaired surrogate but use the replacement character
https://bugs.webkit.org/show_bug.cgi?id=101569
Summary [WebSocket] send() and close() should not throw an exception for an unpaired...
Kenichi Ishibashi
Reported 2012-11-08 02:46:36 PST
Chromium bug entry: http://code.google.com/p/chromium/issues/detail?id=159568 The WebSocket API specification has changed. When a message of send() (or a reason of close()) has unpaired surrogates, they should be replaced with replacement character (U+FFFE), instead of throwing SYNTAX_ERR. Specification diff: http://html5.org/tools/web-apps-tracker?from=7083&to=7084 How to use replacement character: http://dev.w3.org/2006/webapi/WebIDL/#dfn-obtain-unicode The current WebKit throws SYNTAX_ERR. Following w3c-test is failing because of this behavior: http://www.w3c-test.org/webapps/WebSockets/tests/submissions/Microsoft/Send-Unpaired-Surrogates.htm
Attachments
Patch (16.25 KB, patch)
2012-11-08 03:06 PST, Kenichi Ishibashi
no flags
Patch (16.24 KB, patch)
2012-11-08 04:14 PST, Kenichi Ishibashi
no flags
Patch (12.26 KB, patch)
2012-11-11 06:27 PST, Kenichi Ishibashi
no flags
Kenichi Ishibashi
Comment 1 2012-11-08 03:06:59 PST
Build Bot
Comment 2 2012-11-08 04:06:07 PST
Kenichi Ishibashi
Comment 3 2012-11-08 04:14:02 PST
Alexey Proskuryakov
Comment 4 2012-11-08 10:34:07 PST
Comment on attachment 173006 [details] Patch This is generic UTF-8 manipulation code, it should be in WTF, not in WebSocket files. Also, I'm not sure why we need two passes now.
Kenichi Ishibashi
Comment 5 2012-11-08 18:01:18 PST
(In reply to comment #4) > (From update of attachment 173006 [details]) > This is generic UTF-8 manipulation code, it should be in WTF, not in WebSocket files. I see. The code would be able to merge with String::utf8(). I'll create a separate bug entry for it. > Also, I'm not sure why we need two passes now. m_channel can be null in WebSocketChannel::close() so we need to check the length of reason in utf-8 at WebSocket::close().
Kenichi Ishibashi
Comment 6 2012-11-11 06:27:40 PST
Kenichi Ishibashi
Comment 7 2012-11-13 16:30:28 PST
Hi Alexey, Could you take another look?
Kenichi Ishibashi
Comment 8 2012-11-13 17:30:26 PST
Comment on attachment 173505 [details] Patch Thanks!
WebKit Review Bot
Comment 9 2012-11-13 17:53:07 PST
Comment on attachment 173505 [details] Patch Clearing flags on attachment: 173505 Committed r134515: <http://trac.webkit.org/changeset/134515>
WebKit Review Bot
Comment 10 2012-11-13 17:53:10 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.