Commit faf281d9 authored by oliver@apple.com's avatar oliver@apple.com

Fix fast/storage/serialized script value, and add new tests for Map and Set

https://bugs.webkit.org/show_bug.cgi?id=120688

Reviewed by Steve Falkenburg.

Update for new version number, and adding binary tests for Map and Set
serialisation

* fast/storage/serialized-script-value.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@155051 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 93de7e7c
2013-09-04 Oliver Hunt <oliver@apple.com>
Fix fast/storage/serialized script value, and add new tests for Map and Set
https://bugs.webkit.org/show_bug.cgi?id=120688
Reviewed by Steve Falkenburg.
Update for new version number, and adding binary tests for Map and Set
serialisation
* fast/storage/serialized-script-value.html:
2013-09-04 Danilo Cesar Lemes de Paula <danilo.cesar@collabora.co.uk>
[GTK] add support for subtitles on webkit2GTK
......@@ -17,7 +17,7 @@ function testSerialization(obj, values, oldFormat, serializeExceptionValue) {
testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x05, 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,
......@@ -43,7 +43,7 @@ testSerialization({foo: 'zoo', bar: {baz: 'myNewKey'}},
testSerialization({foo: 'zoo', bar: 'myNewKey'},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x05, 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,
......@@ -65,7 +65,7 @@ testSerialization({foo: 'zoo', bar: 'myNewKey'},
testSerialization([],
[
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x00, 0xff, 0xff, 0xff, 0xff
],
[
......@@ -74,7 +74,7 @@ testSerialization([],
]);
testSerialization({foo: "zoo"},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x05, 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
......@@ -87,7 +87,7 @@ testSerialization({foo: "zoo"},
]);
testSerialization({foo: null},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x02, 0x03, 0x00, 0x00,
0x00, 0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x04,
0xff, 0xff, 0xff, 0xff
],
......@@ -99,7 +99,7 @@ testSerialization({foo: null},
testSerialization({},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
0x05, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff, 0xff,
0xff
],
[
......@@ -109,7 +109,7 @@ testSerialization({},
testSerialization(undefined,
[
0x04, 0x00, 0x00, 0x00, 0x03
0x05, 0x00, 0x00, 0x00, 0x03
],
[
0x03, 0x00, 0x00, 0x00, 0x03
......@@ -123,14 +123,14 @@ testSerialization(true,
]);
testSerialization(false,
[
0x04, 0x00, 0x00, 0x00, 0x08
0x05, 0x00, 0x00, 0x00, 0x08
],
[
0x03, 0x00, 0x00, 0x00, 0x08
]);
testSerialization(new Array(100),
[
0x04, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x01, 0x64, 0x00, 0x00,
0x00, 0xff, 0xff, 0xff, 0xff
],
[
......@@ -139,7 +139,7 @@ testSerialization(new Array(100),
]);
testSerialization(10,
[
0x04, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x0a, 0x00, 0x00,
0x00
],
[
......@@ -148,7 +148,7 @@ testSerialization(10,
]);
testSerialization(-10,
[
0x04, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
0x05, 0x00, 0x00, 0x00, 0x05, 0xf6, 0xff, 0xff,
0xff
],
[
......@@ -157,7 +157,7 @@ testSerialization(-10,
]);
testSerialization(Math.pow(2,30),
[
0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x40
],
[
......@@ -166,7 +166,7 @@ testSerialization(Math.pow(2,30),
]);
testSerialization(Math.pow(2,55),
[
0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x60, 0x43,
],
[
......@@ -175,7 +175,7 @@ testSerialization(Math.pow(2,55),
]);
testSerialization(1.23,
[
0x04, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
0x05, 0x00, 0x00, 0x00, 0x0a, 0xae, 0x47, 0xe1,
0x7a, 0x14, 0xae, 0xf3, 0x3f
],
[
......@@ -184,14 +184,14 @@ testSerialization(1.23,
]);
testSerialization("",
[
0x04, 0x00, 0x00, 0x00, 0x11
0x05, 0x00, 0x00, 0x00, 0x11
],
[
0x03, 0x00, 0x00, 0x00, 0x11
]);
testSerialization("abc",
[
0x04, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00,
0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00
],
[
......@@ -200,7 +200,7 @@ testSerialization("abc",
]);
testSerialization({integer: 123},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x07, 0x00, 0x00,
0x05, 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
......@@ -213,7 +213,7 @@ testSerialization({integer: 123},
]);
testSerialization({string: "str"},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x06, 0x00, 0x00,
0x05, 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,
......@@ -228,7 +228,7 @@ testSerialization({string: "str"},
]);
testSerialization({list: [1,2,3]},
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00,
0x05, 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,
......@@ -247,14 +247,14 @@ testSerialization({list: [1,2,3]},
]);
testSerialization(null,
[
0x04, 0x00, 0x00, 0x00, 0x04
0x05, 0x00, 0x00, 0x00, 0x04
],
[
0x03, 0x00, 0x00, 0x00, 0x04
]);
testSerialization(/abc/,
[
0x04, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x12, 0x03, 0x00, 0x00,
0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x00,
0x00, 0x00, 0x00
],
......@@ -269,7 +269,7 @@ var outerObject = {inner: innerObject};
outerObject['outer'] = innerObject;
testSerialization(outerObject,
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
0x05, 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,
......@@ -294,7 +294,7 @@ testSerialization(outerObject,
]);
testSerialization(innerObject,
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x00,
0x05, 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,
......@@ -311,7 +311,7 @@ testSerialization(innerObject,
var unicodeObject = {a: 'a', u: String.fromCharCode(0x03B1,0x03B2), d: 42};
testSerialization(unicodeObject,
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
0x05, 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,
......@@ -329,7 +329,7 @@ testSerialization(unicodeObject,
unicodeObject.a = 'ab';
testSerialization(unicodeObject,
[
0x04, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
0x05, 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,
......@@ -355,7 +355,7 @@ arrayObject['bar'] = 456;
arrayObject[''] = null;
testSerialization(arrayObject,
[
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x05, 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,
......@@ -370,7 +370,7 @@ arrayObject[0] = 'foo';
arrayObject[1] = 'bar';
testSerialization(arrayObject,
[
0x04, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
0x05, 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,
......@@ -383,7 +383,53 @@ testSerialization(arrayObject,
0x00, 0x04, 0xff, 0xff, 0xff, 0xff
]);
var mapObject = new Map;
mapObject.set(1,2)
mapObject.set(1.5, {})
mapObject.set(mapObject, "foo")
mapObject.set("bar", new String("bar"))
mapObject.expando = {};
testSerialization(mapObject,
[
0x05, 0x00, 0x00, 0x00, 0x1e, 0x07, 0x05, 0x02,
0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xf8, 0x3f, 0x02, 0xff, 0xff, 0xff,
0xff, 0x13, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00,
0x66, 0x00, 0x6f, 0x00, 0x6f, 0x00, 0x10, 0x03,
0x00, 0x00, 0x00, 0x62, 0x00, 0x61, 0x00, 0x72,
0x00, 0x1a, 0xfe, 0xff, 0xff, 0xff, 0x01, 0x1f,
0x07, 0x00, 0x00, 0x00, 0x65, 0x00, 0x78, 0x00,
0x70, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00,
0x6f, 0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff
]);
var setObject = new Set;
setObject.add(1)
setObject.add(1.5)
setObject.add(setObject)
setObject.add("bar")
setObject.add(new String("bar"))
setObject.expando = {};
testSerialization(setObject,
[
0x05, 0x00, 0x00, 0x00, 0x1d, 0x07, 0x07, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x0a, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x13, 0x00,
0x13, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, 0x62, 0x00,
0x61, 0x00, 0x72, 0x00, 0x10, 0xfe, 0xff, 0xff, 0xff,
0x00, 0x1a, 0xfe, 0xff, 0xff, 0xff, 0x00, 0x13, 0x01,
0x1f, 0x07, 0x00, 0x00, 0x00, 0x65, 0x00, 0x78, 0x00,
0x70, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x6f,
0x00, 0x02, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff
]);
testSerialization(function(){}, [], null, DOMException.DATA_CLONE_ERR);
successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment