Add two additional test cases for removing puted items, and a small fix to make sure all cases of put are actually inserted.
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Mon, 10 May 2010 14:26:56 -0700
changeset 43991 006adbaa4641effaf493c73ca220aa482b77beac
parent 43990 cd8b9949a4c9257a1f121eaf1aafe248ffb99d61
child 43992 2ba9c6f83fac2fe5c2917798d8df15085b5d8b7e
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
milestone1.9.3a5pre
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
dom/indexedDB/test/test_objectStore_remove_values.html
--- a/dom/indexedDB/IDBObjectStoreRequest.cpp
+++ b/dom/indexedDB/IDBObjectStoreRequest.cpp
@@ -189,16 +189,17 @@ GetKeyFromVariant(nsIVariant* aKey,
   NS_ASSERTION(aKey && aKeyInt, "Null pointers!");
 
   PRUint16 type;
   nsresult rv = aKey->GetDataType(&type);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // 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;
       }
       aKeyString.SetIsVoid(PR_TRUE);
       *aKeyInt = 0;
       break;
 
--- a/dom/indexedDB/test/test_objectStore_remove_values.html
+++ b/dom/indexedDB/test/test_objectStore_remove_values.html
@@ -56,28 +56,42 @@ function testSteps()
   var event = yield;
 
   var db = event.result;
 
   var data = [
     { 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;
 
     request = db.openObjectStore(test.name);
     request.onerror = errorHandler;
     request.onsuccess = continueTest;
     event = yield;