Bug 61115 - WebSocket: Refactor WebSocket error reports
Summary: WebSocket: Refactor WebSocket error reports
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Yuta Kitamura
URL:
Keywords:
Depends on: 61277 61353 61841
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-19 01:19 PDT by Yuta Kitamura
Modified: 2011-06-02 01:23 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yuta Kitamura 2011-05-19 01:19:24 PDT
Currently, the codes that report WebSocket errors to JavaScript console are scaterred among various places in WebCore. This sounds ad-hoc, and could be improved.

We could add a function to WebSocketChannel (and ThreadableWebSocketChannel, WorkerThreadableWebSocketChannel) that corresponds to "fail the WebSocket connection" algorithm in the WebSocket protocol specification (*1), like:

    class WebSocketChannel
    {
        ...
        void fail(const String& errorMessage); // Log the error to JavaScript console, and do close().
        ...
    };

... and use it in places where we need to "fail the WebSocket connection". I think this change will make the code more readable and easier to track.

(*1) In the WebSocket protocol specification, an algorithm called "fail the WebSocket connection" is defined:

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).
Comment 1 Yuta Kitamura 2011-06-02 01:23:34 PDT
This is done!