summaryrefslogtreecommitdiffstats
path: root/LayoutTests/storage/indexeddb/objectstore-basics.html
diff options
context:
space:
mode:
Diffstat (limited to 'LayoutTests/storage/indexeddb/objectstore-basics.html')
-rw-r--r--LayoutTests/storage/indexeddb/objectstore-basics.html28
1 files changed, 27 insertions, 1 deletions
diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html
index 731d421..b2d383a 100644
--- a/LayoutTests/storage/indexeddb/objectstore-basics.html
+++ b/LayoutTests/storage/indexeddb/objectstore-basics.html
@@ -49,6 +49,16 @@ function createSuccess()
shouldBe("storeNames.length", "1");
// FIXME: test all of object store's methods.
+ debug("Ask for a store that doesn't exist:");
+ try {
+ index = evalAndLog("index = store.index('asdf')");
+ shouldBeNull("index"); // Returning null is wrong, but less wrong than returning an actual object!
+ testFailed("Asking for a store that doesn't exist should have thrown.");
+ } catch (err) {
+ testPassed("Error thrown.");
+ // FIXME: Verify the correct exception thrown.
+ }
+
result = evalAndLog("event.result.createIndex('indexName', 'x', true)"); // true == unique requirement.
verifyResult(result);
result.onsuccess = addIndexSuccess;
@@ -59,7 +69,20 @@ function addIndexSuccess()
{
debug("addIndexSuccess():");
verifySuccessEvent(event);
+ shouldBeTrue("event.result !== null");
shouldBeTrue("event.source.indexNames.contains('indexName')");
+ index = evalAndLog("index = event.source.index('indexName')");
+ shouldBeTrue("index !== null");
+
+ debug("Ask for a store that doesn't exist:");
+ try {
+ index = evalAndLog("index = store.index('asdf')");
+ shouldBeNull("index"); // Returning null is wrong, but less wrong than returning an actual object!
+ testFailed("Asking for a store that doesn't exist should have thrown.");
+ } catch (err) {
+ testPassed("Error thrown.");
+ // FIXME: Verify the correct exception thrown.
+ }
result = evalAndLog("event.source.add({x: 'value'}, 'key')");
verifyResult(result);
@@ -85,7 +108,10 @@ function addAgainFailure()
verifyErrorEvent(event);
// FIXME: This error code needs to be specced.
shouldBe("event.code", "IDBDatabaseException.UNKNOWN_ERR");
- var store = evalAndLog("store = event.source");
+
+ transaction = evalAndLog("db.transaction()");
+ transaction.onabort = unexpectedErrorCallback;
+ var store = evalAndLog("store = transaction.objectStore('storeName')");
result = evalAndLog("store.get('key')");
verifyResult(result);