Log Message
[JSC] Add tests for explicit serialization values https://bugs.webkit.org/show_bug.cgi?id=104423
Patch by Michael Pruett <[email protected]> on 2012-12-11 Reviewed by Oliver Hunt. Add tests for serialization and deserialization mechanisms of the JSC implementation of SerializedScriptValue. Similar tests already exist for the V8 implementation. .: * Source/autotools/symbols.filter: Source/WebCore: Test: platform/jsc/fast/storage/serialized-script-value.html * WebCore.exp.in: * testing/Internals.cpp: (WebCore::Internals::serializeObject): (WebCore::Internals::deserializeBuffer): Source/WebKit2: * win/WebKit2.def.in: LayoutTests: * fast/storage/resources/serialized-script-value.js: Added utility functions common to both V8 and JSC tests. * fast/storage/serialized-script-value-expected.txt: Added. * fast/storage/serialized-script-value.html: Added. * platform/chromium/TestExpectations: Excluded new JSC-specific test. * platform/chromium/fast/storage/serialized-script-value.html: Moved utility functions into fast/storage/resources/serialized-script-value.js.
Modified Paths
- trunk/ChangeLog
- trunk/LayoutTests/ChangeLog
- trunk/LayoutTests/platform/chromium/TestExpectations
- trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/WebCore.exp.in
- trunk/Source/WebCore/testing/Internals.cpp
- trunk/Source/WebKit2/ChangeLog
- trunk/Source/WebKit2/win/WebKit2.def.in
- trunk/Source/autotools/symbols.filter
Added Paths
Diff
Modified: trunk/ChangeLog (137345 => 137346)
--- trunk/ChangeLog 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/ChangeLog 2012-12-11 20:58:40 UTC (rev 137346)
@@ -1,3 +1,16 @@
+2012-12-11 Michael Pruett <[email protected]>
+
+ [JSC] Add tests for explicit serialization values
+ https://bugs.webkit.org/show_bug.cgi?id=104423
+
+ Reviewed by Oliver Hunt.
+
+ Add tests for serialization and deserialization mechanisms of
+ the JSC implementation of SerializedScriptValue. Similar tests
+ already exist for the V8 implementation.
+
+ * Source/autotools/symbols.filter:
+
2012-12-11 Carlos Garcia Campos <[email protected]>
[GTK] Install GObject DOM bindings headers in its own directory
Modified: trunk/LayoutTests/ChangeLog (137345 => 137346)
--- trunk/LayoutTests/ChangeLog 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/LayoutTests/ChangeLog 2012-12-11 20:58:40 UTC (rev 137346)
@@ -1,3 +1,20 @@
+2012-12-11 Michael Pruett <[email protected]>
+
+ [JSC] Add tests for explicit serialization values
+ https://bugs.webkit.org/show_bug.cgi?id=104423
+
+ Reviewed by Oliver Hunt.
+
+ Add tests for serialization and deserialization mechanisms of
+ the JSC implementation of SerializedScriptValue. Similar tests
+ already exist for the V8 implementation.
+
+ * fast/storage/resources/serialized-script-value.js: Added utility functions common to both V8 and JSC tests.
+ * fast/storage/serialized-script-value-expected.txt: Added.
+ * fast/storage/serialized-script-value.html: Added.
+ * platform/chromium/TestExpectations: Excluded new JSC-specific test.
+ * platform/chromium/fast/storage/serialized-script-value.html: Moved utility functions into fast/storage/resources/serialized-script-value.js.
+
2012-12-11 Dirk Pranke <[email protected]>
nrwt isn't rejecting unrecognized expectations
Added: trunk/LayoutTests/fast/storage/resources/serialized-script-value.js (0 => 137346)
--- trunk/LayoutTests/fast/storage/resources/serialized-script-value.js (rev 0)
+++ trunk/LayoutTests/fast/storage/resources/serialized-script-value.js 2012-12-11 20:58:40 UTC (rev 137346)
@@ -0,0 +1,83 @@
+function expectBufferValue(bytesPerElement, expectedValues, buffer) {
+ expectedBufferValues = expectedValues;
+ var arrayClass;
+ if (bytesPerElement == 1)
+ arrayClass = Uint8Array;
+ else
+ arrayClass = Uint16Array;
+ bufferView = new arrayClass(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 " + bufferView[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 < bytesPerElement * 2) {
+ hexVal = "0000".slice(hexVal.length, bytesPerElement * 2) + hexVal;
+ }
+ output.push("0x" + hexVal);
+ }
+ debug("Actual buffer: [" + output.join(", ") + "]");
+ }
+}
+
+function makeBuffer(bytesPerElement, serializedValues) {
+ var arrayClass;
+ if (bytesPerElement == 1)
+ arrayClass = Uint8Array;
+ else
+ arrayClass = Uint16Array;
+
+ var bufferView = new arrayClass(new ArrayBuffer(serializedValues.length * bytesPerElement));
+ for (var i = 0; i < serializedValues.length; i++) {
+ bufferView[i] = serializedValues[i];
+ }
+ return bufferView.buffer;
+}
+
+
+function _testSerialization(bytesPerElement, obj, values, oldFormat, serializeExceptionValue) {
+ debug("");
+
+ if (!serializeExceptionValue) {
+ self.obj = obj;
+ debug("Deserialize to " + JSON.stringify(obj) + ":");
+ self.newObj = internals.deserializeBuffer(makeBuffer(bytesPerElement, values));
+ shouldBe("JSON.stringify(newObj)", "JSON.stringify(obj)");
+
+ if (oldFormat) {
+ self.newObj = internals.deserializeBuffer(makeBuffer(bytesPerElement, 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(bytesPerElement, values, serialized);
+}
Added: trunk/LayoutTests/fast/storage/serialized-script-value-expected.txt (0 => 137346)
--- trunk/LayoutTests/fast/storage/serialized-script-value-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/storage/serialized-script-value-expected.txt 2012-12-11 20:58:40 UTC (rev 137346)
@@ -0,0 +1,137 @@
+
+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)
+Serialize {"foo":"zoo"}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"foo":null}:
+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)
+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 [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize [null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null]:
+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
+
+Deserialize to {"a":"a","u":"αβ","d":42}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"a":"a","u":"αβ","d":42}:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to {"a":"ab","u":"αβ","d":42}:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+Serialize {"a":"ab","u":"αβ","d":42}:
+PASS bufferView.length is expectedBufferValues.length
+
+Serialize undefined:
+PASS thrownException.code is expectedException
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/storage/serialized-script-value.html (0 => 137346)
--- trunk/LayoutTests/fast/storage/serialized-script-value.html (rev 0)
+++ trunk/LayoutTests/fast/storage/serialized-script-value.html 2012-12-11 20:58:40 UTC (rev 137346)
@@ -0,0 +1,207 @@
+<html>
+ <head>
+ <script src=""
+ <script src=""
+ </head>
+ <body>
+ <script>
+/*
+ See LayoutTests/platform/chromium/fast/storage/serialized-script-value.js,
+ upon which this test is based, for the corresponding test of the V8
+ serialization format.
+*/
+
+function testSerialization(obj, values, oldFormat, serializeExceptionValue) {
+ _testSerialization(1, obj, values, oldFormat, serializeExceptionValue);
+}
+
+testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
+ 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
+ 0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
+ 0x6f, 0x00, 0x03, 0x00, 0x00, 0x00, 0x62, 0x00,
+ 0x61, 0x00, 0x72, 0x00, 0x02, 0x03, 0x00, 0x00,
+ 0x00, 0x62, 0x00, 0x61, 0x00, 0x7a, 0x00, 0x10,
+ 0x08, 0x00, 0x00, 0x00, 0x6d, 0x00, 0x79, 0x00,
+ 0x4e, 0x00, 0x65, 0x00, 0x77, 0x00, 0x4b, 0x00,
+ 0x65, 0x00, 0x79, 0x00, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff
+]);
+
+testSerialization({foo: 'zoo', bar: 'myNewKey'},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
+ 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
+ 0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
+ 0x6f, 0x00, 0x03, 0x00, 0x00, 0x00, 0x62, 0x00,
+ 0x61, 0x00, 0x72, 0x00, 0x10, 0x08, 0x00, 0x00,
+ 0x00, 0x6d, 0x00, 0x79, 0x00, 0x4e, 0x00, 0x65,
+ 0x00, 0x77, 0x00, 0x4b, 0x00, 0x65, 0x00, 0x79,
+ 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+
+testSerialization([],
+[
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+testSerialization({foo: "zoo"},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
+ 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
+ 0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
+ 0x6f, 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+testSerialization({foo: null},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
+ 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x04,
+ 0xff, 0xff, 0xff, 0xff
+]);
+
+testSerialization({},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
+ 0xff
+]);
+
+testSerialization(undefined,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x03
+]);
+testSerialization(true,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x09
+]);
+testSerialization(false,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x08
+]);
+testSerialization(new Array(100),
+[
+ 0x03, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+testSerialization(10,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
+ 0x00
+]);
+testSerialization(-10,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
+ 0xff
+]);
+testSerialization(Math.pow(2,30),
+[
+ 0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x40
+]);
+testSerialization(Math.pow(2,55),
+[
+ 0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x60, 0x43,
+]);
+testSerialization(1.23,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
+ 0x7a, 0x14, 0xae, 0xf3, 0x3f
+]);
+testSerialization("",
+[
+ 0x03, 0x00, 0x00, 0x00, 0x11
+]);
+testSerialization("abc",
+[
+ 0x03, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00
+]);
+testSerialization({integer: 123},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00,
+ 0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65,
+ 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00, 0x05,
+ 0x7b, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+testSerialization({string: "str"},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x06, 0x00, 0x00,
+ 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69,
+ 0x00, 0x6e, 0x00, 0x67, 0x00, 0x10, 0x03, 0x00,
+ 0x00, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00,
+ 0xff, 0xff, 0xff, 0xff
+]);
+testSerialization({list: [1,2,3]},
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
+ 0x00, 0x6c, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74,
+ 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x07, 0x01, 0x00, 0x00, 0x00, 0x05,
+ 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x05, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff
+]);
+testSerialization(null,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x04
+]);
+testSerialization(/abc/,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x00,
+ 0x00, 0x00, 0x00
+]);
+
+var innerObject = {hello: "there"};
+var outerObject = {inner: innerObject};
+outerObject['outer'] = innerObject;
+testSerialization(outerObject,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
+ 0x00, 0x69, 0x00, 0x6e, 0x00, 0x6e, 0x00, 0x65,
+ 0x00, 0x72, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00,
+ 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c, 0x00,
+ 0x6f, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x74,
+ 0x00, 0x68, 0x00, 0x65, 0x00, 0x72, 0x00, 0x65,
+ 0x00, 0xff, 0xff, 0xff, 0xff, 0x05, 0x00, 0x00,
+ 0x00, 0x6f, 0x00, 0x75, 0x00, 0x74, 0x00, 0x65,
+ 0x00, 0x72, 0x00, 0x13, 0x01, 0xff, 0xff, 0xff,
+ 0xff
+]);
+testSerialization(innerObject,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
+ 0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c,
+ 0x00, 0x6f, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00,
+ 0x74, 0x00, 0x68, 0x00, 0x65, 0x00, 0x72, 0x00,
+ 0x65, 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+
+var unicodeObject = {a: 'a', u: String.fromCharCode(0x03B1,0x03B2), d: 42};
+testSerialization(unicodeObject,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x10, 0xfe, 0xff, 0xff, 0xff,
+ 0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x00, 0x10,
+ 0x02, 0x00, 0x00, 0x00, 0xb1, 0x03, 0xb2, 0x03,
+ 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x05, 0x2a,
+ 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+]);
+unicodeObject.a = 'ab';
+testSerialization(unicodeObject,
+[
+ 0x03, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00,
+ 0x61, 0x00, 0x62, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x75, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0xb1,
+ 0x03, 0xb2, 0x03, 0x01, 0x00, 0x00, 0x00, 0x64,
+ 0x00, 0x05, 0x2a, 0x00, 0x00, 0x00, 0xff, 0xff,
+ 0xff, 0xff
+]);
+
+testSerialization(function(){}, [], null, DOMException.DATA_CLONE_ERR);
+ </script>
+ <script src=""
+ </body>
+</html>
Modified: trunk/LayoutTests/platform/chromium/TestExpectations (137345 => 137346)
--- trunk/LayoutTests/platform/chromium/TestExpectations 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/LayoutTests/platform/chromium/TestExpectations 2012-12-11 20:58:40 UTC (rev 137346)
@@ -234,6 +234,10 @@
inspector/styles/vendor-prefixes.html [ WontFix ]
fast/css/apple-prefix.html [ WontFix ]
+# This test is specific to JSC; the V8 equivalent is
+# platform/chromium/fast/storage/serialized-script-value.html
+fast/storage/serialized-script-value.html [ WontFix ]
+
# Perf tests are really slow in debug builds and there are few benefits in
# running them.
[ Debug ] perf [ WontFix ]
Modified: trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html (137345 => 137346)
--- trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/LayoutTests/platform/chromium/fast/storage/serialized-script-value.html 2012-12-11 20:58:40 UTC (rev 137346)
@@ -1,80 +1,17 @@
<html>
<head>
<script src=""
+ <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 " + bufferView[i]);
- success = false;
- break;
- }
- }
- }
+/*
+ See LayoutTests/fast/storage/serialized-script-value.js for the
+ corresponding test of the JSC serialization format.
+*/
- 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);
+ _testSerialization(2, obj, values, oldFormat, serializeExceptionValue);
}
// we only test a few cases of the "old" serialization format because
Modified: trunk/Source/WebCore/ChangeLog (137345 => 137346)
--- trunk/Source/WebCore/ChangeLog 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/Source/WebCore/ChangeLog 2012-12-11 20:58:40 UTC (rev 137346)
@@ -1,3 +1,21 @@
+2012-12-11 Michael Pruett <[email protected]>
+
+ [JSC] Add tests for explicit serialization values
+ https://bugs.webkit.org/show_bug.cgi?id=104423
+
+ Reviewed by Oliver Hunt.
+
+ Add tests for serialization and deserialization mechanisms of
+ the JSC implementation of SerializedScriptValue. Similar tests
+ already exist for the V8 implementation.
+
+ Test: platform/jsc/fast/storage/serialized-script-value.html
+
+ * WebCore.exp.in:
+ * testing/Internals.cpp:
+ (WebCore::Internals::serializeObject):
+ (WebCore::Internals::deserializeBuffer):
+
2012-12-11 Alexis Menard <[email protected]>
Cleanup: Use consistent naming in CSSParser when dealing with the forward slash operator.
Modified: trunk/Source/WebCore/WebCore.exp.in (137345 => 137346)
--- trunk/Source/WebCore/WebCore.exp.in 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/Source/WebCore/WebCore.exp.in 2012-12-11 20:58:40 UTC (rev 137346)
@@ -254,11 +254,9 @@
__ZN7WebCore14DocumentLoader18addArchiveResourceEN3WTF10PassRefPtrINS_15ArchiveResourceEEE
__ZN7WebCore14ResourceLoader32didCancelAuthenticationChallengeERKNS_23AuthenticationChallengeE
__ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1EEENS_22SerializationErrorModeE
-__ZN7WebCore21SerializedScriptValue14createFromWireERKN3WTF6StringE
__ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueEPN3WTF6VectorINS5_6RefPtrINS_11MessagePortEEELm1EEEPNS6_INS7_INS5_11ArrayBufferEEELm1EEENS_22SerializationErrorModeE
__ZN7WebCore21SerializedScriptValue6createERKN3WTF6StringE
-__ZN7WebCore21SerializedScriptValue8toStringEv
-__ZNK7WebCore21SerializedScriptValue12toWireStringEv
+__ZN7WebCore21SerializedScriptValueC1ERN3WTF6VectorIhLm0EEE
__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPN3WTF11ArrayBufferE
__ZN7WebCore14DocumentLoader21addPlugInStreamLoaderEPNS_14ResourceLoaderE
__ZN7WebCore14DocumentLoader22addAllArchiveResourcesEPNS_7ArchiveE
Modified: trunk/Source/WebCore/testing/Internals.cpp (137345 => 137346)
--- trunk/Source/WebCore/testing/Internals.cpp 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/Source/WebCore/testing/Internals.cpp 2012-12-11 20:58:40 UTC (rev 137346)
@@ -1732,14 +1732,25 @@
PassRefPtr<ArrayBuffer> Internals::serializeObject(PassRefPtr<SerializedScriptValue> value) const
{
+#if USE(V8)
String stringValue = value->toWireString();
return ArrayBuffer::create(static_cast<const void*>(stringValue.impl()->characters()), stringValue.sizeInBytes());
+#else
+ Vector<uint8_t> bytes = value->data();
+ return ArrayBuffer::create(bytes.data(), bytes.size());
+#endif
}
PassRefPtr<SerializedScriptValue> Internals::deserializeBuffer(PassRefPtr<ArrayBuffer> buffer) const
{
+#if USE(V8)
String value(static_cast<const UChar*>(buffer->data()), buffer->byteLength() / sizeof(UChar));
return SerializedScriptValue::createFromWire(value);
+#else
+ Vector<uint8_t> bytes;
+ bytes.append(static_cast<const uint8_t*>(buffer->data()), buffer->byteLength());
+ return SerializedScriptValue::adopt(bytes);
+#endif
}
void Internals::setUsesOverlayScrollbars(bool enabled)
Modified: trunk/Source/WebKit2/ChangeLog (137345 => 137346)
--- trunk/Source/WebKit2/ChangeLog 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/Source/WebKit2/ChangeLog 2012-12-11 20:58:40 UTC (rev 137346)
@@ -1,3 +1,16 @@
+2012-12-11 Michael Pruett <[email protected]>
+
+ [JSC] Add tests for explicit serialization values
+ https://bugs.webkit.org/show_bug.cgi?id=104423
+
+ Reviewed by Oliver Hunt.
+
+ Add tests for serialization and deserialization mechanisms of
+ the JSC implementation of SerializedScriptValue. Similar tests
+ already exist for the V8 implementation.
+
+ * win/WebKit2.def.in:
+
2012-12-11 Jon Lee <[email protected]>
Initialize new web processes with list of auto-start origins for plug-ins
Modified: trunk/Source/WebKit2/win/WebKit2.def.in (137345 => 137346)
--- trunk/Source/WebKit2/win/WebKit2.def.in 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/Source/WebKit2/win/WebKit2.def.in 2012-12-11 20:58:40 UTC (rev 137346)
@@ -163,6 +163,7 @@
??0String@WTF@@QAE@PB_W@Z
??0String@WTF@@QAE@PB_WI@Z
??0String@WTF@@QAE@VASCIILiteral@1@@Z
+ ??0SerializedScriptValue@WebCore@@AAE@AAV?$Vector@E$0A@@WTF@@@Z
??1SerializedScriptValue@WebCore@@QAE@XZ
?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
@@ -177,7 +178,6 @@
?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
?create@ShadowRoot@WebCore@@SA?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@PAVElement@2@AAH@Z
- ?createFromWire@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@ABVString@4@@Z
?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
?deserialize@SerializedScriptValue@WebCore@@QAE?AVJSValue@JSC@@PAVExecState@4@PAVJSGlobalObject@4@PAV?$Vector@V?$RefPtr@VMessagePort@WebCore@@@WTF@@$00@WTF@@W4SerializationErrorMode@2@@Z
?documentState@HistoryItem@WebCore@@QBEABV?$Vector@VString@WTF@@$0A@@WTF@@XZ
@@ -300,8 +300,6 @@
?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVRange@1@@Z
?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNodeList@1@@Z
?toRange@WebCore@@YAPAVRange@1@VJSValue@JSC@@@Z
- ?toString@SerializedScriptValue@WebCore@@QAE?AVString@WTF@@XZ
- ?toWireString@SerializedScriptValue@WebCore@@QBE?AVString@WTF@@XZ
?treeScope@Node@WebCore@@QBEPAVTreeScope@2@XZ
?updateLayoutIgnorePendingStylesheets@Document@WebCore@@QAEXXZ
?userPreferredLanguages@WebCore@@YA?AV?$Vector@VString@WTF@@$0A@@WTF@@XZ
Modified: trunk/Source/autotools/symbols.filter (137345 => 137346)
--- trunk/Source/autotools/symbols.filter 2012-12-11 20:55:52 UTC (rev 137345)
+++ trunk/Source/autotools/symbols.filter 2012-12-11 20:58:40 UTC (rev 137346)
@@ -89,7 +89,6 @@
_ZN7WebCore20NodeRenderingContextD1Ev;
_ZN7WebCore21InspectorConsoleAgent28consoleMessageArgumentCountsEv;
_ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueEPN3WTF6VectorINS5_6RefPtrINS_11MessagePortEEELj1EEEPNS6_INS7_INS5_11ArrayBufferEEELj1EEENS_22SerializationErrorModeE;
-_ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELj1EEENS_22SerializationErrorModeE;
_ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE;
_ZN7WebCore22externalRepresentationEPNS_7ElementEj;
_ZN7WebCore22instrumentationForPageEPNS_4PageE;
@@ -218,13 +217,13 @@
_ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv;
_ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPN3WTF11ArrayBufferE;
_ZN7WebCore13toArrayBufferEN3JSC7JSValueE;
+_ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELj1EEENS_22SerializationErrorModeE;
+_ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1EEENS_22SerializationErrorModeE;
_ZN7WebCore21SerializedScriptValue6createEPN3JSC9ExecStateENS1_7JSValueEPN3WTF6VectorINS5_6RefPtrINS_11MessagePortEEELm1EEEPNS6_INS7_INS5_11ArrayBufferEEELm1EEENS_22SerializationErrorModeE;
-_ZN7WebCore21SerializedScriptValue14createFromWireERKN3WTF6StringE;
_ZN7WebCore21SerializedScriptValue6createERKN3WTF6StringE;
-_ZN7WebCore21SerializedScriptValue8toStringEv;
-_ZN7WebCore21SerializedScriptValue11deserializeEPN3JSC9ExecStateEPNS1_14JSGlobalObjectEPN3WTF6VectorINS6_6RefPtrINS_11MessagePortEEELm1EEENS_22SerializationErrorModeE;
+_ZN7WebCore21SerializedScriptValueC1ERN3WTF6VectorIhLj0EEE;
+_ZN7WebCore21SerializedScriptValueC1ERN3WTF6VectorIhLm0EEE;
_ZN7WebCore21SerializedScriptValueD1Ev;
-_ZNK7WebCore21SerializedScriptValue12toWireStringEv;
_ZN7WebCore16CSSParserContextC1EPNS_8DocumentERKNS_4KURLERKN3WTF6StringE;
_ZN7WebCore18StyleSheetContents11parseStringERKN3WTF6StringE;
_ZN7WebCore18StyleSheetContentsC1EPNS_15StyleRuleImportERKN3WTF6StringERKNS_16CSSParserContextE;
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-changes
