Title: [134691] trunk
Revision
134691
Author
alecfl...@chromium.org
Date
2012-11-14 16:34:38 -0800 (Wed, 14 Nov 2012)

Log Message

Add tests for explicit serialization values
https://bugs.webkit.org/show_bug.cgi?id=96818

Reviewed by Adam Barth.

Source/WebCore:

Expose direct access to the serialization/deserialization mechanisms
of SerializedScriptValue to DumpRenderTree.

* testing/Internals.cpp:
(WebCore::Internals::serializeObject):
(WebCore):
(WebCore::Internals::deserializeBuffer):
* testing/Internals.h:
(WebCore):
* testing/Internals.idl:

LayoutTests:

Make sure SerializedScriptValues are backward compatible with future changes.

* platform/chromium/fast/storage/serialized-script-value.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134690 => 134691)


--- trunk/LayoutTests/ChangeLog	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/LayoutTests/ChangeLog	2012-11-15 00:34:38 UTC (rev 134691)
@@ -1,3 +1,14 @@
+2012-11-14  Alec Flett  <alecfl...@chromium.org>
+
+        Add tests for explicit serialization values
+        https://bugs.webkit.org/show_bug.cgi?id=96818
+
+        Reviewed by Adam Barth.
+
+        Make sure SerializedScriptValues are backward compatible with future changes.
+
+        * platform/chromium/fast/storage/serialized-script-value.html: Added.
+
 2012-11-14  Dimitri Glazkov  <dglaz...@chromium.org>
 
         [Chromium] Marked more virtual/deferred/fast/images as failing.

Added: trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value-expected.txt (0 => 134691)


--- trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value-expected.txt	2012-11-15 00:34:38 UTC (rev 134691)
@@ -0,0 +1,125 @@
+
+Deserialize to {"foo":"zoo","bar":{"baz":"myNewKey"}}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"foo":"zoo","bar":{"baz":"myNewKey"}}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"foo":"zoo","bar":"myNewKey"}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"foo":"zoo","bar":"myNewKey"}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to []:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize []:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"foo":"zoo"}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"foo":"zoo"}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"foo":null}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"foo":null}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to undefined:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize undefined:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to true:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize true:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to false:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize false:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to 10:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize 10:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to -10:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize -10:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to 1073741824:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize 1073741824:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to 36028797018963970:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize 36028797018963970:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to 1.23:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize 1.23:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to "":
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize "":
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to "abc":
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize "abc":
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"integer":123}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"integer":123}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"string":"str"}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"string":"str"}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"list":[1,2,3]}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"list":[1,2,3]}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to null:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize null:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"inner":{"hello":"there"},"outer":{"hello":"there"}}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"inner":{"hello":"there"},"outer":{"hello":"there"}}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"hello":"there"}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"hello":"there"}:
+PASS bufferView.length is expectedBufferValues.length
+
+Serialize undefined:
+PASS thrownException.code is expectedException
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html (0 => 134691)


--- trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html	2012-11-15 00:34:38 UTC (rev 134691)
@@ -0,0 +1,152 @@
+<html>
+    <head>
+        <script src=""
+    </head>
+    <body>
+        <script>
+function expectBufferValue(expectedValues, buffer) {
+    expectedBufferValues = expectedValues;
+    bufferView = new Uint16Array(buffer);
+    shouldBe("bufferView.length", "expectedBufferValues.length");
+    var success = (bufferView.length == expectedBufferValues.length);
+    if (success) {
+        for (var i = 0; i < expectedValues.length; i++) {
+            if (expectedValues[i] != bufferView[i]) {
+                testFailed("ArrayBufferViews differ at index " + i + ". Should be " + expectedValues[i] + ". Was " + view[i]);
+                success = false;
+                break;
+            }
+        }
+    }
+
+    if (!success) {
+        // output the full buffer for adding back into the test
+        var output = [];
+        for (i = 0; i < bufferView.length; i++) {
+            var hexVal = bufferView[i].toString(16);
+            if (hexVal.length < 4) {
+                hexVal = "0000".slice(hexVal.length) + hexVal;
+            }
+            output.push("0x" + hexVal);
+        }
+        debug("Actual buffer: [" + output.join(", ") + "]");
+    }
+}
+
+function makeBuffer(serializedValues) {
+    var bufferView = new Uint16Array(new ArrayBuffer(serializedValues.length * 2));
+    for (var i = 0; i < serializedValues.length; i++) {
+        bufferView[i] = serializedValues[i];
+    }
+    return bufferView.buffer;
+}
+
+
+function testSerialization(obj, values, oldFormat, serializeExceptionValue) {
+    debug("");
+
+    if (!serializeExceptionValue) {
+        self.obj = obj;
+        debug("Deserialize to " + JSON.stringify(obj) + ":");
+        self.newObj = internals.deserializeBuffer(makeBuffer(values));
+        shouldBe("JSON.stringify(newObj)", "JSON.stringify(obj)");
+
+        if (oldFormat) {
+            self.newObj = internals.deserializeBuffer(makeBuffer(oldFormat));
+            shouldBe("JSON.stringify(newObj)", "JSON.stringify(obj)");
+        }
+    }
+
+    debug("Serialize " + JSON.stringify(obj) + ":");
+    try {
+        var serialized = internals.serializeObject(obj);
+        if (serializeExceptionValue) {
+            testFailed("Should have thrown an exception of type ", serializeExceptionValue);
+        }
+    } catch(e) {
+        if (!serializeExceptionValue) {
+            testFailed("Threw exception " + e);
+            return;
+        } else {
+            self.thrownException = e;
+            self.expectedException = serializeExceptionValue;
+            shouldBe("thrownException.code", "expectedException");
+            return;
+        }
+    }
+    expectBufferValue(values, serialized);
+}
+
+// we only test a few cases of the "old" serialization format because
+// that is all that was left around from previous tests. Those values
+// are only persisted out in the world in IndexedDB stores that were
+// written with implementations built before mid-2011.
+testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
+                  [ 0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603,
+                    0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f,
+                    0x5301, 0x6203, 0x7261, 0x013f, 0x3f6f,
+                    0x5302, 0x6203, 0x7a61, 0x023f, 0x0853,
+                    0x796d, 0x654e, 0x4b77, 0x7965, 0x017b,
+                    0x027b ]);
+
+testSerialization({foo: 'zoo', bar: 'myNewKey'},
+                  [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603,
+                   0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f,
+                   0x5301, 0x6203, 0x7261, 0x013f, 0x0853,
+                   0x796d, 0x654e, 0x4b77, 0x7965, 0x027b]);
+
+testSerialization([], [0x01ff, 0x003f, 0x0041, 0x0024, 0x0000 ]);
+testSerialization({foo: "zoo"},
+                  [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f,
+                   0x013f, 0x0353, 0x6f7a, 0x7b6f, 0x0001],
+                  [0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b]);
+testSerialization({foo: null},
+                  [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f,
+                   0x013f, 0x7b30, 0x0001],
+                  [0x0353, 0x6f66, 0x306f, 0x017b]);
+testSerialization({}, [0x01ff, 0x003f, 0x7b6f, 0x0000], [0x007b]);
+
+testSerialization(undefined, [0x01ff, 0x003f, 0x005f]);
+testSerialization(true, [0x01ff, 0x003f, 0x0054]);
+testSerialization(false, [0x01ff, 0x003f, 0x0046]);
+// Sparse array deserialization is broken.
+// See: https://bugs.webkit.org/show_bug.cgi?id=96838
+// testSerialization(new Array(100), [0x01ff, 0x003f, 0x6461, 0x0040, 0x0064]);
+testSerialization(10, [0x01ff, 0x003f, 0x1449]);
+testSerialization(-10, [0x01ff, 0x003f, 0x1349]);
+testSerialization(Math.pow(2,30), [0x01ff, 0x003f, 0x8049, 0x8080, 0x0880]);
+testSerialization(Math.pow(2,55), [0x01ff, 0x003f, 0x004e, 0x0000, 0x0000,
+                                   0x6000, 0x0043]);
+testSerialization(1.23, [0x01ff, 0x003f, 0xae4e, 0xe147, 0x147a, 0xf3ae, 0x003f]);
+testSerialization("", [0x01ff, 0x003f, 0x0053]);
+testSerialization("abc", [0x01ff, 0x003f, 0x0353, 0x6261, 0x0063]);
+testSerialization({integer: 123}, [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6907,
+                                   0x746e, 0x6765, 0x7265, 0x013f, 0xf649,
+                                   0x7b01, 0x0001]);
+testSerialization({string: "str"}, [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x7306,
+                                    0x7274, 0x6e69, 0x3f67, 0x5301, 0x7303,
+                                    0x7274, 0x017b]);
+testSerialization({list: [1,2,3]}, [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6c04,
+                                    0x7369, 0x3f74, 0x4101, 0x3f03, 0x4902,
+                                    0x3f02, 0x4902, 0x3f04, 0x4902, 0x2406,
+                                    0x0300, 0x017b]);
+testSerialization(null, [0x01ff, 0x003f, 0x0030]);
+testSerialization(/abc/, [0x01ff, 0x003f, 0x0352, 0x6261, 0x0063]);
+
+var innerObject = {hello: "there"};
+var outerObject = {inner: innerObject};
+outerObject['outer'] = innerObject;
+testSerialization(outerObject, [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6905,
+                                0x6e6e, 0x7265, 0x013f, 0x3f6f, 0x5302,
+                                0x6805, 0x6c65, 0x6f6c, 0x023f, 0x0553,
+                                0x6874, 0x7265, 0x7b65, 0x3f01, 0x5302,
+                                0x6f05, 0x7475, 0x7265, 0x023f, 0x015e,
+                                0x027b]);
+testSerialization(innerObject, [0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6805,
+                                0x6c65, 0x6f6c, 0x013f, 0x0553, 0x6874,
+                                0x7265, 0x7b65, 0x0001]);
+testSerialization(function(){}, [], null, DOMException.DATA_CLONE_ERR);
+        </script>
+        <script src=""
+    </body>
+</html>

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (134690 => 134691)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-11-15 00:34:38 UTC (rev 134691)
@@ -24,9 +24,11 @@
     ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
     ??0RegExpObject@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@PAVRegExp@1@@Z
     ??0SHA1@WTF@@QAE@XZ
