Title: [136084] trunk
Revision
136084
Author
jsb...@chromium.org
Date
2012-11-28 18:24:38 -0800 (Wed, 28 Nov 2012)

Log Message

[Chromium] IndexedDB: Assert/crash in indexing layout tests in content_shell
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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136083 => 136084)


--- trunk/LayoutTests/ChangeLog	2012-11-29 02:24:31 UTC (rev 136083)
+++ trunk/LayoutTests/ChangeLog	2012-11-29 02:24:38 UTC (rev 136084)
@@ -1,3 +1,15 @@
+2012-11-28  Joshua Bell  <jsb...@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  <k...@webkit.org>
 
         Remove -webkit-mask-attachment

Modified: trunk/LayoutTests/storage/indexeddb/resources/transaction-error.js (136083 => 136084)


--- trunk/LayoutTests/storage/indexeddb/resources/transaction-error.js	2012-11-29 02:24:31 UTC (rev 136083)
+++ trunk/LayoutTests/storage/indexeddb/resources/transaction-error.js	2012-11-29 02:24:38 UTC (rev 136084)
@@ -96,7 +96,7 @@
     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");

Modified: trunk/Source/WebCore/ChangeLog (136083 => 136084)


--- trunk/Source/WebCore/ChangeLog	2012-11-29 02:24:31 UTC (rev 136083)
+++ trunk/Source/WebCore/ChangeLog	2012-11-29 02:24:38 UTC (rev 136084)
@@ -1,3 +1,23 @@
+2012-11-28  Joshua Bell  <jsb...@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  <shin...@chromium.org>
 
         [Shadow] Move Distribution requirements from ShadowRoot

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp (136083 => 136084)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-11-29 02:24:31 UTC (rev 136083)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-11-29 02:24:38 UTC (rev 136084)
@@ -226,6 +226,8 @@
     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 @@
 
     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,

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp (136083 => 136084)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-11-29 02:24:31 UTC (rev 136083)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-11-29 02:24:38 UTC (rev 136084)
@@ -190,6 +190,11 @@
 {
     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;
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h (136083 => 136084)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h	2012-11-29 02:24:31 UTC (rev 136083)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h	2012-11-29 02:24:38 UTC (rev 136084)
@@ -59,6 +59,7 @@
     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*);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to