1 if (this.importScripts) {
2 importScripts('../../../resources/js-test.js');
3 importScripts('shared.js');
6 description("Test IndexedDB deleteIndex method");
8 indexedDBTest(prepareDatabase, postTwiddling);
9 function prepareDatabase()
11 db = event.target.result;
12 objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
13 evalAndExpectException("objectStore.deleteIndex('first')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
14 shouldThrow("objectStore.deleteIndex()"); // TypeError: not enough arguments.
15 index = evalAndLog("index = objectStore.createIndex('first', 'first');");
16 evalAndExpectException("objectStore.deleteIndex('FIRST')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
17 index = evalAndLog("index = objectStore.createIndex('second', 'second');");
18 returnValue = evalAndLog("returnValue = objectStore.deleteIndex('first');");
19 shouldBe("returnValue", "undefined");
22 function postTwiddling()
24 evalAndExpectException("db.createObjectStore('bar');", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
25 evalAndExpectException("objectStore.deleteIndex('second')", "0", "'TransactionInactiveError'");