Modified: trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt (122261 => 122262)
--- trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt 2012-07-10 21:13:28 UTC (rev 122261)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt 2012-07-10 21:21:34 UTC (rev 122262)
@@ -12,7 +12,9 @@
db = request.result
PASS db.version is ""
db.setVersion('1')
-db.createObjectStore('storeName')
+store = db.createObjectStore('storeName')
+This index is not used, but evaluating key path on each put() call will exercise (de)serialization:
+store.createIndex('indexName', 'dummyKeyPath')
Running tests...
@@ -581,7 +583,145 @@
PASS test_data["bar"] is result["bar"]
PASS test_data[""] is result[""]
+Testing TypedArray
+value = new Uint8Array([])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+value = new Uint8Array([0, 1, 254, 255])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Int8Array([0, 1, 254, 255])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Uint8ClampedArray([0, 1, 254, 255])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+
+value = new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+PASS is(test_data[4], result[4]) is true
+PASS is(test_data[5], result[5]) is true
+PASS is(test_data[6], result[6]) is true
+PASS is(test_data[7], result[7]) is true
+PASS is(test_data[8], result[8]) is true
+PASS is(test_data[9], result[9]) is true
+
+value = new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])
+transaction = db.transaction('storeName', 'readwrite')
+store = transaction.objectStore('storeName')
+store.put(value, 'key')
+store.get('key')
+PASS test_data !== result is true
+PASS Object.prototype.toString.call(result) is Object.prototype.toString.call(test_data)
+PASS test_data.length === result.length is true
+PASS is(test_data[0], result[0]) is true
+PASS is(test_data[1], result[1]) is true
+PASS is(test_data[2], result[2]) is true
+PASS is(test_data[3], result[3]) is true
+PASS is(test_data[4], result[4]) is true
+PASS is(test_data[5], result[5]) is true
+PASS is(test_data[6], result[6]) is true
+PASS is(test_data[7], result[7]) is true
+
+
+
Test types that can't be cloned:
transaction = db.transaction('storeName', 'readwrite')
Modified: trunk/LayoutTests/storage/indexeddb/structured-clone.html (122261 => 122262)
--- trunk/LayoutTests/storage/indexeddb/structured-clone.html 2012-07-10 21:13:28 UTC (rev 122261)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone.html 2012-07-10 21:21:34 UTC (rev 122262)
@@ -40,7 +40,9 @@
request = evalAndLog("db.setVersion('1')");
request._onerror_ = unexpectedErrorCallback;
request._onsuccess_ = function(e) {
- evalAndLog("db.createObjectStore('storeName')");
+ evalAndLog("store = db.createObjectStore('storeName')");
+ debug("This index is not used, but evaluating key path on each put() call will exercise (de)serialization:");
+ evalAndLog("store.createIndex('indexName', 'dummyKeyPath')");
var trans = request.result;
trans._onerror_ = unexpectedErrorCallback;
trans._onabort_ = unexpectedAbortCallback;
@@ -70,7 +72,8 @@
testFile,
testFileList,
testArray,
- testObject
+ testObject,
+ testTypedArray
];
function nextTest() {
@@ -505,6 +508,39 @@
});
}
+function testTypedArray(callback) {
+ debug("Testing TypedArray");
+
+ function testTypedArrayValue(string, callback) {
+ evalAndLog("value = " + string);
+ test_data = value;
+ testValue(test_data, function(result) {
+ self.result = result;
+ shouldBeTrue("test_data !== result");
+ shouldBe("Object.prototype.toString.call(result)", "Object.prototype.toString.call(test_data)");
+ shouldBeTrue("test_data.length === result.length");
+ for (i = 0; i < test_data.length; ++i) {
+ shouldBeTrue("is(test_data[" + i + "], result[" + i + "])");
+ }
+ debug("");
+ callback();
+ });
+ }
+
+ forEachWithCallback(testTypedArrayValue, [
+ "new Uint8Array([])",
+ "new Uint8Array([0, 1, 254, 255])",
+ "new Uint16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])",
+ "new Uint32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])",
+ "new Int8Array([0, 1, 254, 255])",
+ "new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF])",
+ "new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF])",
+ "new Uint8ClampedArray([0, 1, 254, 255])",
+ "new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN])",
+ "new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0, Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])"
+ ], callback);
+}
+
function testBadTypes()
{
debug("");