Test IndexedDB's create and removeObjectStore
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
dbname = "create-and-remove-object-store.html"
indexedDB.deleteDatabase(dbname)
indexedDB.open(dbname)
db.createObjectStore('tmp')
Expecting exception from db.createObjectStore('tmp')
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.
trans = db.transaction(['tmp'])
trans.objectStore('tmp').get(0)
PASS event.target.result is undefined.
Trying create
Expecting exception from db.createObjectStore("some os")
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.
Trying remove
Expecting exception from db.deleteObjectStore("some os")
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.
Trying create with store that already exists
Expecting exception from db.createObjectStore('tmp')
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.
Trying remove with store that already exists
Expecting exception from db.deleteObjectStore('tmp')
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.
PASS successfullyParsed is true
TEST COMPLETE