Modern IDB: storage/indexeddb/database-deletepending-flag.html fails.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Jan 2016 05:48:58 +0000 (05:48 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Jan 2016 05:48:58 +0000 (05:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=152600

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (At least one failing test now passes, and at least 2 crashing tests now timeout).

* Modules/indexeddb/server/IDBBackingStore.h:

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::deleteBackingStore):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
(WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

LayoutTests:

* platform/mac-wk1/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/platform/mac-wk1/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h

index e472399..0d056cf 100644 (file)
@@ -1,3 +1,12 @@
+2016-01-01  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: storage/indexeddb/database-deletepending-flag.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=152600
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+
 2016-01-01  Simon Fraser  <simon.fraser@apple.com>
 
         Fix reload and programmatic scrolling in RTL documents
index 0a4e620..4a60ba3 100644 (file)
@@ -69,8 +69,6 @@ imported/w3c/indexeddb
 inspector/indexeddb
 
 # IDB tests that crash
-storage/indexeddb/deletedatabase-delayed-by-versionchange.html [ Skip ]
-storage/indexeddb/intversion-long-queue.html [ Skip ]
 storage/indexeddb/lazy-index-population.html [ Skip ]
 storage/indexeddb/structured-clone.html [ Skip ]
 
@@ -90,11 +88,12 @@ webkit.org/b/152264 storage/indexeddb/deleted-objects.html [ Failure Crash ]
 
 # IDB tests that timeout                                                               
 storage/indexeddb/database-quota.html [ Skip ]
+storage/indexeddb/deletedatabase-delayed-by-versionchange.html [ Skip ]
 storage/indexeddb/dont-wedge.html [ Skip ]
+storage/indexeddb/intversion-long-queue.html [ Skip ]
 storage/indexeddb/transaction-starvation.html [ Skip ]
 
 # IDB tests with text failures                                                             
-storage/indexeddb/database-deletepending-flag.html [ Failure ]
 storage/indexeddb/intversion-gated-on-delete.html [ Failure ]
 storage/indexeddb/odd-strings.html [ Failure ]
 storage/indexeddb/open-db-private-browsing.html [ Failure ]
index 857a90a..8eb9ada 100644 (file)
@@ -1,3 +1,24 @@
+2016-01-01  Brady Eidson  <beidson@apple.com>
+
+        Modern IDB: storage/indexeddb/database-deletepending-flag.html fails.
+        https://bugs.webkit.org/show_bug.cgi?id=152600
+
+        Reviewed by Alex Christensen.
+
+        No new tests (At least one failing test now passes, and at least 2 crashing tests now timeout).
+
+        * Modules/indexeddb/server/IDBBackingStore.h:
+        
+        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+        (WebCore::IDBServer::MemoryIDBBackingStore::deleteBackingStore):
+        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
+        (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
+        (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+
 2016-01-01  Simon Fraser  <simon.fraser@apple.com>
 
         Fix reload and programmatic scrolling in RTL documents
index 68506a0..0a1f01b 100644 (file)
@@ -75,6 +75,8 @@ public:
     virtual IDBError maybeUpdateKeyGeneratorNumber(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, double newKeyNumber) = 0;
     virtual IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult) = 0;
     virtual IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBKeyData&, uint32_t count, IDBGetResult& outResult) = 0;
+
+    virtual void deleteBackingStore() = 0;
 };
 
 } // namespace IDBServer
index 4ce9eb8..5c73918 100644 (file)
@@ -459,6 +459,11 @@ std::unique_ptr<MemoryObjectStore> MemoryIDBBackingStore::takeObjectStoreByName(
     return objectStore;
 }
 
+void MemoryIDBBackingStore::deleteBackingStore()
+{
+    // The in-memory IDB backing store doesn't need to do any cleanup when it is deleted.
+}
+
 } // namespace IDBServer
 } // namespace WebCore
 
