IndexedDB: Propagate more leveldb errors to script
authordgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2012 02:22:20 +0000 (02:22 +0000)
committerdgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Nov 2012 02:22:20 +0000 (02:22 +0000)
commite09aa29b2dce135e312e6ce1ca2555115fe08383
treed157151bdf941437c862df71d89c054ee14ed418
parentbbc0e13d11f09cdd77956d7a52666b999d3c2405
IndexedDB: Propagate more leveldb errors to script
https://bugs.webkit.org/show_bug.cgi?id=103580

Reviewed by Tony Chang.

Source/WebCore:

LevelDBDatabase used a single return value to indicate both I/O problems
and a missing key. Now an out variable is used to indicate if the
requested key was found. The return value is used to report corruption
or disk error.

This is a small step toward propagating low level errors everywhere
possible. So far only one scenario will newly cause script to receive
an error: when leveldb has trouble looking for existing keys during an
objectstore->add.

* Modules/indexeddb/IDBBackingStore.cpp:
(WebCore::getInt):
(WebCore::getVarInt):
(WebCore::getString):
(WebCore::IDBBackingStore::getKeyGeneratorCurrentNumber):
(WebCore::IDBBackingStore::maybeUpdateKeyGeneratorCurrentNumber):
(WebCore::IDBBackingStore::keyExistsInObjectStore):
* Modules/indexeddb/IDBBackingStore.h:
(IDBBackingStore):
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::setIndexKeys):
(WebCore::IDBObjectStoreBackendImpl::putInternal):
(WebCore::IDBObjectStoreBackendImpl::generateKey):
(WebCore::IDBObjectStoreBackendImpl::updateKeyGenerator):
* Modules/indexeddb/IDBObjectStoreBackendImpl.h:
(IDBObjectStoreBackendImpl):
* platform/leveldb/LevelDBDatabase.cpp:
(WebCore::LevelDBDatabase::safeGet):
* platform/leveldb/LevelDBDatabase.h:
(LevelDBDatabase):
* platform/leveldb/LevelDBTransaction.cpp:
(WebCore::LevelDBTransaction::safeGet):
(WebCore):
(WebCore::LevelDBTransaction::get):
* platform/leveldb/LevelDBTransaction.h:
(LevelDBTransaction):

Source/WebKit/chromium:

* tests/IDBFakeBackingStore.h:
 Update method signatures.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@136194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h
Source/WebCore/platform/leveldb/LevelDBDatabase.cpp
Source/WebCore/platform/leveldb/LevelDBDatabase.h
Source/WebCore/platform/leveldb/LevelDBTransaction.cpp
Source/WebCore/platform/leveldb/LevelDBTransaction.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/IDBFakeBackingStore.h
Source/WebKit/chromium/tests/LevelDBTest.cpp