RESOLVED FIXED 61277
WebSocket: Add fail() to WebSocketChannel and its family
https://bugs.webkit.org/show_bug.cgi?id=61277
Summary WebSocket: Add fail() to WebSocketChannel and its family
Yuta Kitamura
Reported 2011-05-23 05:53:55 PDT
This is first part of bug 61115. Add WebSocketChannel::fail() (and ThreadableWebSocketChannel and WorkerThreadableWebSocketChannel as well), which logs an error message to JavaScript console and close the underlying channel. WebSocketChannel::fail() corresponds to "fail the WebSocket connection" mentioned in the WebSocket protocol specification: http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-00#section-6.1 Certain algorithms require the user agent to *fail the WebSocket connection*. To do so, the user agent must close the WebSocket connection, and may report the problem to the user (which would be especially useful for developers). This is same as WebSocketChannel::close() for now (except for logging). However, this will be necessary in the near future because closing handshake will change the semantics of close().
Attachments
Patch (7.18 KB, patch)
2011-05-23 06:06 PDT, Yuta Kitamura
no flags
Ready to commit (10.74 KB, patch)
2011-05-23 23:32 PDT, Yuta Kitamura
no flags
Yuta Kitamura
Comment 1 2011-05-23 06:06:35 PDT
Kent Tamura
Comment 2 2011-05-23 21:24:25 PDT
Comment on attachment 94411 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=94411&action=review > Source/WebCore/websockets/ThreadableWebSocketChannel.h:56 > + virtual void fail(const String& reason) = 0; // Log the reason text and close the connection. Will call didClose(). nit: I feel such long comment should be moved to its own line. > Source/WebCore/websockets/WebSocketChannel.h:62 > + virtual void fail(const String& reason); // Log the reason text and close the connection. Will call didClose(). > virtual void disconnect(); // Will suppress didClose(). ThreadableWebSocketChannel has these comments. So we may remove them here. > Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp:385 > + m_loaderProxy.postTaskToLoader( > + createCallbackTask(&WorkerThreadableWebSocketChannel::mainThreadFail, AllowCrossThreadAccess(m_peer), reason)); No need to break the line.
Yuta Kitamura
Comment 3 2011-05-23 22:59:07 PDT
(In reply to comment #2) > > Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp:385 > > + m_loaderProxy.postTaskToLoader( > > + createCallbackTask(&WorkerThreadableWebSocketChannel::mainThreadFail, AllowCrossThreadAccess(m_peer), reason)); > > No need to break the line. Sure. I will update the same issues occurring in the same file.
Yuta Kitamura
Comment 4 2011-05-23 23:32:52 PDT
Created attachment 94573 [details] Ready to commit
WebKit Commit Bot
Comment 5 2011-05-24 02:16:02 PDT
Comment on attachment 94573 [details] Ready to commit Clearing flags on attachment: 94573 Committed r87139: <http://trac.webkit.org/changeset/87139>
WebKit Commit Bot
Comment 6 2011-05-24 02:16:07 PDT
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.