index 300dd41..b14be4f 100644 (file)
@@ -68,6 +68,8 @@ public:
     virtual IDBError openCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBCursorInfo&, IDBGetResult& outResult) override final;
     virtual IDBError iterateCursor(const IDBResourceIdentifier& transactionIdentifier, const IDBResourceIdentifier& cursorIdentifier, const IDBKeyData&, uint32_t count, IDBGetResult& outResult) override final;
 
+    virtual void deleteBackingStore() override final;
+
     void removeObjectStoreForVersionChangeAbort(MemoryObjectStore&);
     void restoreObjectStoreForVersionChangeAbort(std::unique_ptr<MemoryObjectStore>&&);
 
index eb6677d..c90e224 100644 (file)
@@ -163,12 +163,16 @@ void UniqueIDBDatabase::performCurrentOpenOperation()
 
 void UniqueIDBDatabase::performCurrentDeleteOperation()
 {
+    ASSERT(isMainThread());
     LOG(IndexedDB, "(main) UniqueIDBDatabase::performCurrentDeleteOperation");
 
     ASSERT(m_databaseInfo);
     ASSERT(m_currentOpenDBRequest);
     ASSERT(m_currentOpenDBRequest->isDeleteRequest());
 
+    if (m_deleteBackingStoreInProgress)
+        return;
+
     if (hasAnyOpenConnections()) {
         maybeNotifyConnectionsOfVersionChange();
         return;
@@ -179,9 +183,41 @@ void UniqueIDBDatabase::performCurrentDeleteOperation()
     ASSERT(m_pendingTransactions.isEmpty());
     ASSERT(m_openDatabaseConnections.isEmpty());
 
+    m_deleteBackingStoreInProgress = true;
+    m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::deleteBackingStore));
+}
+
+void UniqueIDBDatabase::deleteBackingStore()
+{
+    ASSERT(!isMainThread());
+    LOG(IndexedDB, "(db) UniqueIDBDatabase::deleteBackingStore");
+
+    if (m_backingStore) {
+        m_backingStore->deleteBackingStore();
+        m_backingStore = nullptr;
+    }
+
+    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didDeleteBackingStore));
+}
+
+void UniqueIDBDatabase::didDeleteBackingStore()
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::didDeleteBackingStore");
+
+    ASSERT(m_databaseInfo);
+    ASSERT(m_currentOpenDBRequest);
+    ASSERT(m_currentOpenDBRequest->isDeleteRequest());
+    ASSERT(!hasAnyPendingCallbacks());
+    ASSERT(m_inProgressTransactions.isEmpty());
+    ASSERT(m_pendingTransactions.isEmpty());
+    ASSERT(m_openDatabaseConnections.isEmpty());
+
     m_currentOpenDBRequest->notifyDidDeleteDatabase(*m_databaseInfo);
     m_currentOpenDBRequest = nullptr;
+    m_databaseInfo = nullptr;
     m_deletePending = false;
+    m_deleteBackingStoreInProgress = false;
 
     if (m_pendingOpenDBRequests.isEmpty())
         m_server.deleteUniqueIDBDatabase(*this);
index f4c8cfe..35a97ae 100644 (file)
@@ -124,6 +124,7 @@ private:
     void inProgressTransactionCompleted(const IDBResourceIdentifier&);
 
     // Database thread operations
+    void deleteBackingStore();
     void openBackingStore(const IDBDatabaseIdentifier&);
     void performCommitTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier);
     void performAbortTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier);
@@ -143,6 +144,7 @@ private:
     void performActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBTransactionInfo&);
 
     // Main thread callbacks
+    void didDeleteBackingStore();
     void didOpenBackingStore(const IDBDatabaseInfo&);
     void didPerformCreateObjectStore(uint64_t callbackIdentifier, const IDBError&, const IDBObjectStoreInfo&);
     void didPerformDeleteObjectStore(uint64_t callbackIdentifier, const IDBError&, const String& objectStoreName);
@@ -208,6 +210,7 @@ private:
     HashCountedSet<uint64_t> m_objectStoreTransactionCounts;
 
     bool m_deletePending { false };
+    bool m_deleteBackingStoreInProgress { false };
 };
 
 } // namespace IDBServer