From 1864a379447b84e26891cb6d880a204d094b13ed Mon Sep 17 00:00:00 2001 From: Shawn Wilsher Date: Mon, 10 May 2010 14:26:56 -0700 Subject: [PATCH] Add two additional test cases for removing puted items, and a small fix to make sure all cases of put are actually inserted. --- dom/indexedDB/IDBObjectStoreRequest.cpp | 1 + .../test/test_objectStore_remove_values.html | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dom/indexedDB/IDBObjectStoreRequest.cpp b/dom/indexedDB/IDBObjectStoreRequest.cpp index 620fafad98a..ed33d1adbab 100644 --- a/dom/indexedDB/IDBObjectStoreRequest.cpp +++ b/dom/indexedDB/IDBObjectStoreRequest.cpp @@ -194,6 +194,7 @@ GetKeyFromVariant(nsIVariant* aKey, // See xpcvariant.cpp, these are the only types we should expect. switch (type) { + case nsIDataType::VTYPE_VOID: case nsIDataType::VTYPE_EMPTY: if (!aAutoIncrement || aGetting) { return NS_ERROR_INVALID_ARG; diff --git a/dom/indexedDB/test/test_objectStore_remove_values.html b/dom/indexedDB/test/test_objectStore_remove_values.html index 2f19f73ad6d..ce1e2e8bc80 100644 --- a/dom/indexedDB/test/test_objectStore_remove_values.html +++ b/dom/indexedDB/test/test_objectStore_remove_values.html @@ -61,18 +61,32 @@ function testSteps() { name: "inline key; key generator", autoIncrement: true, storedObject: {name: "Lincoln"}, + keyName: "id", keyValue: undefined, }, { name: "inline key; no key generator", autoIncrement: false, storedObject: {id: 1, name: "Lincoln"}, + keyName: "id", keyValue: undefined, }, - // TODO add the other two cases + { name: "out of line key; key generator", + autoIncrement: true, + storedObject: {name: "Lincoln"}, + keyName: null, + keyValue: undefined, + }, + { name: "out of line key; no key generator", + autoIncrement: false, + storedObject: {name: "Lincoln"}, + keyName: null, + keyValue: 1, + }, ]; for (let i = 0; i < data.length; i++) { let test = data[i]; - let request = db.createObjectStore(test.name, "id", test.autoIncrement); + let request = db.createObjectStore(test.name, test.keyName, + test.autoIncrement); request.onerror = errorHandler; request.onsuccess = continueTest; event = yield;