+    ??0String@WTF@@QAE@PB_WI@Z
     ??0StringObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z
     ??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@PBUClassInfo@1@EH@Z
     ??0ThreadCondition@WTF@@QAE@XZ
+    ??1SerializedScriptValue@WebCore@@QAE@XZ
     ??0WTFThreadData@WTF@@QAE@XZ
     ??0YarrPattern@Yarr@JSC@@QAE@ABVString@WTF@@_N1PAPBD@Z
     ??1ArrayBufferView@WTF@@UAE@XZ
@@ -125,6 +127,8 @@
     ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4HeapType@2@@Z
     ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVString@3@@Z
     ?create@RegExp@JSC@@SAPAV12@AAVJSGlobalData@2@ABVString@WTF@@W4RegExpFlags@2@@Z
+    ?create@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@ABVString@4@@Z
+    ?create@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@PAVExecState@JSC@@VJSValue@6@PAV?$Vector@V?$RefPtr@VMessagePort@WebCore@@@WTF@@$00@4@PAV?$Vector@V?$RefPtr@VArrayBuffer@WTF@@@WTF@@$00@4@W4SerializationErrorMode@2@@Z
     ?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
     ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
     ?createInterruptedExecutionException@JSC@@YAPAVJSObject@1@PAVJSGlobalData@1@@Z
@@ -170,6 +174,7 @@
     ?deletePropertyByIndex@JSProxy@JSC@@KA_NPAVJSCell@2@PAVExecState@2@I@Z
     ?deleteTable@HashTable@JSC@@QBEXXZ
     ?description@JSValue@JSC@@QBEPADXZ
+    ?deserialize@SerializedScriptValue@WebCore@@QAE?AVJSValue@JSC@@PAVExecState@4@PAVJSGlobalObject@4@PAV?$Vector@V?$RefPtr@VMessagePort@WebCore@@@WTF@@$00@WTF@@W4SerializationErrorMode@2@@Z
     ?despecifyDictionaryFunction@Structure@JSC@@QAEXAAVJSGlobalData@2@VPropertyName@2@@Z
     ?despecifyFunctionTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@VPropertyName@2@@Z
     ?destroy@JSCell@JSC@@KAXPAV12@@Z
@@ -374,6 +379,7 @@
     ?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
     ?tlsKeyCount@WTF@@YAAAJXZ
     ?tlsKeys@WTF@@YAPAKXZ
+    ?toArrayBuffer@WebCore@@YAPAVArrayBuffer@WTF@@VJSValue@JSC@@@Z
     ?toBoolean@JSString@JSC@@QBE_NXZ
     ?toDouble@MediaTime@WTF@@QBENXZ 
     ?ToExponential@DoubleToStringConverter@double_conversion@WTF@@QBE_NNHPAVStringBuilder@23@@Z
