blob: 299c1a25b6ea3a4b36bb99cf83f8977f6b77ce93 [file] [log] [blame]
if (this.importScripts) {
importScripts('../../../resources/js-test.js');
importScripts('shared.js');
}
description("Test IndexedDB deleteIndex method");
indexedDBTest(prepareDatabase, postTwiddling);
function prepareDatabase()
{
db = event.target.result;
objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
evalAndExpectException("objectStore.deleteIndex('first')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
shouldThrow("objectStore.deleteIndex()"); // TypeError: not enough arguments.
index = evalAndLog("index = objectStore.createIndex('first', 'first');");
evalAndExpectException("objectStore.deleteIndex('FIRST')", "DOMException.NOT_FOUND_ERR", "'NotFoundError'");
index = evalAndLog("index = objectStore.createIndex('second', 'second');");
returnValue = evalAndLog("returnValue = objectStore.deleteIndex('first');");
shouldBe("returnValue", "undefined");
}
function postTwiddling()
{
evalAndExpectException("db.createObjectStore('bar');", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
evalAndExpectException("objectStore.deleteIndex('second')", "0", "'TransactionInactiveError'");
finishJSTest();
}