ASSERTION FAILED: !m_backingStore in WebCore::IDBServer::UniqueIDBDatabase::didDelete...
authorsihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2019 23:44:23 +0000 (23:44 +0000)
committersihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2019 23:44:23 +0000 (23:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=197741
<rdar://problem/50625006>

Reviewed by Youenn Fablet.

If an open request is made before a delete request, open task should be performed before delete task on the
database thread. After r242911, open request needs to wait decision of StorageQuotaManager before posting task
to database thread, while delete request needs not. This makes deletion happen before open.

We need to make sure tasks are in correct order by not starting next open or delete request when database is in
the middle of open or deletion.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
(WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp

index c27503d..fdc28c1 100644 (file)
@@ -1,3 +1,22 @@
+2019-05-17  Sihui Liu  <sihui_liu@apple.com>
+
+        ASSERTION FAILED: !m_backingStore in WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore(uint64_t)
+        https://bugs.webkit.org/show_bug.cgi?id=197741
+        <rdar://problem/50625006>
+
+        Reviewed by Youenn Fablet.
+
+        If an open request is made before a delete request, open task should be performed before delete task on the
+        database thread. After r242911, open request needs to wait decision of StorageQuotaManager before posting task
+        to database thread, while delete request needs not. This makes deletion happen before open.
+
+        We need to make sure tasks are in correct order by not starting next open or delete request when database is in 
+        the middle of open or deletion.
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
+        (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
+
 2019-05-17  Antoine Quint  <graouts@apple.com>
 
         Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
index 4b54d9c..b94b82c 100644 (file)
@@ -228,6 +228,7 @@ void UniqueIDBDatabase::performCurrentOpenOperation()
                     auto result = IDBResultData::error(m_currentOpenDBRequest->requestData().requestIdentifier(), IDBError { QuotaExceededError, quotaErrorMessageName("openDatabase") });
                     m_currentOpenDBRequest->connection().didOpenDatabase(result);
                     m_currentOpenDBRequest = nullptr;
+                    m_isOpeningBackingStore = false;
                     break;
                 }
                 case StorageQuotaManager::Decision::Grant:
@@ -460,7 +461,7 @@ void UniqueIDBDatabase::handleDatabaseOperations()
     LOG(IndexedDB, "(main) UniqueIDBDatabase::handleDatabaseOperations - There are %u pending", m_pendingOpenDBRequests.size());
     ASSERT(!m_hardClosedForUserDelete);
 
-    if (m_deleteBackingStoreInProgress)
+    if (m_deleteBackingStoreInProgress || m_isOpeningBackingStore)
         return;
 
     clearStalePendingOpenDBRequests();