Changeset 106705 in webkit
- Timestamp:
- Feb 3, 2012, 4:16:45 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/storage/indexeddb/key-generator-expected.txt (added)
-
LayoutTests/storage/indexeddb/key-generator.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp (modified) (4 diffs)
-
Source/WebCore/storage/IDBObjectStoreBackendImpl.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106704 r106705 1 2012-02-03 Joshua Bell <jsbell@chromium.org> 2 3 IndexedDB: Key generators not rolled back if insertion fails or is aborted 4 https://bugs.webkit.org/show_bug.cgi?id=77060 5 6 Reviewed by Tony Chang. 7 8 * storage/indexeddb/key-generator-expected.txt: Added. 9 * storage/indexeddb/key-generator.html: Added. 10 1 11 2012-02-03 Tony Chang <tony@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r106704 r106705 1 2012-02-03 Joshua Bell <jsbell@chromium.org> 2 3 IndexedDB: Key generators not rolled back if insertion fails or is aborted 4 https://bugs.webkit.org/show_bug.cgi?id=77060 5 6 Reviewed by Tony Chang. 7 8 Test: storage/indexeddb/key-generator.html 9 10 * storage/IDBObjectStoreBackendImpl.cpp: 11 (WebCore::IDBObjectStoreBackendImpl::put): Add abort task to reset cache. 12 (WebCore::IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache): 13 (WebCore): 14 (WebCore::IDBObjectStoreBackendImpl::putInternal): Reset cache on error. 15 * storage/IDBObjectStoreBackendImpl.h: 16 (IDBObjectStoreBackendImpl): 17 1 18 2012-02-03 Tony Chang <tony@chromium.org> 2 19 -
trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp
r106387 r106705 179 179 } 180 180 181 if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction))) 182 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; 181 if (!transaction->scheduleTask( 182 createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction), 183 // FIXME: One of these per put() is overkill, since it's simply a cache invalidation. 184 createCallbackTask(&IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache, objectStore))) 185 ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; 186 } 187 188 void IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore) 189 { 190 objectStore->resetAutoIncrementKeyCache(); 183 191 } 184 192 … … 205 213 RefPtr<SerializedScriptValue> valueAfterInjection = injectKeyIntoKeyPath(autoIncKey, value, objectStore->m_keyPath); 206 214 if (!valueAfterInjection) { 215 objectStore->resetAutoIncrementKeyCache(); 207 216 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "The generated key could not be inserted into the object using the keyPath.")); 208 217 return; … … 222 231 RefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> recordIdentifier = objectStore->m_backingStore->createInvalidRecordIdentifier(); 223 232 if (putMode == AddOnly && objectStore->m_backingStore->keyExistsInObjectStore(objectStore->m_databaseId, objectStore->id(), *key, recordIdentifier.get())) { 233 objectStore->resetAutoIncrementKeyCache(); 224 234 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Key already exists in the object store.")); 225 235 return; … … 238 248 239 249 if ((!index->multiEntry() || indexKey->type() != IDBKey::ArrayType) && !index->addingKeyAllowed(indexKey.get(), key.get())) { 250 objectStore->resetAutoIncrementKeyCache(); 240 251 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); 241 252 return; 242 253 } 243 254 244 if (index->multiEntry() && indexKey->type() == IDBKey::ArrayType) {255 if (index->multiEntry() && indexKey->type() == IDBKey::ArrayType) { 245 256 for (size_t j = 0; j < indexKey->array().size(); ++j) { 246 257 if (!index->addingKeyAllowed(indexKey->array()[j].get(), key.get())) { 258 objectStore->resetAutoIncrementKeyCache(); 247 259 callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); 248 260 return; -
trunk/Source/WebCore/storage/IDBObjectStoreBackendImpl.h
r106387 r106705 101 101 static void removeIndexFromMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>); 102 102 static void addIndexToMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>); 103 static void revertAutoIncrementKeyCache(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>); 103 104 104 105 RefPtr<IDBBackingStore> m_backingStore;
Note:
See TracChangeset
for help on using the changeset viewer.