40 lines
1.7 KiB
Plaintext
40 lines
1.7 KiB
Plaintext
Test IndexedDB deleteIndex method
|
|
|
|
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)
|
|
objectStore = db.createObjectStore('foo');
|
|
Expecting exception from objectStore.deleteIndex('first')
|
|
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.
|
|
PASS objectStore.deleteIndex() threw exception TypeError: Not enough arguments.
|
|
index = objectStore.createIndex('first', 'first');
|
|
Expecting exception from objectStore.deleteIndex('FIRST')
|
|
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.
|
|
index = objectStore.createIndex('second', 'second');
|
|
returnValue = objectStore.deleteIndex('first');
|
|
PASS returnValue is undefined
|
|
Expecting exception from db.createObjectStore('bar');
|
|
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.
|
|
Expecting exception from objectStore.deleteIndex('second')
|
|
PASS Exception was thrown.
|
|
PASS code is 0
|
|
PASS ename is 'TransactionInactiveError'
|
|
Exception message: Failed to execute 'deleteIndex' on 'IDBObjectStore': The transaction is inactive or finished.
|
|
PASS successfullyParsed is true
|
|
|
|
TEST COMPLETE
|
|
|