blob: c4116a9d7147ba36bc3d6ae3401638626e4e8c38 [file] [log] [blame]
Test that expected exceptions are thrown per IndexedDB spec.
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')
index = store.createIndex('index', 'id')
store.put({id: 'a'}, 1)
store.put({id: 'b'}, 2)
store.put({id: 'c'}, 3)
store.put({id: 'd'}, 4)
store.put({id: 'e'}, 5)
store.put({id: 'f'}, 6)
store.put({id: 'g'}, 7)
store.put({id: 'h'}, 8)
store.put({id: 'i'}, 9)
store.put({id: 'j'}, 10)
otherStore = db.createObjectStore('otherStore')
inlineKeyStore = db.createObjectStore('inlineKeyStore', {keyPath: 'id'})
request = inlineKeyStore.put({id: 0})
PASS request.readyState is "pending"
3.2.1 The IDBRequest Interface
IDBRequest.error
When the done flag is false, getting this property must throw a DOMException of type InvalidStateError.
Expecting exception from request.error
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to read the 'error' property from 'IDBRequest': The request has not finished.
IDBRequest.result
When the done flag is false, getting this property must throw a DOMException of type InvalidStateError.
Expecting exception from request.result
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to read the 'result' property from 'IDBRequest': The request has not finished.
3.2.3 Opening a database
IDBFactory.cmp()
One of the supplied keys was not a valid key.
Expecting exception from indexedDB.cmp(null, 0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'cmp' on 'IDBFactory': The parameter is not a valid key.
db.close()
3.2.4 Database
indexedDB.open(dbname, 2)
IDBDatabase.createObjectStore()
If an objectStore with the same name already exists, the implementation must throw a DOMException of type ConstraintError.
Expecting exception from db.createObjectStore('store')
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ConstraintError'
Exception message: Failed to execute 'createObjectStore' on 'IDBDatabase': An object store with the specified name already exists.
If keyPath is not a valid key path then a DOMException of type SyntaxError must be thrown.
Expecting exception from db.createObjectStore('fail', {keyPath: '-invalid-'})
PASS Exception was thrown.
PASS code is DOMException.SYNTAX_ERR
PASS ename is 'SyntaxError'
Exception message: Failed to execute 'createObjectStore' on 'IDBDatabase': The keyPath option is not a valid key path.
If the optionalParameters parameter is specified, and autoIncrement is set to true, and the keyPath parameter is specified to the empty string, or specified to an Array, this function must throw a InvalidAccessError exception.
Expecting exception from db.createObjectStore('fail', {autoIncrement: true, keyPath: ''})
PASS Exception was thrown.
PASS code is DOMException.INVALID_ACCESS_ERR
PASS ename is 'InvalidAccessError'
Exception message: Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.
Expecting exception from db.createObjectStore('fail', {autoIncrement: true, keyPath: ['a']})
PASS Exception was thrown.
PASS code is DOMException.INVALID_ACCESS_ERR
PASS ename is 'InvalidAccessError'
Exception message: Failed to execute 'createObjectStore' on 'IDBDatabase': The autoIncrement option was set but the keyPath option was empty or an array.
IDBDatabase.deleteObjectStore()
There is no object store with the given name, compared in a case-sensitive manner, in the connected database.
Expecting exception from db.deleteObjectStore('no-such-store')
PASS Exception was thrown.
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
Exception message: Failed to execute 'deleteObjectStore' on 'IDBDatabase': The specified object store was not found.
IDBDatabase.transaction()
If this method is called on IDBDatabase object for which a "versionchange" transaction is still running, a InvalidStateError exception must be thrown.
Expecting exception from db.transaction('store')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.
One of the names provided in the storeNames argument doesn't exist in this database.
Expecting exception from db.transaction('no-such-store')
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.
The value for the mode parameter is invalid.
Expecting TypeError exception from db.transaction('store', 'invalid-mode')
PASS Exception was thrown.
PASS db.transaction('store', 'invalid-mode') threw TypeError: Argument 2 ('mode') to IDBDatabase.transaction must be one of: "readonly", "readwrite", "versionchange"
The function was called with an empty list of store names
Expecting exception from db.transaction([])
PASS Exception was thrown.
PASS code is DOMException.INVALID_ACCESS_ERR
PASS ename is 'InvalidAccessError'
Exception message: Failed to execute 'transaction' on 'IDBDatabase': The storeNames parameter was empty.
One more IDBDatabase.createObjectStore() test:
If this function is called from outside a "versionchange" transaction callback ... the implementation must throw a DOMException of type InvalidStateError.
Expecting exception from db.createObjectStore('fail')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'createObjectStore' on 'IDBDatabase': The database is not running a version change transaction.
One more IDBDatabase.deleteObjectStore() test:
If this function is called from outside a "versionchange" transaction callback ... the implementation must throw a DOMException of type InvalidStateError.
Expecting exception from db.deleteObjectStore('fail')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'deleteObjectStore' on 'IDBDatabase': The database is not running a version change transaction.
Prepare an object store and index from an inactive transaction for later use.
finishedTransaction = inactiveTransaction = db.transaction('store')
storeFromInactiveTransaction = inactiveTransaction.objectStore('store')
indexFromInactiveTransaction = storeFromInactiveTransaction.index('index')
request = storeFromInactiveTransaction.openCursor()
cursorFromInactiveTransaction = request.result
3.2.5 Object Store
ro_transaction = db.transaction('store', 'readonly')
storeFromReadOnlyTransaction = ro_transaction.objectStore('store')
rw_transaction = db.transaction('store', 'readwrite')
store = rw_transaction.objectStore('store')
IDBObjectStore.add()
This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to "readonly".
Expecting exception from storeFromReadOnlyTransaction.add(0, 0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to store record in an IDBObjectStore: The transaction is read-only.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
The data being stored could not be cloned by the internal structured cloning algorithm.
Expecting exception from store.add(self, 0)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
IDBObjectStore.clear()
This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to "readonly".
Expecting exception from storeFromReadOnlyTransaction.clear()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'clear' on 'IDBObjectStore': The transaction is read-only.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
IDBObjectStore.count()
If the optional key parameter is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from store.count({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'count' on 'IDBObjectStore': The parameter is not a valid key.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
IDBObjectStore.delete()
This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to "readonly".
Expecting exception from storeFromReadOnlyTransaction.delete(0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The transaction is read-only.
If the key parameter is not a valid key or a key range this method throws a DOMException of type DataError.
Expecting exception from store.delete({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The parameter is not a valid key.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
IDBObjectStore.get()
If the key parameter is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from store.get({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'get' on 'IDBObjectStore': The parameter is not a valid key.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
IDBObjectStore.index()
There is no index with the given name, compared in a case-sensitive manner, in the connected database.
Expecting exception from store.index('no-such-index')
PASS Exception was thrown.
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
Exception message: Failed to execute 'index' on 'IDBObjectStore': The specified index was not found.
Occurs if a request is made on a source object that has been deleted or removed, or if the transaction the object store belongs to has finished.
Expecting exception from storeFromInactiveTransaction.index('index')
PASS Exception was thrown.
PASS code is 11
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'index' on 'IDBObjectStore': The transaction is finished.
IDBObjectStore.openCursor()
If the range parameter is specified but is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from store.openCursor({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
The value for the direction parameter is invalid.
Expecting TypeError exception from store.openCursor(0, 'invalid-direction')
PASS Exception was thrown.
PASS store.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBObjectStore.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
IDBObjectStore.put()
This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to "readonly".
Expecting exception from storeFromReadOnlyTransaction.put(0, 0)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to store record in an IDBObjectStore: The transaction is read-only.
The transaction this IDBObjectStore belongs to is not active.
Expecting exception from storeFromInactiveTransaction.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.
The data being stored could not be cloned by the internal structured cloning algorithm.
Expecting exception from store.put(self, 0)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
db.close()
ro_transaction.oncomplete = transactionComplete
rw_transaction.oncomplete = transactionComplete
transactionComplete():
First transaction completed
transactionComplete():
request = indexedDB.open(dbname, 3)
request.onupgradeneeded = onUpgradeNeeded3
IDBObjectStore.createIndex()
If an index with the same name already exists, the implementation must throw a DOMException of type ConstraintError.
Expecting exception from store.createIndex('index', 'keyPath')
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ConstraintError'
Exception message: Failed to execute 'createIndex' on 'IDBObjectStore': An index with the specified name already exists.
If keyPath is not a valid key path then a DOMException of type SyntaxError must be thrown.
Expecting exception from store.createIndex('fail', '-invalid-')
PASS Exception was thrown.
PASS code is DOMException.SYNTAX_ERR
PASS ename is 'SyntaxError'
Exception message: Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument contains an invalid key path.
If keyPath is an Array and the multiEntry property in the optionalParameters is true, then a DOMException of type InvalidAccessError must be thrown.
Expecting exception from store.createIndex('fail', ['a'], {multiEntry: true})
PASS Exception was thrown.
PASS code is DOMException.INVALID_ACCESS_ERR
PASS ename is 'InvalidAccessError'
Exception message: Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument was an array and the multiEntry option is true.
IDBObjectStore.deleteIndex()
There is no index with the given name, compared in a case-sensitive manner, in the connected database.
Expecting exception from store.deleteIndex('no-such-index')
PASS Exception was thrown.
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The specified index was not found.
One more IDBObjectStore.createIndex() test:
If this function is called from outside a "versionchange" transaction callback ... the implementation must throw a DOMException of type InvalidStateError.
Expecting exception from db.transaction('store').objectStore('store').createIndex('fail', 'keyPath')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'createIndex' on 'IDBObjectStore': The database is not running a version change transaction.
One more IDBObjectStore.deleteIndex() test:
If this function is called from outside a "versionchange" transaction callback ... the implementation must throw a DOMException of type InvalidStateError.
Expecting exception from db.transaction('store').objectStore('store').deleteIndex('fail', 'keyPath')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The database is not running a version change transaction.
3.2.6 Index
indexFromReadOnlyTransaction = db.transaction('store', 'readonly').objectStore('store').index('index')
index = db.transaction('store', 'readwrite').objectStore('store').index('index')
IDBIndex.count()
If the optional key parameter is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from index.count({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'count' on 'IDBIndex': The parameter is not a valid key.
The transaction this IDBIndex belongs to is not active.
Expecting exception from indexFromInactiveTransaction.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.
IDBIndex.get()
If the key parameter is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from index.get({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.
The transaction this IDBIndex belongs to is not active.
Expecting exception from indexFromInactiveTransaction.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.
IDBIndex.getKey()
If the key parameter is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from index.getKey({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The parameter is not a valid key.
The transaction this IDBIndex belongs to is not active.
Expecting exception from indexFromInactiveTransaction.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.
IDBIndex.openCursor()
If the range parameter is specified but is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from index.openCursor({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The parameter is not a valid key.
The transaction this IDBIndex belongs to is not active.
Expecting exception from indexFromInactiveTransaction.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.
The value for the direction parameter is invalid.
Expecting TypeError exception from index.openCursor(0, 'invalid-direction')
PASS Exception was thrown.
PASS index.openCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openCursor must be one of: "next", "nextunique", "prev", "prevunique"
IDBIndex.openKeyCursor()
If the range parameter is specified but is not a valid key or a key range, this method throws a DOMException of type DataError.
Expecting exception from index.openKeyCursor({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The parameter is not a valid key.
The transaction this IDBIndex belongs to is not active.
Expecting exception from indexFromInactiveTransaction.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.
The value for the direction parameter is invalid.
Expecting TypeError exception from index.openKeyCursor(0, 'invalid-direction')
PASS Exception was thrown.
PASS index.openKeyCursor(0, 'invalid-direction') threw TypeError: Argument 2 ('direction') to IDBIndex.openKeyCursor must be one of: "next", "nextunique", "prev", "prevunique"
3.2.7 Cursor
transaction = db.transaction(['store', 'inlineKeyStore'], 'readwrite')
request = transaction.objectStore('store').openCursor()
cursor = request.result
request = transaction.objectStore('store').index('index').openKeyCursor()
keyCursor = request.result
request = transaction.objectStore('store').openCursor(IDBKeyRange.lowerBound(-Infinity), 'prev')
reverseCursor = request.result
request = transaction.objectStore('inlineKeyStore').openCursor()
inlineCursor = request.result
IDBCursor.advance()
Calling this method more than once before new cursor data has been loaded is not allowed and results in a DOMException of type InvalidStateError being thrown.
If the value for count is 0 (zero) or a negative number, this method must throw a JavaScript TypeError exception.
Expecting TypeError exception from cursor.advance(0)
PASS Exception was thrown.
PASS cursor.advance(0) threw TypeError: Failed to execute 'advance' on 'IDBCursor': A count argument with value 0 (zero) was supplied, must be greater than 0.
cursor.advance(1)
Expecting exception from cursor.advance(1)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'advance' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
The transaction this IDBCursor belongs to is not active.
Expecting exception from cursorFromInactiveTransaction.advance(1)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'advance' on 'IDBCursor': The transaction is inactive or finished.
IDBCursor.continue()
The parameter is not a valid key.
Expecting exception from cursor.continue({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is not a valid key.
The parameter is less than or equal to this cursor's position and this cursor's direction is "next" or "nextunique".
Expecting exception from cursor.continue(-Infinity)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is less than or equal to this cursor's position.
The parameter is greater than or equal to this cursor's position and this cursor's direction is "prev" or "prevunique".
Expecting exception from reverseCursor.continue(100)
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The parameter is greater than or equal to this cursor's position.
Calling this method more than once before new cursor data has been loaded is not allowed and results in a DOMException of type InvalidStateError being thrown.
cursor.continue()
Expecting exception from cursor.continue()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The cursor is being iterated or has iterated past its end.
The transaction this IDBCursor belongs to is not active.
Expecting exception from cursorFromInactiveTransaction.continue()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'continue' on 'IDBCursor': The transaction is inactive or finished.
IDBCursor.delete()
If this cursor's got value flag is false, or if this cursor was created using openKeyCursor a DOMException of type InvalidStateError is thrown.
Expecting exception from keyCursor.delete()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'delete' on 'IDBCursor': The cursor is a key cursor.
The transaction this IDBCursor belongs to is not active.
Expecting exception from cursorFromInactiveTransaction.delete()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'delete' on 'IDBCursor': The transaction is inactive or finished.
IDBCursor.update()
If this cursor's got value flag is false or if this cursor was created using openKeyCursor. This method throws a DOMException of type InvalidStateError.
Expecting exception from keyCursor.update({})
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'update' on 'IDBCursor': The cursor is a key cursor.
If the effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key, this method throws a DOMException of type DataError.
Expecting exception from inlineCursor.update({id: 1})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'DataError'
Exception message: Failed to execute 'update' on 'IDBCursor': The effective object store of this cursor uses in-line keys and evaluating the key path of the value parameter results in a different value than the cursor's effective key.
If the structured clone algorithm throws an exception, that exception is rethrown.
Expecting exception from cursor.update(self)
PASS Exception was thrown.
PASS code is DOMException.DATA_CLONE_ERR
Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
The transaction this IDBCursor belongs to is not active.
Expecting exception from cursorFromInactiveTransaction.update({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'TransactionInactiveError'
Exception message: Failed to execute 'update' on 'IDBCursor': The transaction is inactive or finished.
readOnlyTransaction = db.transaction('store', 'readonly')
request = readOnlyTransaction.objectStore('store').openCursor()
cursorFromReadOnlyTransaction = request.result
One more IDBCursor.delete() test:
This method throws a DOMException of type ReadOnlyError if the transaction which this IDBCursor belongs to has its mode set to "readonly".
Expecting exception from cursorFromReadOnlyTransaction.delete()
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'delete' on 'IDBCursor': The record may not be deleted inside a read-only transaction.
One more IDBCursor.update() test:
This method throws a DOMException of type ReadOnlyError if the transaction which this IDBCursor belongs to has its mode set to "readonly".
Expecting exception from cursorFromReadOnlyTransaction.update({})
PASS Exception was thrown.
PASS code is 0
PASS ename is 'ReadOnlyError'
Exception message: Failed to execute 'update' on 'IDBCursor': The record may not be updated inside a read-only transaction.
3.2.8 Transaction
IDBTransaction.abort()
If this transaction is finished, throw a DOMException of type InvalidStateError.
Expecting exception from finishedTransaction.abort()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'abort' on 'IDBTransaction': The transaction is inactive or finished.
If the requested object store is not in this transaction's scope.
Expecting exception from db.transaction('store').objectStore('otherStore')
PASS Exception was thrown.
PASS code is DOMException.NOT_FOUND_ERR
PASS ename is 'NotFoundError'
Exception message: Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.
PASS successfullyParsed is true
TEST COMPLETE