Skip to content
Permalink
Browse files
Clean up IndexedDB files between tests
https://bugs.webkit.org/show_bug.cgi?id=192796
<rdar://problem/46824999>

Reviewed by Geoffrey Garen.

Source/WebCore:

We should clean up the IndexedDB files between tests to make sure each IDB test is independent of others.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted):

Source/WebKit:

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreRemoveAllIndexedDatabases):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(runTest):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::RemoveAllIndexedDatabasesCallbackContext::RemoveAllIndexedDatabasesCallbackContext):
(WTR::RemoveAllIndexedDatabasesCallback):
(WTR::TestController::ClearIndexedDatabases):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):


Canonical link: https://commits.webkit.org/208256@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240358 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
szewai committed Jan 23, 2019
1 parent 777eb87 commit a4dbbd0ebd6afd625c7e9ace27f5b4aaf6a160c0
Showing 10 changed files with 94 additions and 5 deletions.
@@ -1,3 +1,17 @@
2019-01-23 Sihui Liu <sihui_liu@apple.com>

Clean up IndexedDB files between tests
https://bugs.webkit.org/show_bug.cgi?id=192796
<rdar://problem/46824999>

Reviewed by Geoffrey Garen.

We should clean up the IndexedDB files between tests to make sure each IDB test is independent of others.

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted):

2019-01-23 Oriol Brufau <obrufau@igalia.com>

Add CSS Logical spec to features.json
@@ -337,6 +337,10 @@ void UniqueIDBDatabase::didDeleteBackingStore(uint64_t deletedVersion)
}

m_deleteBackingStoreInProgress = false;

if (m_hardClosedForUserDelete)
return;

invokeOperationAndTransactionTimer();
}

@@ -634,6 +638,9 @@ void UniqueIDBDatabase::didOpenBackingStore(const IDBDatabaseInfo& info, const I
ASSERT(m_isOpeningBackingStore);
m_isOpeningBackingStore = false;

if (m_hardClosedForUserDelete)
return;

handleDatabaseOperations();
}

@@ -1708,7 +1715,7 @@ void UniqueIDBDatabase::transactionCompleted(RefPtr<UniqueIDBDatabaseTransaction
for (auto objectStore : transaction->objectStoreIdentifiers()) {
if (!transaction->isReadOnly()) {
m_objectStoreWriteTransactions.remove(objectStore);
ASSERT(m_objectStoreTransactionCounts.count(objectStore) == 1);
ASSERT(m_objectStoreTransactionCounts.count(objectStore) == 1 || m_hardClosedForUserDelete);
}
m_objectStoreTransactionCounts.remove(objectStore);
}
@@ -1,3 +1,15 @@
2019-01-23 Sihui Liu <sihui_liu@apple.com>

Clean up IndexedDB files between tests
https://bugs.webkit.org/show_bug.cgi?id=192796
<rdar://problem/46824999>

Reviewed by Geoffrey Garen.

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreRemoveAllIndexedDatabases):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:

2019-01-23 Wenson Hsieh <wenson_hsieh@apple.com>

[iOS] fast/events/touch/ios/hover-when-style-change-is-async.html times out
@@ -448,10 +448,13 @@ void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStore
});
}

void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef)
void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllIndexedDatabasesCallback callback)
{
OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::IndexedDBDatabases;
WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [] { });
WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, -WallTime::infinity(), [context, callback] {
if (callback)
callback(context);
});
}

void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllServiceWorkerRegistrationsCallback callback)
@@ -103,7 +103,8 @@ WK_EXPORT void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef data
typedef void (*WKWebsiteDataStoreRemoveAllServiceWorkerRegistrationsCallback)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllServiceWorkerRegistrationsCallback callback);

WK_EXPORT void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef);
typedef void (*WKWebsiteDataStoreRemoveAllIndexedDatabasesCallback)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveAllIndexedDatabasesCallback callback);

typedef void (*WKWebsiteDataStoreGetFetchCacheOriginsFunction)(WKArrayRef, void*);
WK_EXPORT void WKWebsiteDataStoreGetFetchCacheOrigins(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreGetFetchCacheOriginsFunction function);
@@ -1,3 +1,22 @@
2019-01-23 Sihui Liu <sihui_liu@apple.com>

Clean up IndexedDB files between tests
https://bugs.webkit.org/show_bug.cgi?id=192796
<rdar://problem/46824999>

Reviewed by Geoffrey Garen.

* DumpRenderTree/mac/DumpRenderTree.mm:
(runTest):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetStateToConsistentValues):
(WTR::RemoveAllIndexedDatabasesCallbackContext::RemoveAllIndexedDatabasesCallbackContext):
(WTR::RemoveAllIndexedDatabasesCallback):
(WTR::TestController::ClearIndexedDatabases):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):

2019-01-23 Aakash Jain <aakash_jain@apple.com>

[ews-app] Rename ews model Builds to Build
@@ -2013,6 +2013,9 @@ static void runTest(const string& inputLine)
gTestRunner->setIconDatabaseEnabled(false);
gTestRunner->clearAllApplicationCaches();

gTestRunner->clearAllDatabases();
gTestRunner->setIDBPerOriginQuota(50 * MB);

if (disallowedURLs)
CFSetRemoveAllValues(disallowedURLs);
if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
@@ -868,6 +868,9 @@ bool TestController::resetStateToConsistentValues(const TestOptions& options, Re

WKContextClearCachedCredentials(TestController::singleton().context());

ClearIndexedDatabases();
setIDBPerOriginQuota(50 * MB);

clearServiceWorkerRegistrations();
clearDOMCaches();

@@ -2766,6 +2769,31 @@ 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)
@@ -242,6 +242,8 @@ class TestController {

void removeAllSessionCredentials();

void ClearIndexedDatabases();

void clearServiceWorkerRegistrations();

void clearDOMCache(WKStringRef origin);
@@ -911,7 +911,7 @@ WKRetainPtr<WKTypeRef> TestInvocation::didReceiveSynchronousMessageFromInjectedB
}

if (WKStringIsEqualToUTF8CString(messageName, "DeleteAllIndexedDatabases")) {
WKWebsiteDataStoreRemoveAllIndexedDatabases(WKContextGetWebsiteDataStore(TestController::singleton().context()));
WKWebsiteDataStoreRemoveAllIndexedDatabases(WKContextGetWebsiteDataStore(TestController::singleton().context()), nullptr, { });
return nullptr;
}

0 comments on commit a4dbbd0

Please sign in to comment.