266 lines
12 KiB
Plaintext
266 lines
12 KiB
Plaintext
Test IndexedDB transaction internal active flag.
|
|
|
|
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)
|
|
store = db.createObjectStore('store')
|
|
store.createIndex('index', 'keypath')
|
|
|
|
runTransaction():
|
|
transaction = db.transaction('store', 'readwrite')
|
|
|
|
Verify that transactions are created with |active| flag set:
|
|
store = transaction.objectStore('store')
|
|
index = store.index('index')
|
|
PASS store.add(0, 0) did not throw exception.
|
|
PASS store.put(0, 0) did not throw exception.
|
|
PASS store.get(0) did not throw exception.
|
|
PASS store.get(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.delete(0) did not throw exception.
|
|
PASS store.delete(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.count() did not throw exception.
|
|
PASS store.count(0) did not throw exception.
|
|
PASS store.count(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.clear() did not throw exception.
|
|
PASS store.openCursor() did not throw exception.
|
|
PASS store.openCursor(0) did not throw exception.
|
|
PASS store.openCursor(0, 'next') did not throw exception.
|
|
PASS store.openCursor(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
|
|
PASS index.get(0) did not throw exception.
|
|
PASS index.get(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.getKey(0) did not throw exception.
|
|
PASS index.getKey(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.count() did not throw exception.
|
|
PASS index.count(0) did not throw exception.
|
|
PASS index.count(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.openCursor() did not throw exception.
|
|
PASS index.openCursor(0) did not throw exception.
|
|
PASS index.openCursor(0, 'next') did not throw exception.
|
|
PASS index.openCursor(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
|
|
PASS index.openKeyCursor() did not throw exception.
|
|
PASS index.openKeyCursor(0) did not throw exception.
|
|
PASS index.openKeyCursor(0, 'next') did not throw exception.
|
|
PASS index.openKeyCursor(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.openKeyCursor(IDBKeyRange.only(0), 'next') did not throw exception.
|
|
|
|
Transaction shouldn't be active inside a non-IDB-event callback
|
|
setTimeout(testTimeout, 0)
|
|
|
|
testTimeout():
|
|
store = transaction.objectStore('store')
|
|
index = store.index('index')
|
|
Expecting exception from store.add(0, 0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to store record in an IDBObjectStore: The transaction is inactive or finished.
|
|
Expecting exception from store.put(0, 0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to store record in an IDBObjectStore: The transaction is inactive or 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 is inactive or finished.
|
|
Expecting exception from store.get(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: A request was placed against a transaction which is currently not active, or which is 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 is inactive or finished.
|
|
Expecting exception from store.delete(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
Expecting exception from store.count()
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
Expecting exception from store.count(0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
Expecting exception from store.count(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'count' on 'IDBObjectStore': The transaction is inactive or 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 is inactive or 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 is inactive or finished.
|
|
Expecting exception from store.openCursor(0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
Expecting exception from store.openCursor(0, 'next')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
Expecting exception from store.openCursor(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
Expecting exception from store.openCursor(IDBKeyRange.only(0), 'next')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The transaction is inactive or 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 is inactive or finished.
|
|
Expecting exception from index.get(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'get' on 'IDBIndex': The transaction is inactive or 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 is inactive or finished.
|
|
Expecting exception from index.getKey(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'getKey' on 'IDBIndex': The transaction is inactive or 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 is inactive or finished.
|
|
Expecting exception from index.count(0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'count' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.count(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'count' on 'IDBIndex': The transaction is inactive or finished.
|
|
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 is inactive or finished.
|
|
Expecting exception from index.openCursor(0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.openCursor(0, 'next')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.openCursor(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.openCursor(IDBKeyRange.only(0), 'next')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The transaction is inactive or 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 is inactive or finished.
|
|
Expecting exception from index.openKeyCursor(0)
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.openKeyCursor(0, 'next')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.openKeyCursor(IDBKeyRange.only(0))
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
Expecting exception from index.openKeyCursor(IDBKeyRange.only(0), 'next')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The transaction is inactive or finished.
|
|
|
|
testEventCallback():
|
|
Transaction should be active inside a non-IDB-event callback
|
|
store = transaction.objectStore('store')
|
|
index = store.index('index')
|
|
PASS store.add(0, 0) did not throw exception.
|
|
PASS store.put(0, 0) did not throw exception.
|
|
PASS store.get(0) did not throw exception.
|
|
PASS store.get(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.delete(0) did not throw exception.
|
|
PASS store.delete(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.count() did not throw exception.
|
|
PASS store.count(0) did not throw exception.
|
|
PASS store.count(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.clear() did not throw exception.
|
|
PASS store.openCursor() did not throw exception.
|
|
PASS store.openCursor(0) did not throw exception.
|
|
PASS store.openCursor(0, 'next') did not throw exception.
|
|
PASS store.openCursor(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS store.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
|
|
PASS index.get(0) did not throw exception.
|
|
PASS index.get(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.getKey(0) did not throw exception.
|
|
PASS index.getKey(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.count() did not throw exception.
|
|
PASS index.count(0) did not throw exception.
|
|
PASS index.count(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.openCursor() did not throw exception.
|
|
PASS index.openCursor(0) did not throw exception.
|
|
PASS index.openCursor(0, 'next') did not throw exception.
|
|
PASS index.openCursor(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.openCursor(IDBKeyRange.only(0), 'next') did not throw exception.
|
|
PASS index.openKeyCursor() did not throw exception.
|
|
PASS index.openKeyCursor(0) did not throw exception.
|
|
PASS index.openKeyCursor(0, 'next') did not throw exception.
|
|
PASS index.openKeyCursor(IDBKeyRange.only(0)) did not throw exception.
|
|
PASS index.openKeyCursor(IDBKeyRange.only(0), 'next') did not throw exception.
|
|
|
|
transactionComplete():
|
|
Expecting exception from store = transaction.objectStore('store')
|
|
PASS Exception was thrown.
|
|
PASS code is DOMException.INVALID_STATE_ERR
|
|
PASS ename is 'InvalidStateError'
|
|
Exception message: Failed to execute 'objectStore' on 'IDBTransaction': The transaction finished.
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|