Serialization of JavaScript values does not appear to respect new HTML5 Structured...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 19:08:54 +0000 (19:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2012 19:08:54 +0000 (19:08 +0000)
commit9cbbe1c4116c46fdb97cf733f11254c9cccce65c
tree1eea1775faa5c9fbbfbb83b90d40357bae6c9838
parentacc1babbe556fbd70e53cde0317cbeb28600b6ce
Serialization of JavaScript values does not appear to respect new HTML5 Structured Clone semantics
https://bugs.webkit.org/show_bug.cgi?id=65292

Patch by Christophe Dumez <christophe.dumez@intel.com> on 2012-08-23
Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Add function to construct a StringObject from a JSValue.
Similar functions already exist for NumberObject and
BooleanObject for example.

Export several symbols so address linking errors in
WebCore.

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* runtime/BooleanObject.h:
(BooleanObject):
* runtime/NumberObject.h:
(NumberObject):
(JSC):
* runtime/StringObject.cpp:
(JSC::constructString):
(JSC):
* runtime/StringObject.h:
(JSC):

Source/WebCore:

JSC now correctly serialize Boolean, Number and String objects as per
the structured clone algorithm specification. This patch reduces the
delta with the V8 implementation of SerializedScriptValue.

No new tests, already tested by fast/dom/Window/window-postmessage-clone.html

* bindings/js/SerializedScriptValue.cpp:
(WebCore):
(WebCore::CloneSerializer::dumpStringObject):
(CloneSerializer):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneDeserializer::readTerminal):

LayoutTests:

Update expected results for fast/dom/Window/window-postmessage-clone.html
now that String, Boolean and Number object are correctly serialized with
JSC.

* fast/dom/Window/window-postmessage-clone-expected.txt:
* platform/gtk/fast/dom/Window/window-postmessage-clone-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126464 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-postmessage-clone-expected.txt
LayoutTests/platform/gtk/fast/dom/Window/window-postmessage-clone-expected.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/runtime/BooleanObject.h
Source/JavaScriptCore/runtime/NumberObject.h
Source/JavaScriptCore/runtime/StringObject.cpp
Source/JavaScriptCore/runtime/StringObject.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/SerializedScriptValue.cpp