Test IndexedDB: request result persists in setTimeout callback
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "odd-result-order.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
objectStore = db.createObjectStore('foo', { keyPath: 'key', autoIncrement: true });
index = objectStore.createIndex('foo', 'index');
openSuccess():
db = null;
db = request.result;
checkDatabaseType():
PASS db instanceof IDBDatabase is true
addRecord():
objectStore = db.transaction('foo', 'readwrite', {durability: 'relaxed'}).objectStore('foo');
data = { key: 5, index: 10 };
request = objectStore.add(data);
addSuccess():
key = null;
key = request.result;
checkAddedKey():
PASS key is data.key
objectStore = db.transaction('foo', 'readonly', {durability: 'relaxed'}).objectStore('foo');
request = objectStore.get(data.key);
getSuccess():
record = null;
record = request.result;
checkRetrievedKey():
PASS record.key is data.key
PASS record.index is data.index
deleteRecord():
objectStore = db.transaction('foo', 'readwrite', {durability: 'relaxed'}).objectStore('foo');
request = objectStore.delete(data.key);
deleteSuccess():
PASS successfullyParsed is true
TEST COMPLETE