[WebSocket] CloseEvent's code and reason properties support.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2011 10:16:27 +0000 (10:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2011 10:16:27 +0000 (10:16 +0000)
commit81b84fdb77d45cbf830ccd8771582da5189658e4
treeadb69e0ef1529175b7707c76a784c7e0f7d95ea2
parentcc52a15e8260833d085a9c12081fda14f236d119
[WebSocket] CloseEvent's code and reason properties support.
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: https://svn.webkit.org/repository/webkit/trunk@93393 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/close-code-and-reason-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/close-code-and-reason.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/close-code-and-reason_wsh.py [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/workers/close-code-and-reason-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/workers/close-code-and-reason.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/workers/resources/close-code-and-reason.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/websockets/CloseEvent.h
Source/WebCore/websockets/CloseEvent.idl
Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.cpp
Source/WebCore/websockets/ThreadableWebSocketChannelClientWrapper.h
Source/WebCore/websockets/WebSocket.cpp
Source/WebCore/websockets/WebSocket.h
Source/WebCore/websockets/WebSocketChannel.cpp
Source/WebCore/websockets/WebSocketChannel.h
Source/WebCore/websockets/WebSocketChannelClient.h
Source/WebCore/websockets/WorkerThreadableWebSocketChannel.cpp
Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h