@@ -381,12 +387,14 @@
     ?toFloat@MediaTime@WTF@@QBEMXZ 
     ?toInt32@JSC@@YAHN@Z
     ?toInteger@JSValue@JSC@@QBENPAVExecState@2@@Z
+    ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVArrayBuffer@WTF@@@Z
     ?toNumberSlowCase@JSValue@JSC@@ABENPAVExecState@2@@Z
     ?toObject@JSCell@JSC@@QBEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z
     ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@PAVJSGlobalObject@2@@Z
     ?ToPrecision@DoubleToStringConverter@double_conversion@WTF@@QBE_NNHPAVStringBuilder@23@@Z
     ?ToShortest@DoubleToStringConverter@double_conversion@WTF@@QBE_NNPAVStringBuilder@23@@Z
     ?toString@JSObject@JSC@@QBEPAVJSString@2@PAVExecState@2@@Z
+    ?toString@SerializedScriptValue@WebCore@@QAE?AVString@WTF@@XZ
     ?toStringDecimal@DecimalNumber@WTF@@QBEIPAEI@Z
     ?toStringExponential@DecimalNumber@WTF@@QBEIPAEI@Z
     ?toStringSlowCase@JSValue@JSC@@ABEPAVJSString@2@PAVExecState@2@@Z

Modified: trunk/Source/WebCore/ChangeLog (134690 => 134691)


--- trunk/Source/WebCore/ChangeLog	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/WebCore/ChangeLog	2012-11-15 00:34:38 UTC (rev 134691)
@@ -1,3 +1,21 @@
+2012-11-14  Alec Flett  <alecfl...@chromium.org>
+
+        Add tests for explicit serialization values
+        https://bugs.webkit.org/show_bug.cgi?id=96818
+
+        Reviewed by Adam Barth.
+
+        Expose direct access to the serialization/deserialization mechanisms
+        of SerializedScriptValue to DumpRenderTree.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::serializeObject):
+        (WebCore):
+        (WebCore::Internals::deserializeBuffer):
+        * testing/Internals.h:
+        (WebCore):
+        * testing/Internals.idl:
+
 2012-11-14  Michael Pruett  <mich...@68k.org>
 
         IndexedDB: Add clear() method to JSC ScriptValue

Modified: trunk/Source/WebCore/WebCore.exp.in (134690 => 134691)


--- trunk/Source/WebCore/WebCore.exp.in	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-11-15 00:34:38 UTC (rev 134691)
@@ -225,15 +225,16 @@
 __ZN7WebCore13JSHTMLElement6s_infoE
 __ZN7WebCore13KeyboardEventC1ERKN3WTF12AtomicStringEbbPNS_9DOMWindowERKNS1_6StringEjbbbbb
 __ZN7WebCore13KeyboardEventC1ERKNS_21PlatformKeyboardEventEPNS_9DOMWindowE
+__ZN7WebCore13QualifiedNameD1Ev
 __ZN7WebCore13ResourceErrorC1EP7NSError
 __ZN7WebCore13ResourceErrorC1EP9__CFError
 __ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDERKN3WTF6StringEb
 __ZN7WebCore13StyledElement22setInlineStylePropertyENS_13CSSPropertyIDEdNS_17CSSPrimitiveValue9UnitTypesEb
 __ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE
 __ZN7WebCore13directoryNameERKN3WTF6StringE
+__ZN7WebCore13toArrayBufferEN3JSC7JSValueE
 __ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE
 __ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE
-__ZN7WebCore13QualifiedNameD1Ev
 __ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
 __ZN7WebCore14CachedResource16unregisterHandleEPNS_24CachedResourceHandleBaseE
 __ZN7WebCore14CachedResource9addClientEPNS_20CachedResourceClientE
@@ -244,6 +245,11 @@
 __ZN7WebCore14DocumentLoader13attachToFrameEv
 __ZN7WebCore14DocumentLoader15detachFromFrameEv
 __ZN7WebCore14DocumentLoader18addArchiveResourceEN3WTF10PassRefPtrINS_15ArchiveResourceEEE
