[Chromium] IndexedDB: Assert/crash in indexing layout tests in content_shell
authorjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2012 02:24:38 +0000 (02:24 +0000)
committerjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 29 Nov 2012 02:24:38 +0000 (02:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=103562

Reviewed by Tony Chang.

Source/WebCore:

In multi-process ports, an commit request or setIndexesReady request may arrive from the
front-end after the back-end has already aborted. Don't freak out if those occur.

Tests: storage/indexeddb/index-population.html
       storage/indexeddb/lazy-index-population.html
       storage/indexeddb/transaction-error.html

* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::setIndexKeys): Ensure transaction hasn't finished before continuing.
(WebCore::IDBObjectStoreBackendImpl::setIndexesReady): Ditto.
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::commit): Ignore a commit request if already aborted.

LayoutTests:

Fix an expectation glitch that may arise in multi-process ports (an error on
the open request may arrive before logging has stopped; safe to ignore it).

* storage/indexeddb/resources/transaction-error.js:

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

LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/resources/transaction-error.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h

index 252266f..37fd577 100644 (file)
@@ -1,3 +1,15 @@
+2012-11-28  Joshua Bell  <jsbell@chromium.org>
+
+        [Chromium] IndexedDB: Assert/crash in indexing layout tests in content_shell
+        https://bugs.webkit.org/show_bug.cgi?id=103562
+
+        Reviewed by Tony Chang.
+
+        Fix an expectation glitch that may arise in multi-process ports (an error on
+        the open request may arrive before logging has stopped; safe to ignore it).
+
+        * storage/indexeddb/resources/transaction-error.js:
+
 2012-11-23  Dirk Schulze  <krit@webkit.org>
 
         Remove -webkit-mask-attachment
index e1c18bf..afa6b58 100644 (file)
@@ -96,7 +96,7 @@ function testErrorFromCommit()
     trans.oncomplete = function() {
         db.close();
         evalAndLog("request = indexedDB.open(dbname, 2)");
-        request.onerror = unexpectedSuccessCallback;
+        request.onsuccess = unexpectedSuccessCallback;
         request.onblocked = unexpectedBlockedCallback;
         request.onupgradeneeded = function() {
             evalAndLog("trans = request.transaction");
index dbdd4e4..302b8c0 100644 (file)
@@ -1,3 +1,23 @@
+2012-11-28  Joshua Bell  <jsbell@chromium.org>
+
+        [Chromium] IndexedDB: Assert/crash in indexing layout tests in content_shell
+        https://bugs.webkit.org/show_bug.cgi?id=103562
+
+        Reviewed by Tony Chang.
+
+        In multi-process ports, an commit request or setIndexesReady request may arrive from the
+        front-end after the back-end has already aborted. Don't freak out if those occur.
+
+        Tests: storage/indexeddb/index-population.html
+               storage/indexeddb/lazy-index-population.html
+               storage/indexeddb/transaction-error.html
+
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::setIndexKeys): Ensure transaction hasn't finished before continuing.
+        (WebCore::IDBObjectStoreBackendImpl::setIndexesReady): Ditto.
+        * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+        (WebCore::IDBTransactionBackendImpl::commit): Ignore a commit request if already aborted.
+
 2012-11-28  Shinya Kawanaka  <shinyak@chromium.org>
 
         [Shadow] Move Distribution requirements from ShadowRoot
index 6a14ad7..c90dac2 100644 (file)
@@ -226,6 +226,8 @@ void IDBObjectStoreBackendImpl::setIndexKeys(PassRefPtr<IDBKey> prpPrimaryKey, c
     IDB_TRACE("IDBObjectStoreBackendImpl::setIndexKeys");
     RefPtr<IDBKey> primaryKey = prpPrimaryKey;
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionPtr);
+    if (transaction->isFinished())
+        return;
 
     // FIXME: This method could be asynchronous, but we need to evaluate if it's worth the extra complexity.
     IDBBackingStore::RecordIdentifier recordIdentifier;
@@ -255,6 +257,8 @@ void IDBObjectStoreBackendImpl::setIndexesReady(const Vector<int64_t>& indexIds,
 
     OwnPtr<Vector<int64_t> > newIndexIds = adoptPtr(new Vector<int64_t>(indexIds));
     RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::from(transactionInterface);
+    if (transaction->isFinished())
+        return;
 
     if (!transaction->scheduleTask(
             IDBTransactionBackendInterface::PreemptiveTask,
index 78eb7d0..b8c77ed 100644 (file)
@@ -190,6 +190,11 @@ void IDBTransactionBackendImpl::commit()
 {
     IDB_TRACE("IDBTransactionBackendImpl::commit");
 
+    // In multiprocess ports, front-end may have requested a commit but an abort has already
+    // been initiated asynchronously by the back-end.
+    if (m_state == Finished)
+        return;
+
     ASSERT(m_state == Unused || m_state == Running);
     m_commitPending = true;
 
index 05adae7..d2a9585 100644 (file)
@@ -59,6 +59,7 @@ public:
     void abort(PassRefPtr<IDBDatabaseError>);
     void run();
     unsigned short mode() const { return m_mode; }
+    bool isFinished() const { return m_state == Finished; }
     bool scheduleTask(PassOwnPtr<ScriptExecutionContext::Task> task, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr) { return scheduleTask(NormalTask, task, abortTask); }
     bool scheduleTask(TaskType, PassOwnPtr<ScriptExecutionContext::Task>, PassOwnPtr<ScriptExecutionContext::Task> abortTask = nullptr);
     void registerOpenCursor(IDBCursorBackendImpl*);