diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index fa15e43a5dfb..0179e4626bdb 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -737,18 +737,21 @@ IDBObjectStore::UpdateIndexes(IDBTransaction* aTransaction, aObjectDataId); NS_ENSURE_SUCCESS(rv, rv); - NS_NAMED_LITERAL_CSTRING(objectDataKey, "object_data_key"); + if (!updateInfo.info.autoIncrement) { + NS_NAMED_LITERAL_CSTRING(objectDataKey, "object_data_key"); - if (aObjectStoreKey.IsInt()) { - rv = stmt->BindInt64ByName(objectDataKey, aObjectStoreKey.IntValue()); + if (aObjectStoreKey.IsInt()) { + rv = stmt->BindInt64ByName(objectDataKey, aObjectStoreKey.IntValue()); + } + else if (aObjectStoreKey.IsString()) { + rv = stmt->BindStringByName(objectDataKey, + aObjectStoreKey.StringValue()); + } + else { + NS_NOTREACHED("Unknown key type!"); + } + NS_ENSURE_SUCCESS(rv, rv); } - else if (aObjectStoreKey.IsString()) { - rv = stmt->BindStringByName(objectDataKey, aObjectStoreKey.StringValue()); - } - else { - NS_NOTREACHED("Unknown key type!"); - } - NS_ENSURE_SUCCESS(rv, rv); NS_NAMED_LITERAL_CSTRING(value, "value"); diff --git a/dom/indexedDB/IDBTransaction.cpp b/dom/indexedDB/IDBTransaction.cpp index a9ba232e90f7..0817b75b154d 100644 --- a/dom/indexedDB/IDBTransaction.cpp +++ b/dom/indexedDB/IDBTransaction.cpp @@ -479,27 +479,27 @@ IDBTransaction::IndexUpdateStatement(bool aAutoIncrement, if (aOverwrite) { return GetCachedStatement( "INSERT OR REPLACE INTO ai_unique_index_data " - "(index_id, ai_object_data_id, id, value) " - "VALUES (:index_id, :object_data_id, :object_data_key, :value)" + "(index_id, ai_object_data_id, value) " + "VALUES (:index_id, :object_data_id, :value)" ); } return GetCachedStatement( "INSERT INTO ai_unique_index_data " - "(index_id, aI_object_data_id, id, value) " - "VALUES (:index_id, :object_data_id, :object_data_key, :value)" + "(index_id, aI_object_data_id, value) " + "VALUES (:index_id, :object_data_id, :value)" ); } if (aOverwrite) { return GetCachedStatement( "INSERT OR REPLACE INTO ai_index_data " - "(index_id, ai_object_data_id, id, value) " - "VALUES (:index_id, :object_data_id, :object_data_key, :value)" + "(index_id, ai_object_data_id, value) " + "VALUES (:index_id, :object_data_id, :value)" ); } return GetCachedStatement( "INSERT INTO ai_index_data " - "(index_id, ai_object_data_id, id, value) " - "VALUES (:index_id, :object_data_id, :object_data_key, :value)" + "(index_id, ai_object_data_id, value) " + "VALUES (:index_id, :object_data_id, :value)" ); } if (aUnique) { diff --git a/dom/indexedDB/test/Makefile.in b/dom/indexedDB/test/Makefile.in index 88596f94b925..555fbeaf93fd 100644 --- a/dom/indexedDB/test/Makefile.in +++ b/dom/indexedDB/test/Makefile.in @@ -53,6 +53,7 @@ TEST_FILES = \ helpers.js \ leaving_page_iframe.html \ test_add_twice_failure.html \ + test_autoIncrement_indexes.html \ test_bad_keypath.html \ test_bfcache.html \ test_clear.html \ diff --git a/dom/indexedDB/test/test_autoIncrement_indexes.html b/dom/indexedDB/test/test_autoIncrement_indexes.html new file mode 100644 index 000000000000..83afb1630fda --- /dev/null +++ b/dom/indexedDB/test/test_autoIncrement_indexes.html @@ -0,0 +1,71 @@ + + + + Indexed Database Property Test + + + + + + + + + + + + +