REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Apr 2018 23:59:50 +0000 (23:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Apr 2018 23:59:50 +0000 (23:59 +0000)
commit243addfc7d6d51c150c0470ff49e8236b88288ba
tree340352e667b02b15fc08152ed1ebf415706366de
parent741c85e6be672bb4798d4663152be9288501c84a
REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
https://bugs.webkit.org/show_bug.cgi?id=184254
<rdar://problem/39140200>

Patch by Tadeu Zagallo <tzagallo@apple.com> on 2018-04-19
Reviewed by Daniel Bates.

Source/JavaScriptCore:

Expose an extra constructor of ArrayBufferContents in order to be able to decode SerializedScriptValues.

* runtime/ArrayBuffer.h:
(JSC::ArrayBufferContents::ArrayBufferContents):

Source/WebCore:

Add a new encoding method to SerializedScriptValue that includes ArrayBuffers.

Test: workers/message-port.html

* bindings/js/SerializedScriptValue.h:
(WebCore::SerializedScriptValue::encode const):
(WebCore::SerializedScriptValue::decode):
* dom/messageports/MessageWithMessagePorts.h:
(WebCore::MessageWithMessagePorts::encode const):
(WebCore::MessageWithMessagePorts::decode):

LayoutTests:

The regression test provided with the bug report verifies that the ArrayBuffer is properly
serialized - before, the whole data object would be null.
Test case provided by Yann Cabon <ycabon@esri.com> as part of the bug report.

* workers/message-port-expected.txt: Added.
* workers/message-port.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230828 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/workers/message-port-expected.txt [new file with mode: 0644]
LayoutTests/workers/message-port.html [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/ArrayBuffer.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bindings/js/SerializedScriptValue.h
Source/WebCore/dom/messageports/MessageWithMessagePorts.h