Skip to content
  • commit-queue@webkit.org's avatar
    [WebSocket] CloseEvent's code and reason properties support. · f7b7ff75
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=66362
    
    Patch by Takashi Toyoshima <toyoshim@chromium.org> on 2011-08-19
    Reviewed by Kent Tamura.
    
    Current WebSocket implementation miss code and reason properties
    in CloseEvent. This change expose incoming closing frame's code
    and reason to JavaScript API.
    
    Source/WebCore:
    
    Tests: http/tests/websocket/tests/hybi/close-code-and-reason.html
           http/tests/websocket/tests/hybi/workers/close-code-and-reason.html
    
    * websockets/CloseEvent.h:
    (WebCore::CloseEvent::initCloseEvent):
    (WebCore::CloseEvent::code):
    (WebCore::CloseEvent::reason):
    (WebCore::CloseEvent::CloseEvent):
    * websockets/CloseEvent.idl:
    Add code and reason properies.
    * websockets/ThreadableWebSocketChannelClientWrapper.cpp:
    (WebCore::ThreadableWebSocketChannelClientWrapper::didClose):
    (WebCore::ThreadableWebSocketChannelClientWrapper::didCloseCallback):
    * websockets/ThreadableWebSocketChannelClientWrapper.h:
    * websockets/WebSocket.cpp:
    (WebCore::WebSocket::didConnect):
    (WebCore::WebSocket::didClose):
    * websockets/WebSocket.h:
    Add implement to handle code and reason.
    * websockets/WebSocketChannel.cpp:
    (WebCore::WebSocketChannel::WebSocketChannel):
    (WebCore::WebSocketChannel::didCloseSocketStream):
    (WebCore::WebSocketChannel::processFrame):
    * websockets/WebSocketChannel.h:
    Add closing frame payload parser.
    * websockets/WebSocketChannelClient.h:
    (WebCore::WebSocketChannelClient::didClose):
    * websockets/WorkerThreadableWebSocketChannel.cpp:
    (WebCore::workerContextDidClose):
    (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose):
    * websockets/WorkerThreadableWebSocketChannel.h:
    Add implement to handle code and reason.
    
    LayoutTests:
    
    * http/tests/websocket/tests/hybi/close-code-and-reason-expected.txt: Added.
    * http/tests/websocket/tests/hybi/close-code-and-reason.html: Added.
    * http/tests/websocket/tests/hybi/close-code-and-reason_wsh.py: Added.
    * http/tests/websocket/tests/hybi/workers/close-code-and-reason-expected.txt: Added.
    * http/tests/websocket/tests/hybi/workers/close-code-and-reason.html: Added.
    * http/tests/websocket/tests/hybi/workers/resources/close-code-and-reason.js: Added.
    (postResult):
    (ws.onopen):
    (ws.onmessage):
    (ws.onclose):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@93393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    f7b7ff75