Unreviewed, rolling out r239358.
authortsavell@apple.com <tsavell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2018 18:57:09 +0000 (18:57 +0000)
committertsavell@apple.com <tsavell@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Dec 2018 18:57:09 +0000 (18:57 +0000)
Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
crash on Debug bots

Reverted changeset:

"Clean up IndexedDB files between tests"
https://bugs.webkit.org/show_bug.cgi?id=192796
https://trac.webkit.org/changeset/239358

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

Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/TestController.h
Tools/WebKitTestRunner/TestInvocation.cpp

index c7187ed..e96c6ac 100644 (file)
@@ -1,3 +1,16 @@
+2018-12-19  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r239358.
+
+        Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
+        crash on Debug bots
+
+        Reverted changeset:
+
+        "Clean up IndexedDB files between tests"
+        https://bugs.webkit.org/show_bug.cgi?id=192796
+        https://trac.webkit.org/changeset/239358
+
 2018-12-19  Don Olmstead  <don.olmstead@sony.com>
 
         Sync some include directories in WebCore
index a2cfa99..cb17ba1 100644 (file)
@@ -509,8 +509,8 @@ void IDBServer::closeAndDeleteDatabasesModifiedSince(WallTime modificationTime,
     }
 
     HashSet<UniqueIDBDatabase*> openDatabases;
-    for (auto& database : m_uniqueIDBDatabaseMap.values())
-        openDatabases.add(database.get());
+    for (auto* connection : m_databaseConnections.values())
+        openDatabases.add(connection->database());
 
     for (auto& database : openDatabases)
         database->immediateCloseForUserDelete();
index cf20e9c..4e2a2df 100644 (file)
@@ -294,10 +294,7 @@ void UniqueIDBDatabase::shutdownForClose()
     m_backingStoreSupportsSimultaneousTransactions = false;
     m_backingStoreIsEphemeral = false;
 
-    if (!m_databaseQueue.isEmpty()) {
-        postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::shutdownForClose));
-        return;
-    }
+    ASSERT(m_databaseQueue.isEmpty());
     m_databaseQueue.kill();
 
     postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didShutdownForClose));
@@ -339,18 +336,14 @@ void UniqueIDBDatabase::didDeleteBackingStore(uint64_t deletedVersion)
     }
 
     m_deleteBackingStoreInProgress = false;
-
-    if (!m_hardClosedForUserDelete)
-        invokeOperationAndTransactionTimer();
+    invokeOperationAndTransactionTimer();
 }
 
 void UniqueIDBDatabase::handleDatabaseOperations()
 {
     ASSERT(isMainThread());
     LOG(IndexedDB, "(main) UniqueIDBDatabase::handleDatabaseOperations - There are %u pending", m_pendingOpenDBRequests.size());
-
-    if (m_hardClosedForUserDelete)
-        return;
+    ASSERT(!m_hardClosedForUserDelete);
 
     if (m_deleteBackingStoreInProgress)
         return;
@@ -1285,9 +1278,6 @@ void UniqueIDBDatabase::performPrefetchCursor(const IDBResourceIdentifier& trans
     ASSERT(m_cursorPrefetches.contains(cursorIdentifier));
     LOG(IndexedDB, "(db) UniqueIDBDatabase::performPrefetchCursor");
 
-    if (m_owningPointerForClose)
-        return;
-
     if (m_backingStore->prefetchCursor(transactionIdentifier, cursorIdentifier))
         postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performPrefetchCursor, transactionIdentifier, cursorIdentifier));
     else
@@ -1828,6 +1818,8 @@ void UniqueIDBDatabase::immediateCloseForUserDelete()
     for (auto& transaction : m_pendingTransactions)
         transaction->databaseConnection().deleteTransaction(*transaction);
     m_pendingTransactions.clear();
+    m_objectStoreTransactionCounts.clear();
+    m_objectStoreWriteTransactions.clear();
 
     // Error out all pending callbacks
     IDBError error = IDBError::userDeleteError();
index 6f6d61c..8b59e74 100644 (file)
@@ -1,3 +1,16 @@
+2018-12-19  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r239358.
+
+        Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
+        crash on Debug bots
+
+        Reverted changeset:
+
+        "Clean up IndexedDB files between tests"
+        https://bugs.webkit.org/show_bug.cgi?id=192796
+        https://trac.webkit.org/changeset/239358
+
 2018-12-18  Alex Christensen  <achristensen@webkit.org>
 
         REGRESSION(r239134) iOS safe browsing warning unable to show details
index c6be6f5..a3e3468 100644 (file)
@@ -511,13 +511,10 @@ void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStore
     });
 }
 
