blob: d7a46e35cccd61255da6657e01ea32304d467509 [file] [log] [blame]
Test closing a database connection in IndexedDB.
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;
PASS Boolean(indexedDB && IDBCursor && IDBDatabase && IDBDatabaseError && IDBDatabaseException && IDBFactory && IDBIndex && IDBKeyRange && IDBObjectStore && IDBRequest && IDBTransaction) is true
indexedDB.open('transaction-after-close')
openSuccess():
db = event.target.result
request = db.setVersion('version 1')
Deleted all object stores.
store = db.createObjectStore('store')
request = store.put('x', 'y')
PASS Put success
running first transaction
currentTransaction = db.transaction(['store'], IDBTransaction.READ_WRITE)
objectStore.put('a', 'b')
db.close()
Expecting exception from db.transaction(['store'], IDBTransaction.READ_WRITE)
PASS Exception was thrown.
PASS code is IDBDatabaseException.NOT_ALLOWED_ERR
verify that we can reopen the db after calling close
indexedDB.open('transaction-after-close')
second_db = event.target.result
currentTransaction = second_db.transaction(['store'], IDBTransaction.READ_WRITE)
request = store.put('1', '2')
PASS final put success
PASS successfullyParsed is true
TEST COMPLETE