+__ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1EEENS_22SerializationErrorModeE
+__ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueEPN3WTF6VectorINS5_6RefPtrINS_11MessagePortEEELm1EEEPNS6_INS7_INS5_11ArrayBufferEEELm1EEENS_22SerializationErrorModeE
+__ZN7WebCore21SerializedScriptValue6createERKN3WTF6StringE
+__ZN7WebCore21SerializedScriptValue8toStringEv
+__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPN3WTF11ArrayBufferE
 __ZN7WebCore14DocumentLoader21addPlugInStreamLoaderEPNS_14ResourceLoaderE
 __ZN7WebCore14DocumentLoader22addAllArchiveResourcesEPNS_7ArchiveE
 __ZN7WebCore14DocumentLoader22cancelMainResourceLoadERKNS_13ResourceErrorE

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (134690 => 134691)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2012-11-15 00:34:38 UTC (rev 134691)
@@ -73,6 +73,7 @@
     static PassRefPtr<SerializedScriptValue> create(JSContextRef, JSValueRef, JSValueRef* exception);
 
     static PassRefPtr<SerializedScriptValue> create(const String&);
+    static PassRefPtr<SerializedScriptValue> createFromWire(const String& value) { return create(value); }
     static PassRefPtr<SerializedScriptValue> adopt(Vector<uint8_t>& buffer)
     {
         return adoptRef(new SerializedScriptValue(buffer));
@@ -84,6 +85,7 @@
     static PassRefPtr<SerializedScriptValue> booleanValue(bool value);
 
     String toString();
+    String toWireString() { return toString(); }
     
     JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, MessagePortArray*, SerializationErrorMode = Throwing);
     JSValueRef deserialize(JSContextRef, JSValueRef* exception, MessagePortArray*);

Modified: trunk/Source/WebCore/testing/Internals.cpp (134690 => 134691)


--- trunk/Source/WebCore/testing/Internals.cpp	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/WebCore/testing/Internals.cpp	2012-11-15 00:34:38 UTC (rev 134691)
@@ -69,6 +69,7 @@
 #include "RuntimeEnabledFeatures.h"
 #include "SchemeRegistry.h"
 #include "SelectRuleFeatureSet.h"
+#include "SerializedScriptValue.h"
 #include "Settings.h"
 #include "ShadowRoot.h"
 #include "SpellChecker.h"
@@ -1539,4 +1540,16 @@
     frameView->setTracksRepaints(false);
 }
 
+PassRefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const
+{
+    String stringValue = value->toWireString();
+    return ArrayBuffer::create(static_cast<const void*>(stringValue.impl()->characters()), stringValue.sizeInBytes());
 }
+
+PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<ArrayBuffer> buffer) const
+{
+    String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar));
+    return SerializedScriptValue::createFromWire(value);
+}
+
+}

Modified: trunk/Source/WebCore/testing/Internals.h (134690 => 134691)


--- trunk/Source/WebCore/testing/Internals.h	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/WebCore/testing/Internals.h	2012-11-15 00:34:38 UTC (rev 134691)
@@ -29,6 +29,7 @@
 #include "ContextDestructionObserver.h"
 #include "ExceptionCodePlaceholder.h"
 #include "NodeList.h"
+#include <wtf/ArrayBuffer.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
@@ -53,6 +54,7 @@
 class ShadowRoot;
 class WebKitPoint;
 class MallocStatistics;
+class SerializedScriptValue;
 
 typedef int ExceptionCode;
 
@@ -246,6 +248,9 @@
     void startTrackingRepaints(Document*, ExceptionCode&);
     void stopTrackingRepaints(Document*, ExceptionCode&);
 
+    PassRefPtr<ArrayBuffer> serializeObject(PassRefPtr<SerializedScriptValue>) const;
+    PassRefPtr<SerializedScriptValue> deserializeBuffer(PassRefPtr<ArrayBuffer>) const;
+
 private:
     explicit Internals(Document*);
     Document* contextDocument() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (134690 => 134691)


--- trunk/Source/WebCore/testing/Internals.idl	2012-11-15 00:29:20 UTC (rev 134690)
+++ trunk/Source/WebCore/testing/Internals.idl	2012-11-15 00:34:38 UTC (rev 134691)
@@ -214,4 +214,7 @@
     //  startTrackingRepaints, repaintRectsAsText, stopTrackingRepaints.
     void startTrackingRepaints(in Document document) raises (DOMException);
     void stopTrackingRepaints(in Document document) raises (DOMException);
+
+    SerializedScriptValue deserializeBuffer(in ArrayBuffer buffer);
+    ArrayBuffer serializeObject(in SerializedScriptValue obj);
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to