blob: 0ed500a8f8c85920bc07e3bcbfff8cc8a458e32f [file] [log] [blame]
Test that IndexedDB objects that have been deleted throw exceptions
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)
testStore():
deletedStore = connection.createObjectStore('deletedStore')
connection.deleteObjectStore('deletedStore')
Expecting exception from deletedStore.put(0, 0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to store record in an IDBObjectStore: The object store has been deleted.
Expecting exception from deletedStore.add(0, 0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to store record in an IDBObjectStore: The object store has been deleted.
Expecting exception from deletedStore.delete(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.delete(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'delete' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.get(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.get(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.clear()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'clear' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.openCursor()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.openCursor(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.openCursor(0, 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.openCursor(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.openCursor(IDBKeyRange.only(0), 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.createIndex('name', 'path')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'createIndex' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.index('name')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'index' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.deleteIndex('name')
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.
Expecting exception from deletedStore.count()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.count(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.
Expecting exception from deletedStore.count(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBObjectStore': The object store has been deleted.
testIndex():
store = connection.createObjectStore('store')
deletedIndex = store.createIndex('deletedIndex', 'path')
store.deleteIndex('deletedIndex')
Expecting exception from deletedIndex.openCursor()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openCursor(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openCursor(0, 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openCursor(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openCursor(IDBKeyRange.only(0), 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openKeyCursor()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openKeyCursor(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openKeyCursor(0, 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openKeyCursor(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.openKeyCursor(IDBKeyRange.only(0), 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.get(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.get(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.getKey(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.getKey(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.count()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.count(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from deletedIndex.count(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
testTransitiveDeletion():
deletedStore = connection.createObjectStore('deletedStore')
indexOfDeletedStore = deletedStore.createIndex('index', 'path')
connection.deleteObjectStore('deletedStore')
Expecting exception from indexOfDeletedStore.openCursor()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openCursor(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openCursor(0, 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openCursor(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openCursor(IDBKeyRange.only(0), 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openKeyCursor()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openKeyCursor(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openKeyCursor(0, 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openKeyCursor(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.openKeyCursor(IDBKeyRange.only(0), 'next')
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'openKeyCursor' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.get(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.get(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'get' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.getKey(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.getKey(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'getKey' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.count()
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.count(0)
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
Expecting exception from indexOfDeletedStore.count(IDBKeyRange.only(0))
PASS Exception was thrown.
PASS code is DOMException.INVALID_STATE_ERR
PASS ename is 'InvalidStateError'
Exception message: Failed to execute 'count' on 'IDBIndex': The index or its object store has been deleted.
testObjectStoreCursor():
deletedStore = connection.createObjectStore('deletedStore')
deletedStore.put(0, 0)
deletedStore.openCursor()
cursor = request.result
PASS cursor.key is 0
PASS cursor.value is 0
connection.deleteObjectStore('deletedStore')
Expecting exception from cursor.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's source or effective object store has been deleted.
Expecting exception from cursor.update(1)
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's source or effective object store has been deleted.
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's source or effective object store has been deleted.
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's source or effective object store has been deleted.
testIndexCursor():
store.put({id: 123}, 0)
deletedIndex = store.createIndex('deletedIndex', 'id')
deletedIndex.openCursor()
cursor = request.result
PASS cursor.key is 123
PASS cursor.primaryKey is 0
store.deleteIndex('deletedIndex')
Expecting exception from cursor.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's source or effective object store has been deleted.
Expecting exception from cursor.update(1)
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's source or effective object store has been deleted.
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's source or effective object store has been deleted.
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's source or effective object store has been deleted.
testIndexOfDeletedStoreCursor():
deletedStore = connection.createObjectStore('deletedStore')
deletedStore.put({id: 123}, 0)
index = deletedStore.createIndex('index', 'id')
index.openCursor()
cursor = request.result
PASS cursor.key is 123
PASS cursor.primaryKey is 0
connection.deleteObjectStore('deletedStore')
Expecting exception from cursor.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's source or effective object store has been deleted.
Expecting exception from cursor.update(1)
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's source or effective object store has been deleted.
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's source or effective object store has been deleted.
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's source or effective object store has been deleted.
PASS successfullyParsed is true
TEST COMPLETE