-void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllIndexedDatabasesCallback callback)
+void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef)
 {
     OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::IndexedDBDatabases;
-    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [context, callback] {
-        if (callback)
-            callback(context);
-    });
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [] { });
 }
 
 void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllServiceWorkerRegistrationsCallback callback)
index 93e5218..01b98e1 100644 (file)
@@ -103,8 +103,7 @@ WK_EXPORT void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef data
 typedef void (*WKWebsiteDataStoreRemoveAllServiceWorkerRegistrationsCallback)(void* functionContext);
 WK_EXPORT void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllServiceWorkerRegistrationsCallback callback);
 
-typedef void (*WKWebsiteDataStoreRemoveAllIndexedDatabasesCallback)(void* functionContext);
-WK_EXPORT void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllIndexedDatabasesCallback callback);
+WK_EXPORT void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef);
 
 typedef void (*WKWebsiteDataStoreGetFetchCacheOriginsFunction)(WKArrayRef, void*);
 WK_EXPORT void WKWebsiteDataStoreGetFetchCacheOrigins(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreGetFetchCacheOriginsFunction function);
index 1b01b1d..5810e6f 100644 (file)
@@ -1,3 +1,16 @@
+2018-12-19  Truitt Savell  <tsavell@apple.com>
+
+        Unreviewed, rolling out r239358.
+
+        Revision caused imported/w3c/web-platform-tests/IndexedDB/ to
+        crash on Debug bots
+
+        Reverted changeset:
+
+        "Clean up IndexedDB files between tests"
+        https://bugs.webkit.org/show_bug.cgi?id=192796
+        https://trac.webkit.org/changeset/239358
+
 2018-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] A copied text selection is pasted as a web archive attachment in the entry view in Messages
index 3cb77ff..5de612c 100644 (file)
@@ -2012,8 +2012,6 @@ static void runTest(const string& inputLine)
     sizeWebViewForCurrentTest();
     gTestRunner->setIconDatabaseEnabled(false);
     gTestRunner->clearAllApplicationCaches();
-    gTestRunner->clearAllDatabases();
-    gTestRunner->setIDBPerOriginQuota(50 * MB);
 
     if (disallowedURLs)
         CFSetRemoveAllValues(disallowedURLs);
index d4ded00..2f98ed3 100644 (file)
@@ -867,9 +867,6 @@ bool TestController::resetStateToConsistentValues(const TestOptions& options, Re
 
     WKContextClearCachedCredentials(TestController::singleton().context());
 
-    ClearIndexedDatabases();
-    setIDBPerOriginQuota(50 * MB);
-
     clearServiceWorkerRegistrations();
     clearDOMCaches();
 
@@ -2762,28 +2759,6 @@ void TestController::setIDBPerOriginQuota(uint64_t quota)
     WKContextSetIDBPerOriginQuota(platformContext(), quota);
 }
 
-struct RemoveAllIndexedDatabasesCallbackContext {
-    explicit RemoveAllIndexedDatabasesCallbackContext(TestController& controller)
-        : testController(controller)
-        {
-        }
-    TestController& testController;
-    bool done { false };
-};
-static void RemoveAllIndexedDatabasesCallback(void* userData)
-{
-    auto* context = static_cast<RemoveAllIndexedDatabasesCallbackContext*>(userData);
-    context->done = true;
-    context->testController.notifyDone();
-}
-void TestController::ClearIndexedDatabases()
-{
-    auto websiteDataStore = WKContextGetWebsiteDataStore(platformContext());
-    RemoveAllIndexedDatabasesCallbackContext context(*this);
-    WKWebsiteDataStoreRemoveAllIndexedDatabases(websiteDataStore, &context, RemoveAllIndexedDatabasesCallback);
-    runUntil(context.done, noTimeout);
-}
-
 struct FetchCacheOriginsCallbackContext {
     FetchCacheOriginsCallbackContext(TestController& controller, WKStringRef origin)
         : testController(controller)
index acb4b98..13a39c6 100644 (file)
@@ -242,8 +242,6 @@ public:
 
     void removeAllSessionCredentials();
 
-    void ClearIndexedDatabases();
-
     void clearServiceWorkerRegistrations();
 
     void clearDOMCache(WKStringRef origin);
index c037301..1a91eb2 100644 (file)
@@ -903,7 +903,7 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB
     }
     
     if (WKStringIsEqualToUTF8CString(messageName, "DeleteAllIndexedDatabases")) {
-        WKWebsiteDataStoreRemoveAllIndexedDatabases(WKContextGetWebsiteDataStore(TestController::singleton().context()), nullptr, { });
+        WKWebsiteDataStoreRemoveAllIndexedDatabases(WKContextGetWebsiteDataStore(TestController::singleton().context()));
         return nullptr;
     }