blob: ee6cf3145d50eac0bd1995937942fbab62096f3a [file] [log] [blame]
Explores the edge cases of what IDBObjectStore objects look like after a version change transaction that changed them aborts.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
connection1 = event.target.result;
objectStore1_1 = connection1.createObjectStore('objectStore1');
objectStore1_2 = connection1.createObjectStore('objectStore2');
objectStore1_2.createIndex('index', 'foo');
objectStore1_4 = connection1.createObjectStore('objectStore4');
objectStore1_4.createIndex('index', 'foo');
PASS connection1.version is 1
PASS connection1.objectStoreNames.length is 3
PASS objectStore1_1.indexNames.length is 0
PASS objectStore1_2.indexNames.length is 1
PASS objectStore1_4.indexNames.length is 1
connection1.close();
secondRequest = indexedDB.open(dbname, 2);
secondRequest.onupgradeneeded = secondUpgradeNeeded;
connection2 = event.target.result;
objectStore2_1 = secondRequest.transaction.objectStore('objectStore1');
objectStore2_2 = secondRequest.transaction.objectStore('objectStore2');
objectStore2_3 = connection2.createObjectStore('objectStore3');
objectStore2_4 = secondRequest.transaction.objectStore('objectStore4');
PASS connection2.version is 2
PASS connection2.objectStoreNames.length is 4
PASS objectStore2_1.indexNames.length is 0
PASS objectStore2_2.indexNames.length is 1
PASS objectStore2_3.indexNames.length is 0
PASS objectStore2_4.indexNames.length is 1
objectStore2_1.createIndex('index', 'foo');
objectStore2_2.deleteIndex('index');
objectStore2_3.createIndex('index', 'foo');
objectStore2_4.deleteIndex('index');
connection2.deleteObjectStore('objectStore4');
new_objectStore2_4 = connection2.createObjectStore('objectStore4');
new_objectStore2_4.createIndex('index1', 'foo');
new_objectStore2_4.createIndex('index2', 'bar');
PASS connection2.version is 2
PASS connection2.objectStoreNames.length is 4
PASS objectStore2_1.indexNames.length is 1
PASS objectStore2_2.indexNames.length is 0
PASS objectStore2_3.indexNames.length is 1
PASS new_objectStore2_4.indexNames.length is 2
secondRequest.transaction.abort();
connection2.close()
checkState():
PASS connection1.version is 1
PASS connection1.objectStoreNames.length is 3
PASS objectStore1_1.indexNames.length is 0
PASS objectStore1_2.indexNames.length is 1
PASS objectStore1_4.indexNames.length is 1
PASS connection2.version is 1
PASS connection2.objectStoreNames.length is 3
PASS objectStore2_1.indexNames.length is 0
PASS objectStore2_2.indexNames.length is 1
PASS objectStore2_3.indexNames.length is 0
PASS objectStore2_4.indexNames.length is 1
PASS new_objectStore2_4.indexNames.length is 0
PASS successfullyParsed is true
TEST COMPLETE