summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast')
-rw-r--r--third_party/WebKit/LayoutTests/fast/storage/resources/serialized-script-value.js12
-rw-r--r--third_party/WebKit/LayoutTests/fast/storage/serialized-script-value-expected.txt90
-rw-r--r--third_party/WebKit/LayoutTests/fast/storage/serialized-script-value.html183
3 files changed, 285 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/storage/resources/serialized-script-value.js b/third_party/WebKit/LayoutTests/fast/storage/resources/serialized-script-value.js
index 7b64414..48731e8 100644
--- a/third_party/WebKit/LayoutTests/fast/storage/resources/serialized-script-value.js
+++ b/third_party/WebKit/LayoutTests/fast/storage/resources/serialized-script-value.js
@@ -46,6 +46,16 @@ function makeBuffer(bytesPerElement, serializedValues) {
return bufferView.buffer;
}
+function areValuesIdentical(a, b) {
+ function sortObject(object) {
+ if (typeof object != "object" || object === null)
+ return object;
+ return Object.keys(object).sort().map(function(key) {
+ return { key: key, value: sortObject(object[key]) };
+ });
+ }
+ return JSON.stringify(sortObject(a)) === JSON.stringify(sortObject(b));
+}
function _testSerialization(bytesPerElement, obj, values, oldFormat, serializeExceptionValue) {
debug("");
@@ -55,10 +65,12 @@ function _testSerialization(bytesPerElement, obj, values, oldFormat, serializeEx
debug("Deserialize to " + JSON.stringify(obj) + ":");
self.newObj = internals.deserializeBuffer(makeBuffer(bytesPerElement, values));
shouldBe("JSON.stringify(newObj)", "JSON.stringify(obj)");
+ shouldBeTrue("areValuesIdentical(newObj, obj)");
if (oldFormat) {
self.newObj = internals.deserializeBuffer(makeBuffer(bytesPerElement, oldFormat));
shouldBe("JSON.stringify(newObj)", "JSON.stringify(obj)");
+ shouldBeTrue("areValuesIdentical(newObj, obj)");
}
}
diff --git a/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value-expected.txt b/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value-expected.txt
index 6649859..947d5f5 100644
--- a/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value-expected.txt
@@ -1,134 +1,224 @@
Deserialize to {"foo":"zoo","bar":{"baz":"myNewKey"}}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
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)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"foo":"zoo","bar":"myNewKey"}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to []:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize []:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"foo":"zoo"}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"foo":"zoo"}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"foo":null}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"foo":null}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to undefined:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize undefined:
PASS bufferView.length is expectedBufferValues.length
Deserialize to true:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize true:
PASS bufferView.length is expectedBufferValues.length
Deserialize to false:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
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)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
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)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize 10:
PASS bufferView.length is expectedBufferValues.length
Deserialize to -10:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize -10:
PASS bufferView.length is expectedBufferValues.length
Deserialize to 1073741824:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize 1073741824:
PASS bufferView.length is expectedBufferValues.length
Deserialize to 36028797018963970:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize 36028797018963970:
PASS bufferView.length is expectedBufferValues.length
Deserialize to 1.23:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize 1.23:
PASS bufferView.length is expectedBufferValues.length
Deserialize to "":
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize "":
PASS bufferView.length is expectedBufferValues.length
Deserialize to "abc":
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize "abc":
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"integer":123}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"integer":123}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"string":"str"}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"string":"str"}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"list":[1,2,3]}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"list":[1,2,3]}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to null:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize null:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"inner":{"hello":"there"},"outer":{"hello":"there"}}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
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)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"hello":"there"}:
PASS bufferView.length is expectedBufferValues.length
Deserialize to {"a":"a","u":"αβ","d":42}:
PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
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)
+PASS areValuesIdentical(newObj, obj) is true
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
Serialize {"a":"ab","u":"αβ","d":42}:
PASS bufferView.length is expectedBufferValues.length
+Deserialize to []:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+Serialize []:
+PASS bufferView.length is expectedBufferValues.length
+
+Deserialize to ["foo","bar"]:
+PASS JSON.stringify(newObj) is JSON.stringify(obj)
+PASS areValuesIdentical(newObj, obj) is true
+Serialize ["foo","bar"]:
+PASS bufferView.length is expectedBufferValues.length
+
Serialize undefined:
PASS thrownException.code is expectedException
PASS successfullyParsed is true
diff --git a/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value.html b/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value.html
index b4f6a3c..7494a5c 100644
--- a/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value.html
+++ b/third_party/WebKit/LayoutTests/fast/storage/serialized-script-value.html
@@ -17,6 +17,18 @@ function testSerialization(obj, values, oldFormat, serializeExceptionValue) {
testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
@@ -31,6 +43,16 @@ testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
testSerialization({foo: 'zoo', bar: 'myNewKey'},
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
@@ -43,11 +65,21 @@ testSerialization({foo: 'zoo', bar: 'myNewKey'},
testSerialization([],
[
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0xff, 0xff
+],
+[
0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0xff, 0xff, 0xff, 0xff
]);
testSerialization({foo: "zoo"},
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10,
0x03, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x6f, 0x00,
@@ -55,6 +87,11 @@ testSerialization({foo: "zoo"},
]);
testSerialization({foo: null},
[
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
+ 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x04,
+ 0xff, 0xff, 0xff, 0xff
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x04,
0xff, 0xff, 0xff, 0xff
@@ -62,63 +99,113 @@ testSerialization({foo: null},
testSerialization({},
[
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
+ 0xff
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
0xff
]);
testSerialization(undefined,
[
+ 0x04, 0x00, 0x00, 0x00, 0x03
+],
+[
0x03, 0x00, 0x00, 0x00, 0x03
]);
testSerialization(true,
[
+ 0x04, 0x00, 0x00, 0x00, 0x09
+],
+[
0x03, 0x00, 0x00, 0x00, 0x09
]);
testSerialization(false,
[
+ 0x04, 0x00, 0x00, 0x00, 0x08
+],
+[
0x03, 0x00, 0x00, 0x00, 0x08
]);
testSerialization(new Array(100),
[
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
+ 0x00, 0xff, 0xff, 0xff, 0xff
+],
+[
0x03, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
0x00, 0xff, 0xff, 0xff, 0xff
]);
testSerialization(10,
[
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
+ 0x00
+],
+[
0x03, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
0x00
]);
testSerialization(-10,
[
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
+ 0xff
+],
+[
0x03, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
0xff
]);
testSerialization(Math.pow(2,30),
[
+ 0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
+ 0x40
+],
+[
0x03, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x40
]);
testSerialization(Math.pow(2,55),
[
+ 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x60, 0x43,
+],
+[
0x03, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x43,
]);
testSerialization(1.23,
[
+ 0x04, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
+ 0x7a, 0x14, 0xae, 0xf3, 0x3f
+],
+[
0x03, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
0x7a, 0x14, 0xae, 0xf3, 0x3f
]);
testSerialization("",
[
+ 0x04, 0x00, 0x00, 0x00, 0x11
+],
+[
0x03, 0x00, 0x00, 0x00, 0x11
]);
testSerialization("abc",
[
+ 0x04, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00
+],
+[
0x03, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00
]);
testSerialization({integer: 123},
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00,
0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65,
0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00, 0x05,
@@ -126,6 +213,13 @@ testSerialization({integer: 123},
]);
testSerialization({string: "str"},
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x06, 0x00, 0x00,
0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69,
0x00, 0x6e, 0x00, 0x67, 0x00, 0x10, 0x03, 0x00,
@@ -134,6 +228,15 @@ testSerialization({string: "str"},
]);
testSerialization({list: [1,2,3]},
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
0x00, 0x6c, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74,
0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -144,10 +247,18 @@ testSerialization({list: [1,2,3]},
]);
testSerialization(null,
[
+ 0x04, 0x00, 0x00, 0x00, 0x04
+],
+[
0x03, 0x00, 0x00, 0x00, 0x04
]);
testSerialization(/abc/,
[
+ 0x04, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x00,
+ 0x00, 0x00, 0x00
+],
+[
0x03, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x00,
0x00, 0x00, 0x00
@@ -158,6 +269,18 @@ var outerObject = {inner: innerObject};
outerObject['outer'] = innerObject;
testSerialization(outerObject,
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
0x00, 0x69, 0x00, 0x6e, 0x00, 0x6e, 0x00, 0x65,
0x00, 0x72, 0x00, 0x02, 0x05, 0x00, 0x00, 0x00,
@@ -171,6 +294,13 @@ testSerialization(outerObject,
]);
testSerialization(innerObject,
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
0x00, 0x68, 0x00, 0x65, 0x00, 0x6c, 0x00, 0x6c,
0x00, 0x6f, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00,
@@ -181,6 +311,14 @@ testSerialization(innerObject,
var unicodeObject = {a: 'a', u: String.fromCharCode(0x03B1,0x03B2), d: 42};
testSerialization(unicodeObject,
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
0x00, 0x61, 0x00, 0x10, 0xfe, 0xff, 0xff, 0xff,
0x00, 0x01, 0x00, 0x00, 0x00, 0x75, 0x00, 0x10,
@@ -191,6 +329,15 @@ testSerialization(unicodeObject,
unicodeObject.a = 'ab';
testSerialization(unicodeObject,
[
+ 0x04, 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
+],
+[
0x03, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
0x00, 0x61, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00,
0x61, 0x00, 0x62, 0x00, 0x01, 0x00, 0x00, 0x00,
@@ -200,6 +347,42 @@ testSerialization(unicodeObject,
0xff, 0xff
]);
+var arrayObject = [];
+arrayObject['a'] = true;
+arrayObject['b'] = false;
+arrayObject['foo'] = 123;
+arrayObject['bar'] = 456;
+arrayObject[''] = null;
+testSerialization(arrayObject,
+[
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x00, 0xfd, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00,
+ 0x00, 0x61, 0x00, 0x09, 0x01, 0x00, 0x00, 0x00,
+ 0x62, 0x00, 0x08, 0x03, 0x00, 0x00, 0x00, 0x66,
+ 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x05, 0x7b, 0x00,
+ 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x62, 0x00,
+ 0x61, 0x00, 0x72, 0x00, 0x05, 0xc8, 0x01, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff,
+ 0xff, 0xff
+]);
+
+arrayObject[0] = 'foo';
+arrayObject[1] = 'bar';
+testSerialization(arrayObject,
+[
+ 0x04, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00,
+ 0x00, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
+ 0x00, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0xfd,
+ 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x61,
+ 0x00, 0x09, 0x01, 0x00, 0x00, 0x00, 0x62, 0x00,
+ 0x08, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x05, 0x7b,
+ 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x01,
+ 0x05, 0xc8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0xff, 0xff, 0xff, 0xff
+]);
+
testSerialization(function(){}, [], null, DOMException.DATA_CLONE_ERR);
</script>
<script src="../js/resources/js-test-post.js"></script>