Ignore:
Timestamp:
Aug 23, 2012, 12:08:54 PM (13 years ago)
Author:
[email protected]
Message:

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> 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:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r116828 r126464  
    2323
    2424#include "Error.h"
     25#include "JSGlobalObject.h"
    2526#include "PropertyNameArray.h"
    2627
     
    144145}
    145146
     147StringObject* constructString(ExecState* exec, JSGlobalObject* globalObject, JSValue string)
     148{
     149    StringObject* object = StringObject::create(exec, globalObject->stringObjectStructure());
     150    object->setInternalValue(exec->globalData(), string);
     151    return object;
     152}
     153
    146154} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.