IndexedDB: call abort handler when there are problems committing
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 May 2012 22:09:10 +0000 (22:09 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 May 2012 22:09:10 +0000 (22:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85841

Patch by Alec Flett <alecflett@chromium.org> on 2012-05-09
Reviewed by Ojan Vafai.

No new tests. Every existing test that calls commit() is testing
the success side of this, and this only throws when there are
LevelDB errors, which is exactly what we're trying to diagnose
with this patch.

* Modules/indexeddb/IDBBackingStore.h:
(Transaction):
* Modules/indexeddb/IDBLevelDBBackingStore.cpp:
(WebCore::IDBLevelDBBackingStore::deleteDatabase):
(WebCore::IDBLevelDBBackingStore::Transaction::commit):
* Modules/indexeddb/IDBLevelDBBackingStore.h:
(Transaction):
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::commit):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@116562 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.h
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp

index bd7df4f..c4d8405 100644 (file)
@@ -1,3 +1,25 @@
+2012-05-09  Alec Flett  <alecflett@chromium.org>
+
+        IndexedDB: call abort handler when there are problems committing
+        https://bugs.webkit.org/show_bug.cgi?id=85841
+
+        Reviewed by Ojan Vafai.
+
+        No new tests. Every existing test that calls commit() is testing
+        the success side of this, and this only throws when there are
+        LevelDB errors, which is exactly what we're trying to diagnose
+        with this patch.
+
+        * Modules/indexeddb/IDBBackingStore.h:
+        (Transaction):
+        * Modules/indexeddb/IDBLevelDBBackingStore.cpp:
+        (WebCore::IDBLevelDBBackingStore::deleteDatabase):
+        (WebCore::IDBLevelDBBackingStore::Transaction::commit):
+        * Modules/indexeddb/IDBLevelDBBackingStore.h:
+        (Transaction):
+        * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+        (WebCore::IDBTransactionBackendImpl::commit):
+
 2012-05-09  Mark Pilgrim  <pilgrim@chromium.org>
 
         [Chromium] Remove PlatformSupport::loadPlatformImageResource, call loadResource directly
index 9be26db..e7b2222 100644 (file)
@@ -113,7 +113,7 @@ public:
     public:
         virtual ~Transaction() { }
         virtual void begin() = 0;
-        virtual void commit() = 0;
+        virtual bool commit() = 0;
         virtual void rollback() = 0;
     };
     virtual PassRefPtr<Transaction> createTransaction() = 0;
index 2a7fdfe..c7ef752 100644 (file)
@@ -309,8 +309,7 @@ bool IDBLevelDBBackingStore::deleteDatabase(const String& name)
     const Vector<char> key = DatabaseNameKey::encode(m_identifier, name);
     m_currentTransaction->remove(key);
 
-    transaction->commit();
-    return true;
+    return transaction->commit();
 }
 
 static bool checkObjectStoreAndMetaDataType(const LevelDBIterator* it, const Vector<char>& stopKey, int64_t objectStoreId, int64_t metaDataType)
@@ -1575,11 +1574,12 @@ void IDBLevelDBBackingStore::Transaction::begin()
     m_backingStore->m_currentTransaction = LevelDBTransaction::create(m_backingStore->m_db.get());
 }
 
-void IDBLevelDBBackingStore::Transaction::commit()
+bool IDBLevelDBBackingStore::Transaction::commit()
 {
     ASSERT(m_backingStore->m_currentTransaction);
-    m_backingStore->m_currentTransaction->commit();
+    bool result = m_backingStore->m_currentTransaction->commit();
     m_backingStore->m_currentTransaction.clear();
+    return result;
 }
 
 void IDBLevelDBBackingStore::Transaction::rollback()
index ec3063b..e17a6f1 100644 (file)
@@ -93,7 +93,7 @@ private:
     public:
         static PassRefPtr<Transaction> create(IDBLevelDBBackingStore*);
         virtual void begin();
-        virtual void commit();
+        virtual bool commit();
         virtual void rollback();
 
     private:
index 012e6b6..0a79a97 100644 (file)
@@ -197,8 +197,10 @@ void IDBTransactionBackendImpl::commit()
 
     m_state = Finished;
     closeOpenCursors();
-    m_transaction->commit();
-    m_callbacks->onComplete();
+    if (m_transaction->commit())
+        m_callbacks->onComplete();
+    else
+        m_callbacks->onAbort();
     m_database->transactionCoordinator()->didFinishTransaction(this);
     m_database->transactionFinished(this);
     m_database = 0;