Index: LayoutTests/fast/storage/serialized-script-value.html |
diff --git a/LayoutTests/fast/storage/serialized-script-value.html b/LayoutTests/fast/storage/serialized-script-value.html |
index 87709396aac3db91d6e3e09b36bd1b32d125d8e2..30d7b8a8a3fec4087e836b192208be7a07548353 100644 |
--- a/LayoutTests/fast/storage/serialized-script-value.html |
+++ b/LayoutTests/fast/storage/serialized-script-value.html |
@@ -1,108 +1,111 @@ |
+<!doctype html> |
<html> |
- <head> |
- <script src="../../resources/js-test.js"></script> |
- <script src="../storage/resources/serialized-script-value.js"></script> |
- </head> |
- <body> |
- <script> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+<script src="../storage/resources/serialized-script-value.js"></script> |
+</head> |
+<body> |
+<script> |
function testSerialization(obj, values, oldFormat, serializeExceptionValue) { |
_testSerialization(2, obj, values, oldFormat, serializeExceptionValue); |
+ if (typeof oldFormat === "undefined" ) { |
+ debug(""); |
+ debug("Backwards compatibility with version 3 serialization."); |
+ _testSerialization(2, obj, values, forVersion(3, values), serializeExceptionValue); |
+ } |
} |
-// we only test a few cases of the "old" serialization format because |
+// 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'}}, |
- [ 0x03ff, 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 ]); |
+ [ 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'}, |
- [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6603, |
- 0x6f6f, 0x013f, 0x0353, 0x6f7a, 0x3f6f, |
- 0x5301, 0x6203, 0x7261, 0x013f, 0x0853, |
- 0x796d, 0x654e, 0x4b77, 0x7965, 0x027b]); |
+ [0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f, |
+ 0x013f, 0x0353, 0x6f7a, 0x3f6f, 0x5301, |
+ 0x6203, 0x7261, 0x013f, 0x0853, 0x796d, |
+ 0x654e, 0x4b77, 0x7965, 0x027b]); |
-testSerialization([], [0x03ff, 0x003f, 0x0041, 0x0024, 0x0000 ]); |
+testSerialization([], [0x003f, 0x0041, 0x0024, 0x0000 ]); |
testSerialization({foo: "zoo"}, |
- [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f, |
+ [0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f, |
0x013f, 0x0353, 0x6f7a, 0x7b6f, 0x0001], |
[0x0353, 0x6f66, 0x536f, 0x7a03, 0x6f6f, 0x017b]); |
testSerialization({foo: null}, |
- [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f, |
+ [0x003f, 0x3f6f, 0x5301, 0x6603, 0x6f6f, |
0x013f, 0x7b30, 0x0001], |
[0x0353, 0x6f66, 0x306f, 0x017b]); |
-testSerialization({}, [0x03ff, 0x003f, 0x7b6f, 0x0000], [0x007b]); |
+testSerialization({}, [0x003f, 0x7b6f, 0x0000], [0x007b]); |
-testSerialization(undefined, [0x03ff, 0x003f, 0x005f]); |
-testSerialization(true, [0x03ff, 0x003f, 0x0054]); |
-testSerialization(false, [0x03ff, 0x003f, 0x0046]); |
+testSerialization(undefined, [0x003f, 0x005f]); |
+testSerialization(true, [0x003f, 0x0054]); |
+testSerialization(false, [0x003f, 0x0046]); |
// Sparse array deserialization is broken. |
// See: https://bugs.webkit.org/show_bug.cgi?id=96838 |
-// testSerialization(new Array(100), [0x03ff, 0x003f, 0x6461, 0x0040, 0x0064]); |
-testSerialization(10, [0x03ff, 0x003f, 0x1449]); |
-testSerialization(-10, [0x03ff, 0x003f, 0x1349]); |
-testSerialization(Math.pow(2,30), [0x03ff, 0x003f, 0x8049, 0x8080, 0x0880]); |
-testSerialization(Math.pow(2,55), [0x03ff, 0x003f, 0x004e, 0x0000, 0x0000, |
+// testSerialization(new Array(100), [0x003f, 0x6461, 0x0040, 0x0064]); |
+testSerialization(10, [0x003f, 0x1449]); |
+testSerialization(-10, [0x003f, 0x1349]); |
+testSerialization(Math.pow(2,30), [0x003f, 0x8049, 0x8080, 0x0880]); |
+testSerialization(Math.pow(2,55), [0x003f, 0x004e, 0x0000, 0x0000, |
0x6000, 0x0043]); |
-testSerialization(1.23, [0x03ff, 0x003f, 0xae4e, 0xe147, 0x147a, 0xf3ae, 0x003f]); |
+testSerialization(1.23, [0x003f, 0xae4e, 0xe147, 0x147a, 0xf3ae, 0x003f]); |
// Exercise special cases for Int32/Uint32. |
-testSerialization( 0x7fffffff, [0x03ff, 0x003f, 0xfe49, 0xffff, 0x0fff]); |
-testSerialization(-0x80000000, [0x03ff, 0x003f, 0xff49, 0xffff, 0x0fff]); |
-testSerialization( 0x80000000, [0x03ff, 0x003f, 0x8055, 0x8080, 0x0880]); |
-testSerialization( 0xffffffff, [0x03ff, 0x003f, 0xff55, 0xffff, 0x0fff]); |
+testSerialization( 0x7fffffff, [0x003f, 0xfe49, 0xffff, 0x0fff]); |
+testSerialization(-0x80000000, [0x003f, 0xff49, 0xffff, 0x0fff]); |
+testSerialization( 0x80000000, [0x003f, 0x8055, 0x8080, 0x0880]); |
+testSerialization( 0xffffffff, [0x003f, 0xff55, 0xffff, 0x0fff]); |
-testSerialization("", [0x03ff, 0x003f, 0x0053]); |
-testSerialization("abc", [0x03ff, 0x003f, 0x0353, 0x6261, 0x0063]); |
-testSerialization({integer: 123}, [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6907, |
- 0x746e, 0x6765, 0x7265, 0x013f, 0xf649, |
- 0x7b01, 0x0001]); |
-testSerialization({string: "str"}, [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x7306, |
- 0x7274, 0x6e69, 0x3f67, 0x5301, 0x7303, |
- 0x7274, 0x017b]); |
-testSerialization({list: [1,2,3]}, [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6c04, |
- 0x7369, 0x3f74, 0x4101, 0x3f03, 0x4902, |
- 0x3f02, 0x4902, 0x3f04, 0x4902, 0x2406, |
- 0x0300, 0x017b]); |
-testSerialization(null, [0x03ff, 0x003f, 0x0030]); |
-testSerialization(/abc/, [0x03ff, 0x003f, 0x0352, 0x6261, 0x0063]); |
+testSerialization("", [0x003f, 0x0053]); |
+testSerialization("abc", [0x003f, 0x0353, 0x6261, 0x0063]); |
+testSerialization({integer: 123}, [0x003f, 0x3f6f, 0x5301, 0x6907, 0x746e, |
+ 0x6765, 0x7265, 0x013f, 0xf649, 0x7b01, |
+ 0x0001]); |
+testSerialization({string: "str"}, [0x003f, 0x3f6f, 0x5301, 0x7306, 0x7274, |
+ 0x6e69, 0x3f67, 0x5301, 0x7303, 0x7274, |
+ 0x017b]); |
+testSerialization({list: [1,2,3]}, [0x003f, 0x3f6f, 0x5301, 0x6c04, 0x7369, |
+ 0x3f74, 0x4101, 0x3f03, 0x4902, 0x3f02, |
+ 0x4902, 0x3f04, 0x4902, 0x2406, 0x0300, |
+ 0x017b]); |
+testSerialization(null, [0x003f, 0x0030]); |
+testSerialization(/abc/, [0x003f, 0x0352, 0x6261, 0x0063]); |
var innerObject = {hello: "there"}; |
var outerObject = {inner: innerObject}; |
outerObject['outer'] = innerObject; |
-testSerialization(outerObject, [0x03ff, 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, [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6805, |
- 0x6c65, 0x6f6c, 0x013f, 0x0553, 0x6874, |
- 0x7265, 0x7b65, 0x0001]); |
+testSerialization(outerObject, [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, [0x003f, 0x3f6f, 0x5301, 0x6805, 0x6c65, |
+ 0x6f6c, 0x013f, 0x0553, 0x6874, 0x7265, |
+ 0x7b65, 0x0001]); |
var unicodeObject = {a: 'a', u: String.fromCharCode(0x03B1,0x03B2), d: 42}; |
testSerialization(unicodeObject, |
- [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6101, |
- 0x013f, 0x0153, 0x3f61, 0x5301, 0x7501, |
- 0x013f, 0x0463, 0x03b1, 0x03b2, 0x013f, |
- 0x0153, 0x3f64, 0x4901, 0x7b54, 0x0003], |
+ [0x003f, 0x3f6f, 0x5301, 0x6101, 0x013f, |
+ 0x0153, 0x3f61, 0x5301, 0x7501, 0x013f, |
+ 0x0463, 0x03b1, 0x03b2, 0x013f, 0x0153, |
+ 0x3f64, 0x4901, 0x7b54, 0x0003], |
[0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6101, |
0x013f, 0x0153, 0x3f61, 0x5301, 0x7501, |
0x013f, 0x0453, 0xb1ce, 0xb2ce, 0x013f, |
0x0153, 0x3f64, 0x4901, 0x7b54, 0x0003]); |
unicodeObject.a = 'ab'; |
testSerialization(unicodeObject, |
- [0x03ff, 0x003f, 0x3f6f, 0x5301, 0x6101, |
- 0x013f, 0x0253, 0x6261, 0x013f, 0x0153, |
- 0x3f75, 0x0001, 0x0463, 0x03b1, 0x03b2, |
- 0x013f, 0x0153, 0x3f64, 0x4901, 0x7b54, |
- 0x0003], |
+ [0x003f, 0x3f6f, 0x5301, 0x6101, 0x013f, |
+ 0x0253, 0x6261, 0x013f, 0x0153, 0x3f75, |
+ 0x0001, 0x0463, 0x03b1, 0x03b2, 0x013f, |
+ 0x0153, 0x3f64, 0x4901, 0x7b54, 0x0003], |
[0x01ff, 0x003f, 0x3f6f, 0x5301, 0x6101, |
0x013f, 0x0253, 0x6261, 0x013f, 0x0153, |
0x3f75, 0x5301, 0xce04, 0xceb1, 0x3fb2, |
@@ -115,12 +118,12 @@ arrayObject['foo'] = 123; |
arrayObject['bar'] = 456; |
arrayObject[''] = null; |
testSerialization(arrayObject, |
- [0x03ff, 0x003f, 0x0041, 0x013f, 0x0153, |
- 0x3f61, 0x5401, 0x013f, 0x0153, 0x3f62, |
- 0x4601, 0x013f, 0x0353, 0x6f66, 0x3f6f, |
- 0x4901, 0x01f6, 0x013f, 0x0353, 0x6162, |
- 0x3f72, 0x4901, 0x0790, 0x013f, 0x0053, |
- 0x013f, 0x2430, 0x0005], |
+ [0x003f, 0x0041, 0x013f, 0x0153, 0x3f61, |
+ 0x5401, 0x013f, 0x0153, 0x3f62, 0x4601, |
+ 0x013f, 0x0353, 0x6f66, 0x3f6f, 0x4901, |
+ 0x01f6, 0x013f, 0x0353, 0x6162, 0x3f72, |
+ 0x4901, 0x0790, 0x013f, 0x0053, 0x013f, |
+ 0x2430, 0x0005], |
[0x02ff, 0x003f, 0x0041, 0x013f, 0x0153, // deserialize from v2 |
0x3f61, 0x5401, 0x013f, 0x0153, 0x3f62, |
0x4601, 0x013f, 0x0353, 0x6f66, 0x3f6f, |
@@ -131,13 +134,13 @@ testSerialization(arrayObject, |
arrayObject[0] = 'foo'; |
arrayObject[1] = 'bar'; |
testSerialization(arrayObject, |
- [0x03ff, 0x003f, 0x0241, 0x013f, 0x0353, |
- 0x6f66, 0x3f6f, 0x5301, 0x6203, 0x7261, |
- 0x013f, 0x0153, 0x3f61, 0x5401, 0x013f, |
- 0x0153, 0x3f62, 0x4601, 0x013f, 0x0353, |
- 0x6f66, 0x3f6f, 0x4901, 0x01f6, 0x013f, |
- 0x0353, 0x6162, 0x3f72, 0x4901, 0x0790, |
- 0x013f, 0x0053, 0x013f, 0x2430, 0x0205], |
+ [0x003f, 0x0241, 0x013f, 0x0353, 0x6f66, |
+ 0x3f6f, 0x5301, 0x6203, 0x7261, 0x013f, |
+ 0x0153, 0x3f61, 0x5401, 0x013f, 0x0153, |
+ 0x3f62, 0x4601, 0x013f, 0x0353, 0x6f66, |
+ 0x3f6f, 0x4901, 0x01f6, 0x013f, 0x0353, |
+ 0x6162, 0x3f72, 0x4901, 0x0790, 0x013f, |
+ 0x0053, 0x013f, 0x2430, 0x0205], |
[0x01ff, 0x003f, 0x0241, 0x013f, 0x0353, |
0x6f66, 0x3f6f, 0x5301, 0x6203, 0x7261, |
0x013f, 0x0153, 0x3f61, 0x5401, 0x013f, |
@@ -150,6 +153,7 @@ testSerialization(function(){}, [], null, DOMException.DATA_CLONE_ERR); |
testBlobSerialization(); |
- </script> |
- </body> |
+testFileSerialization(); |
+</script> |
+</body> |
</html> |