WebSocket: Receive binary message as ArrayBuffer
authoryutak@chromium.org <yutak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Aug 2011 08:33:38 +0000 (08:33 +0000)
committeryutak@chromium.org <yutak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Aug 2011 08:33:38 +0000 (08:33 +0000)
commitb9a26b7615c223b5adeb1acaf4eb1d01e0b681cc
tree6218d9a8558079c9e3d7428693aeefd0832ba365
parent6ff57800c43f4b3e83971f54164ac5c7019a8d7c
WebSocket: Receive binary message as ArrayBuffer
https://bugs.webkit.org/show_bug.cgi?id=67180

Reviewed by Kent Tamura.

Source/WebCore:

Tests: http/tests/websocket/tests/hybi/receive-arraybuffer.html
       http/tests/websocket/tests/hybi/workers/receive-arraybuffer.html

* bindings/js/JSMessageEventCustom.cpp:
(WebCore::JSMessageEvent::data): Convert ArrayBuffer to JSValue.
* bindings/v8/custom/V8MessageEventCustom.cpp:
(WebCore::V8MessageEvent::dataAccessorGetter): Convert ArrayBuffer to v8::Value.
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::MessageEvent):
* dom/MessageEvent.h:
Added DataTypeArrayBuffer and ArrayBuffer-related functions.
(WebCore::MessageEvent::create):
(WebCore::MessageEvent::dataAsArrayBuffer):
* websockets/WebSocket.cpp:
(WebCore::WebSocket::didReceiveBinaryData):
Construct an ArrayBuffer from binaryData and raise MessageEvent.

LayoutTests:

* http/tests/websocket/tests/hybi/receive-arraybuffer-expected.txt: Added.
* http/tests/websocket/tests/hybi/receive-arraybuffer.html:
Added. Connect to binary-frames_wsh.py (which is also used from receive-blob.html) and
check the content of MessageEvent's data attribute.
* http/tests/websocket/tests/hybi/receive-blob.html:
Update function names to match ones in receive-arraybuffer.html.
* http/tests/websocket/tests/hybi/workers/receive-arraybuffer-expected.txt: Added.
* http/tests/websocket/tests/hybi/workers/receive-arraybuffer.html: Added.
* http/tests/websocket/tests/hybi/workers/resources/receive-arraybuffer.js: Added.
* http/tests/websocket/tests/hybi/workers/resources/receive-blob.js:
Same as receive-blob.html above.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/websocket/tests/hybi/receive-arraybuffer-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/receive-arraybuffer.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/receive-blob.html
LayoutTests/http/tests/websocket/tests/hybi/workers/receive-arraybuffer-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/workers/receive-arraybuffer.html [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/workers/resources/receive-arraybuffer.js [new file with mode: 0644]
LayoutTests/http/tests/websocket/tests/hybi/workers/resources/receive-blob.js
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSMessageEventCustom.cpp
Source/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp
Source/WebCore/dom/MessageEvent.cpp
Source/WebCore/dom/MessageEvent.h
Source/WebCore/websockets/WebSocket.cpp