summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html')
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html61
1 files changed, 30 insertions, 31 deletions
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
index 7878c7f..c4418bc 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
@@ -10,36 +10,46 @@
<div id="console"></div>
<script>
-description("Test IndexedDB's IDBObjectStore.removeObjectStore().");
+description("Test IndexedDB's webkitIDBObjectStore.removeObjectStore().");
if (window.layoutTestController)
layoutTestController.waitUntilDone();
function test()
{
- result = evalAndLog("indexedDB.open('name', 'description')");
+ result = evalAndLog("webkitIndexedDB.open('name', 'description')");
verifyResult(result);
- result.onsuccess = createObjectStore;
+ result.onsuccess = startSetVersion;
result.onerror = unexpectedErrorCallback;
}
-function createObjectStore()
+function startSetVersion()
{
verifySuccessEvent(event);
db = evalAndLog("db = event.result");
- deleteAllObjectStores(db);
-
- result = evalAndLog("db.createObjectStore('storeName', null)");
+ result = evalAndLog("db.setVersion('new version')");
verifyResult(result);
- result.onsuccess = addValue;
+ result.onsuccess = deleteExisting;
result.onerror = unexpectedErrorCallback;
}
-function addValue()
+function deleteExisting()
{
verifySuccessEvent(event);
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+
+ deleteAllObjectStores(db, createObjectStoreAndAddValue);
+}
+
+function createObjectStoreAndAddValue()
+{
+ store = evalAndLog("store = db.createObjectStore('storeName', null)");
- result = evalAndLog("event.result.add('value', 'key')");
+ window.index = evalAndLog("store.createIndex('indexName', '')");
+ shouldBeTrue("store.indexNames.contains('indexName')");
+
+ result = evalAndLog("store.add('value', 'key')");
verifyResult(result);
result.onsuccess = getValue;
result.onerror = unexpectedErrorCallback;
@@ -64,42 +74,31 @@ function addIndex()
verifySuccessEvent(event);
shouldBeEqualToString("event.result", "value");
- result = evalAndLog("event.source.createIndex('indexName', '')");
+ result = evalAndLog("db.setVersion('new version')");
verifyResult(result);
- result.onsuccess = commitTransaction;
+ result.onsuccess = removeObjectStore;
result.onerror = unexpectedErrorCallback;
}
-function commitTransaction()
+function removeObjectStore()
{
verifySuccessEvent(event);
- shouldBeTrue("event.source.indexNames.contains('indexName')");
- // Let the transaction commit.
- window.setTimeout('removeObjectStore()', 0);
-}
+ window.trans = evalAndLog("trans = event.result");
+ shouldBeTrue("trans !== null");
+ trans.onabort = unexpectedAbortCallback;
-function removeObjectStore()
-{
- result = evalAndLog("db.removeObjectStore('storeName')");
- verifyResult(result);
- result.onsuccess = createObjectStoreAgain;
- result.onerror = unexpectedErrorCallback;
+ evalAndLog("db.removeObjectStore('storeName')");
+ createObjectStoreAgain();
}
function createObjectStoreAgain()
{
- verifySuccessEvent(event);
-
- result = evalAndLog("db.createObjectStore('storeName', null)");
- verifyResult(result);
- result.onsuccess = getValueAgain;
- result.onerror = unexpectedErrorCallback;
+ evalAndLog("db.createObjectStore('storeName', null)");
+ getValueAgain();
}
function getValueAgain()
{
- verifySuccessEvent(event);
-
transaction = evalAndLog("db.transaction()");
transaction.onabort = unexpectedErrorCallback;
var store = evalAndLog("store = transaction.objectStore('storeName')");