blob: 3d6fe7cd3fbd2d4a59eeee70389443a8e481b811 [file] [log] [blame]
Test IndexedDB transaction basics.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "transaction-basics.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
PASS self.db.objectStoreNames is []
PASS self.db.objectStoreNames.length is 0
PASS self.db.objectStoreNames.contains('storeFail') is false
request = newConnection()
indexedDB.open(dbname, 2)
addRemoveIDBObjects():
trans = event.target.transaction
PASS trans is non-null.
store = db.createObjectStore('storeFail', null)
index = store.createIndex('indexFail', 'x')
db.deleteObjectStore('storeFail')
Expecting exception from store.deleteIndex('indexFail')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The object store has been deleted.
testSetVersionAbort2():
PASS self.db.objectStoreNames is []
PASS self.db.objectStoreNames.length is 0
PASS self.db.objectStoreNames.contains('storeFail') is false
request = newConnection()
indexedDB.open(dbname, 3)
addRemoveAddIDBObjects():
trans = event.target.transaction
PASS trans is non-null.
store = db.createObjectStore('storeFail', null)
index = store.createIndex('indexFail', 'x')
db.deleteObjectStore('storeFail')
Expecting exception from store.deleteIndex('indexFail')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The object store has been deleted.
store = db.createObjectStore('storeFail', null)
index = store.createIndex('indexFail', 'x')
testSetVersionAbort3():
PASS event.cancelable is false
PASS self.db.objectStoreNames is []
PASS self.db.objectStoreNames.length is 0
PASS self.db.objectStoreNames.contains('storeFail') is false
request = newConnection()
indexedDB.open(dbname, 4)
addIDBObjects():
PASS event.cancelable is false
trans = event.target.transaction
PASS trans is non-null.
store = db.createObjectStore('storeFail', null)
index = store.createIndex('indexFail', 'x')
testInactiveAbortedTransaction():
Expecting exception from index.openCursor()
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from index.openKeyCursor()
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from index.get(0)
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from index.getKey(0)
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from index.count()
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from store.put(0, 0)
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'put' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from store.add(0, 0)
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'add' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from store.delete(0)
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from store.clear()
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'clear' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from store.get(0)
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from store.openCursor()
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.
testSetVersionAbort4():
PASS self.db.objectStoreNames is []
PASS self.db.objectStoreNames.length is 0
PASS self.db.objectStoreNames.contains('storeFail') is false
request = newConnection()
indexedDB.open(dbname, 5)
addIDBObjectsAndCommit():
trans = event.target.transaction
PASS trans is non-null.
store = db.createObjectStore('storeFail', null)
index = store.createIndex('indexFail', 'x')
testInactiveCompletedTransaction():
Expecting exception from index.openCursor()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction has finished.
Expecting exception from index.openKeyCursor()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction has finished.
Expecting exception from index.get(0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'get' on 'IDBIndex': The transaction has finished.
Expecting exception from index.getKey(0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The transaction has finished.
Expecting exception from index.count()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'count' on 'IDBIndex': The transaction has finished.
Expecting exception from store.put(0, 0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'put' on 'IDBObjectStore': The transaction has finished.
Expecting exception from store.add(0, 0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'add' on 'IDBObjectStore': The transaction has finished.
Expecting exception from store.delete(0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transaction has finished.
Expecting exception from store.clear()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transaction has finished.
Expecting exception from store.get(0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'get' on 'IDBObjectStore': The transaction has finished.
Expecting exception from store.openCursor()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction has finished.
testSetVersionAbort5():
PASS db.objectStoreNames is ['storeFail']
PASS db.objectStoreNames.length is 1
PASS db.objectStoreNames.contains('storeFail') is true
request = newConnection()
indexedDB.open(dbname, 6)
removeIDBObjects():
trans = event.target.transaction
PASS trans is non-null.
store = trans.objectStore('storeFail')
store.deleteIndex('indexFail')
db.deleteObjectStore('storeFail')
testSetVersionAbort6():
PASS db.objectStoreNames is ['storeFail']
PASS db.objectStoreNames.length is 1
PASS db.objectStoreNames.contains('storeFail') is true
request = newConnection()
indexedDB.open(dbname, 7)
setVersionSuccess():
trans = event.target.transaction
PASS trans is non-null.
Deleted all object stores.
db.createObjectStore('storeName', null)
completeCallback():
PASS event.cancelable is false
PASS complete event fired
db.transaction(['storeName'])
store = transaction.objectStore('storeName')
PASS store.name is "storeName"
PASS complete event fired
Verifying DOMStringList works as argument for IDBDatabase.transaction()
db.objectStoreNames is [object DOMStringList]
... which contains: ["storeName"]
transaction = db.transaction(db.objectStoreNames)
PASS no exception thrown
PASS transaction.objectStore("storeName") is non-null.
PASS all stores present in transaction
Verify that specifying an invalid mode raises an exception
Expecting TypeError exception from db.transaction(['storeName'], 'lsakjdf')
PASS Exception was thrown.
PASS db.transaction(['storeName'], 'lsakjdf') threw TypeError: Failed to execute 'transaction' on 'IDBDatabase': The provided value 'lsakjdf' is not a valid enum value of type IDBTransactionMode.
Test that null and undefined are treated as strings
Expecting exception from db.transaction(null)
PASS Exception was thrown.
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
Exception message: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
Expecting exception from db.transaction(undefined)
PASS Exception was thrown.
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
Exception message: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
request = newConnection()
indexedDB.open(dbname, 8)
db.createObjectStore('null')
db.createObjectStore('undefined')
PASS transaction = db.transaction(null) did not throw exception.
PASS transaction.objectStore('null') is non-null.
PASS transaction = db.transaction(undefined) did not throw exception.
PASS transaction.objectStore('undefined') is non-null.
PASS successfullyParsed is true
TEST COMPLETE