Diff
Modified: trunk/LayoutTests/ChangeLog (223264 => 223265)
--- trunk/LayoutTests/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/LayoutTests/ChangeLog 2017-10-13 00:36:07 UTC (rev 223265)
@@ -1,3 +1,20 @@
+2017-10-12 Youenn Fablet <[email protected]>
+
+ Layout Test http/tests/cache-storage/cache-clearing.https.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=178200
+
+ Reviewed by Chris Dumez.
+
+ Splitting cache-clearing.https.html in two sub tests and marking them as Pass/Timeout for the moment.
+
+ * platform/win/TestExpectations: Skipping cache/sw tests.
+ * TestExpectations:
+ * http/tests/cache-storage/cache-clearing.https.html: Removed.
+ * http/tests/cache-storage/cache-clearing-all.https-expected.txt: Added.
+ * http/tests/cache-storage/cache-clearing-all.https.html: Added.
+ * http/tests/cache-storage/cache-clearing-origin.https-expected.txt: Added.
+ * http/tests/cache-storage/cache-clearing-origin.https.html: Added.
+
2017-10-12 Per Arne Vollan <[email protected]>
Mark some xhtml tests as failing on Windows.
Modified: trunk/LayoutTests/TestExpectations (223264 => 223265)
--- trunk/LayoutTests/TestExpectations 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/LayoutTests/TestExpectations 2017-10-13 00:36:07 UTC (rev 223265)
@@ -467,6 +467,9 @@
webkit.org/b/168448 http/wpt/resource-timing/rt-shared-resource-in-workers.html [ Pass Failure ]
webkit.org/b/171511 http/wpt/resource-timing/rt-revalidate-requests.html [ Pass Failure ]
+webkit.org/b/178034 http/tests/cache-storage/cache-clearing-all.https.html [ Pass Timeout ]
+webkit.org/b/178034 http/tests/cache-storage/cache-clearing-origin.https.html [ Pass Timeout ]
+
webkit.org/b/161312 imported/w3c/web-platform-tests/html/semantics/document-metadata/the-link-element/document-without-browsing-context.html [ Failure Pass ]
imported/w3c/web-platform-tests/XMLHttpRequest/send-conditional-cors.htm [ Failure ]
Added: trunk/LayoutTests/http/tests/cache-storage/cache-clearing-all.https-expected.txt (0 => 223265)
--- trunk/LayoutTests/http/tests/cache-storage/cache-clearing-all.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cache-storage/cache-clearing-all.https-expected.txt 2017-10-13 00:36:07 UTC (rev 223265)
@@ -0,0 +1,4 @@
+
+PASS Cleaning existing caches
+PASS Clearing all disk cache
+
Copied: trunk/LayoutTests/http/tests/cache-storage/cache-clearing-all.https.html (from rev 223264, trunk/LayoutTests/http/tests/cache-storage/cache-clearing.https.html) (0 => 223265)
--- trunk/LayoutTests/http/tests/cache-storage/cache-clearing-all.https.html (rev 0)
+++ trunk/LayoutTests/http/tests/cache-storage/cache-clearing-all.https.html 2017-10-13 00:36:07 UTC (rev 223265)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Cache Storage: testing Cache persistency</title>
+<script src=""
+<script src=""
+</head>
+<body>
+ <script>
+promise_test(test => {
+ return self.caches.keys().then(keys => {
+ var pending = [];
+ for (key of keys)
+ pending.push(self.caches.delete(keys[0]));
+ return Promise.all(pending);
+ });
+}, "Cleaning existing caches");
+
+function waitFor(delay)
+{
+ return new Promise(resolve => {
+ setTimeout(resolve, delay);
+ });
+}
+
+async function validateCachesEmptyness(expected, counter)
+{
+ var keys = await self.caches.keys();
+
+ var isEmpty = keys.length === 0;
+ if (isEmpty === expected)
+ return true;
+
+ if (counter > 10)
+ return false;
+
+ await waitFor(100);
+ if (!counter)
+ counter = 0;
+ return validateCachesEmptyness(expected, ++counter);
+}
+
+promise_test(() => {
+ var test_url = 'https://example.com/foo';
+ var cache;
+ var cache_keys;
+ var first_response = new Response("Old body", { statusText: 'Old status' });
+ var alternate_response = new Response("New body", { statusText: 'New status' });
+ return self.caches.open("test-cache-records-persistency").then(c => {
+ cache = c;
+ }).then(() => {
+ return cache.put(test_url, first_response);
+ }).then(() => {
+ if (!window.testRunner)
+ return Promise.reject("test runner needed");
+ testRunner.clearDOMCache();
+ return validateCachesEmptyness(true);
+ }).then(result => {
+ assert_true(result, "caches should be empty");
+ return self.caches.open("test-cache-records-persistency");
+ }).then(cache => {
+ return cache.keys();
+ }).then(keys => {
+ assert_equals(keys.length, 0, "records should be empty");
+ });
+}, 'Clearing all disk cache');
+ </script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/cache-storage/cache-clearing-origin.https-expected.txt (0 => 223265)
--- trunk/LayoutTests/http/tests/cache-storage/cache-clearing-origin.https-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cache-storage/cache-clearing-origin.https-expected.txt 2017-10-13 00:36:07 UTC (rev 223265)
@@ -0,0 +1,4 @@
+
+PASS Cleaning existing caches
+PASS Clearing disk cache of a given origin
+
Copied: trunk/LayoutTests/http/tests/cache-storage/cache-clearing-origin.https.html (from rev 223264, trunk/LayoutTests/http/tests/cache-storage/cache-clearing.https.html) (0 => 223265)
--- trunk/LayoutTests/http/tests/cache-storage/cache-clearing-origin.https.html (rev 0)
+++ trunk/LayoutTests/http/tests/cache-storage/cache-clearing-origin.https.html 2017-10-13 00:36:07 UTC (rev 223265)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Cache Storage: testing Cache persistency</title>
+<script src=""
+<script src=""
+</head>
+<body>
+ <script>
+promise_test(test => {
+ return self.caches.keys().then(keys => {
+ var pending = [];
+ for (key of keys)
+ pending.push(self.caches.delete(keys[0]));
+ return Promise.all(pending);
+ });
+}, "Cleaning existing caches");
+
+function waitFor(delay)
+{
+ return new Promise(resolve => {
+ setTimeout(resolve, delay);
+ });
+}
+
+async function validateCachesEmptyness(expected, counter)
+{
+ var keys = await self.caches.keys();
+
+ var isEmpty = keys.length === 0;
+ if (isEmpty === expected)
+ return true;
+
+ if (counter > 10)
+ return false;
+
+ await waitFor(100);
+ if (!counter)
+ counter = 0;
+ return validateCachesEmptyness(expected, ++counter);
+}
+
+promise_test(() => {
+ var test_url = 'https://example.com/foo';
+ var cache;
+ var cache_keys;
+ var first_response = new Response("Old body", { statusText: 'Old status' });
+ var alternate_response = new Response("New body", { statusText: 'New status' });
+ return self.caches.open("test-cache-records-persistency").then(c => {
+ cache = c;
+ }).then(() => {
+ return cache.put(test_url, first_response);
+ }).then(() => {
+ if (!window.testRunner)
+ return Promise.reject("test runner needed");
+ testRunner.clearDOMCache('https://localhost:80');
+ return validateCachesEmptyness(false);
+ }).then(result => {
+ assert_true(result, "caches should not be empty");
+ testRunner.clearDOMCache(window.location.origin);
+ return validateCachesEmptyness(true);
+ }).then(result => {
+ assert_true(result, "caches should be empty");
+ return self.caches.open("test-cache-records-persistency");
+ }).then(cache => {
+ return cache.keys();
+ }).then(keys => {
+ assert_equals(keys.length, 0, "records should be empty");
+ });
+}, 'Clearing disk cache of a given origin');
+ </script>
+</body>
+</html>
Deleted: trunk/LayoutTests/http/tests/cache-storage/cache-clearing.https.html (223264 => 223265)
--- trunk/LayoutTests/http/tests/cache-storage/cache-clearing.https.html 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/LayoutTests/http/tests/cache-storage/cache-clearing.https.html 2017-10-13 00:36:07 UTC (rev 223265)
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Cache Storage: testing Cache persistency</title>
-<script src=""
-<script src=""
-</head>
-<body>
- <script>
-promise_test(test => {
- return self.caches.keys().then(keys => {
- var pending = [];
- for (key of keys)
- pending.push(self.caches.delete(keys[0]));
- return Promise.all(pending);
- });
-}, "Cleaning existing caches");
-
-var test_url = 'https://example.com/foo';
-var test_body = 'Hello world!';
-
-function waitFor(delay)
-{
- return new Promise(resolve => {
- setTimeout(resolve, delay);
- });
-}
-
-async function validateCachesEmptyness(expected, counter)
-{
- var keys = await self.caches.keys();
-
- var isEmpty = keys.length === 0;
- if (isEmpty === expected)
- return true;
-
- if (counter > 10)
- return false;
-
- await waitFor(100);
- if (!counter)
- counter = 0;
- return validateCachesEmptyness(expected, ++counter);
-}
-
-promise_test(() => {
- var cache;
- var cache_keys;
- var first_response = new Response("Old body", { statusText: 'Old status' });
- var alternate_response = new Response("New body", { statusText: 'New status' });
- return self.caches.open("test-cache-records-persistency").then(c => {
- cache = c;
- }).then(() => {
- return cache.put(test_url, first_response);
- }).then(() => {
- if (!window.testRunner)
- return Promise.reject("test runner needed");
- testRunner.clearDOMCache('https://localhost:80');
- return validateCachesEmptyness(false);
- }).then(result => {
- assert_true(result, "caches should not be empty");
- testRunner.clearDOMCache(window.location.origin);
- return validateCachesEmptyness(true);
- }).then(result => {
- assert_true(result, "caches should be empty");
- return self.caches.open("test-cache-records-persistency");
- }).then(cache => {
- return cache.keys();
- }).then(keys => {
- assert_equals(keys.length, 0, "records should be empty");
- });
-}, 'Clearing disk cache of a given origin');
-
-promise_test(() => {
- var cache;
- var cache_keys;
- var first_response = new Response("Old body", { statusText: 'Old status' });
- var alternate_response = new Response("New body", { statusText: 'New status' });
- return self.caches.open("test-cache-records-persistency").then(c => {
- cache = c;
- }).then(() => {
- return cache.put(test_url, first_response);
- }).then(() => {
- if (!window.testRunner)
- return Promise.reject("test runner needed");
- testRunner.clearDOMCache();
- return validateCachesEmptyness(true);
- }).then(result => {
- assert_true(result, "caches should be empty");
- return self.caches.open("test-cache-records-persistency");
- }).then(cache => {
- return cache.keys();
- }).then(keys => {
- assert_equals(keys.length, 0, "records should be empty");
- });
-}, 'Clearing all disk cache');
- </script>
-</body>
-</html>
Modified: trunk/LayoutTests/platform/win/TestExpectations (223264 => 223265)
--- trunk/LayoutTests/platform/win/TestExpectations 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/LayoutTests/platform/win/TestExpectations 2017-10-13 00:36:07 UTC (rev 223265)
@@ -3626,17 +3626,6 @@
fast/text/variations/font-selection-font-weight.html [ ImageOnlyFailure ]
fast/forms/file/entries-api/webkitdirectory-open-panel.html [ Skip ]
-# Failing cache storage tests
-webkit.org/b/176999 http/tests/cache-storage/cache-origins.https.html [ Skip ]
-webkit.org/b/176999 http/tests/cache-storage/cache-persistency.https.html [ Skip ]
-webkit.org/b/176999 http/tests/cache-storage/cache-records-persistency.https.html [ Failure ]
-webkit.org/b/176999 http/tests/cache-storage/cache-representation.https.html [ Skip ]
-webkit.org/b/176999 http/wpt/cache-storage/cache-put-keys.https.any.html [ Failure ]
-webkit.org/b/176999 http/wpt/cache-storage/cache-put-keys.https.any.worker.html [ Failure ]
-webkit.org/b/176999 http/wpt/cache-storage/cache-put-stream.https.any.html [ Failure ]
-webkit.org/b/176999 http/wpt/cache-storage/cache-put-stream.https.any.worker.html [ Failure ]
-webkit.org/b/176999 http/wpt/cache-storage/cache-remove-twice.html [ Failure ]
-
# html/syntax web platform tests are failing on Windows.
webkit.org/b/162415 imported/w3c/web-platform-tests/html/syntax [ Skip ]
@@ -3709,7 +3698,10 @@
imported/w3c/web-platform-tests/fetch/api/policies/referrer-unsafe-url-service-worker.https.html [ Skip ]
imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/integration-with-the-_javascript_-agent-formalism/canblock-serviceworker.https.html [ Skip ]
imported/w3c/web-platform-tests/service-workers [ Skip ]
+http/tests/cache-storage [ Skip ]
+http/wpt/cache-storage [ Skip ]
+
# Flaky tests on Windows:
webkit.org/b/176564 http/tests/misc/delete-frame-during-readystatechange.html [ Pass Crash ]
webkit.org/b/176661 http/tests/misc/object-embedding-svg-delayed-size-negotiation-2.htm [ Pass Failure ]
@@ -3778,15 +3770,11 @@
webkit.org/b/177626 http/tests/preconnect/link-rel-preconnect-http.html [ Skip ]
webkit.org/b/177626 http/tests/preconnect/link-rel-preconnect-https.html [ Skip ]
-webkit.org/b/177891 http/wpt/cache-storage/cache-quota.any.html [ Pass Failure ]
-
webkit.org/b/177964 fast/text/loading-block-nofinish.html [ Pass ImageOnlyFailure ]
webkit.org/b/177964 fast/text/loading-failure-finish.html [ Pass ImageOnlyFailure ]
webkit.org/b/177964 fast/text/loading-failure-nofinish.html [ Pass ImageOnlyFailure ]
webkit.org/b/177964 fast/text/loading-swap-nofinish.html [ Pass ImageOnlyFailure ]
-webkit.org/b/178200 http/tests/cache-storage/cache-clearing.https.html [ Failure ]
-
# xhtml tests are failing on some of the EWS bots.
webkit.org/b/178230 fast/xmlhttprequest/xmlhttprequest-get.xhtml [ Failure ]
webkit.org/b/178230 dom/xhtml/level3/core/documentgetinputencoding03.xhtml [ ImageOnlyFailure ]
Modified: trunk/Source/WebKit/ChangeLog (223264 => 223265)
--- trunk/Source/WebKit/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Source/WebKit/ChangeLog 2017-10-13 00:36:07 UTC (rev 223265)
@@ -1,3 +1,19 @@
+2017-10-12 Youenn Fablet <[email protected]>
+
+ Layout Test http/tests/cache-storage/cache-clearing.https.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=178200
+
+ Reviewed by Chris Dumez.
+
+ Deleting only the per-origin folders inside the CacheStorage engine root folder.
+
+ * NetworkProcess/cache/CacheStorageEngine.cpp:
+ (WebKit::CacheStorage::Engine::clearAllCaches):
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreRemoveAllFetchCaches):
+ (WKWebsiteDataStoreRemoveFetchCacheForOrigin):
+ * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+
2017-10-12 Chris Dumez <[email protected]>
[Mac] Add support for MouseEvent.buttons
Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (223264 => 223265)
--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp 2017-10-13 00:36:07 UTC (rev 223265)
@@ -353,8 +353,11 @@
if (!shouldPersist())
return;
- m_ioQueue->dispatch([filename = m_rootPath.isolatedCopy(), taskHandler = makeRef(taskHandler)] {
- deleteDirectoryRecursively(filename);
+ m_ioQueue->dispatch([path = m_rootPath.isolatedCopy(), taskHandler = makeRef(taskHandler)] {
+ for (auto& filename : WebCore::listDirectory(path, "*")) {
+ if (WebCore::fileIsDirectory(filename, WebCore::ShouldFollowSymbolicLinks::No))
+ deleteDirectoryRecursively(filename);
+ }
});
}
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (223264 => 223265)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2017-10-13 00:36:07 UTC (rev 223265)
@@ -320,13 +320,15 @@
store->scheduleClearInMemory();
}
-void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef)
+void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback)
{
OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::DOMCache;
- WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::time_point::min(), [] { });
+ WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, std::chrono::system_clock::time_point::min(), [context, callback] {
+ callback(context);
+ });
}
-void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStoreRef, WKSecurityOriginRef origin)
+void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStoreRef, WKSecurityOriginRef origin, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback)
{
WebKit::WebsiteDataRecord dataRecord;
dataRecord.add(WebKit::WebsiteDataType::DOMCache, WebCore::SecurityOriginData::fromSecurityOrigin(WebKit::toImpl(origin)->securityOrigin()));
@@ -333,7 +335,9 @@
Vector<WebKit::WebsiteDataRecord> dataRecords = { WTFMove(dataRecord) };
OptionSet<WebKit::WebsiteDataType> dataTypes = WebKit::WebsiteDataType::DOMCache;
- WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, dataRecords, [] { });
+ WebKit::toImpl(dataStoreRef)->websiteDataStore().removeData(dataTypes, dataRecords, [context, callback] {
+ callback(context);
+ });
}
void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef)
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (223264 => 223265)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2017-10-13 00:36:07 UTC (rev 223265)
@@ -70,8 +70,11 @@
typedef void (*WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemovalFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreStatisticsClearThroughWebsiteDataRemovalFunction callback);
WK_EXPORT void WKWebsiteDataStoreStatisticsResetToConsistentState(WKWebsiteDataStoreRef dataStoreRef);
-WK_EXPORT void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStoreRef, WKSecurityOriginRef origin);
-WK_EXPORT void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef);
+
+typedef void (*WKWebsiteDataStoreRemoveFetchCacheRemovalFunction)(void* functionContext);
+WK_EXPORT void WKWebsiteDataStoreRemoveFetchCacheForOrigin(WKWebsiteDataStoreRef dataStoreRef, WKSecurityOriginRef origin, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback);
+WK_EXPORT void WKWebsiteDataStoreRemoveAllFetchCaches(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreRemoveFetchCacheRemovalFunction callback);
+
WK_EXPORT void WKWebsiteDataStoreRemoveAllIndexedDatabases(WKWebsiteDataStoreRef dataStoreRef);
WK_EXPORT void WKWebsiteDataStoreRemoveAllServiceWorkerRegistrations(WKWebsiteDataStoreRef dataStoreRef);
Modified: trunk/Tools/ChangeLog (223264 => 223265)
--- trunk/Tools/ChangeLog 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Tools/ChangeLog 2017-10-13 00:36:07 UTC (rev 223265)
@@ -1,3 +1,23 @@
+2017-10-12 Youenn Fablet <[email protected]>
+
+ Layout Test http/tests/cache-storage/cache-clearing.https.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=178200
+
+ Reviewed by Chris Dumez.
+
+ Making clearDOMCache wait for removal completion to exit.
+ This removes the risk to interact with the cache while deleting it which will end up be racy in tests.
+
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::clearDOMCache):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::ClearDOMCacheCallbackContext::ClearDOMCacheCallbackContext):
+ (WTR::clearDOMCacheCallback):
+ (WTR::TestController::clearDOMCache):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
2017-10-12 John Wilander <[email protected]>
ResourceLoadObserver::logFrameNavigation() should use redirectResponse.url()
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (223264 => 223265)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2017-10-13 00:36:07 UTC (rev 223265)
@@ -1833,7 +1833,7 @@
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ClearDOMCache"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(origin));
- WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
}
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (223264 => 223265)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2017-10-13 00:36:07 UTC (rev 223265)
@@ -2299,18 +2299,39 @@
#endif
+#if WK_API_ENABLED
+struct ClearDOMCacheCallbackContext {
+ explicit ClearDOMCacheCallbackContext(TestController& controller)
+ : testController(controller)
+ {
+ }
+
+ TestController& testController;
+ bool done { false };
+};
+
+static void clearDOMCacheCallback(void* userData)
+{
+ auto* context = static_cast<ClearDOMCacheCallbackContext*>(userData);
+ context->done = true;
+ context->testController.notifyDone();
+}
+#endif
+
void TestController::clearDOMCache(WKStringRef origin)
{
#if WK_API_ENABLED
auto websiteDataStore = WKContextGetWebsiteDataStore(platformContext());
+ ClearDOMCacheCallbackContext context(*this);
- if (WKStringIsEmpty(origin)) {
- WKWebsiteDataStoreRemoveAllFetchCaches(websiteDataStore);
- return;
+ if (WKStringIsEmpty(origin))
+ WKWebsiteDataStoreRemoveAllFetchCaches(websiteDataStore, &context, clearDOMCacheCallback);
+ else {
+ auto cacheOrigin = adoptWK(WKSecurityOriginCreateFromString(origin));
+ WKWebsiteDataStoreRemoveFetchCacheForOrigin(websiteDataStore, cacheOrigin.get(), &context, clearDOMCacheCallback);
}
-
- auto cacheOrigin = adoptWK(WKSecurityOriginCreateFromString(origin));
- WKWebsiteDataStoreRemoveFetchCacheForOrigin(websiteDataStore, cacheOrigin.get());
+ if (!context.done)
+ runUntil(context.done, m_currentInvocation->shortTimeout());
#endif
}
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (223264 => 223265)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2017-10-13 00:24:21 UTC (rev 223264)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2017-10-13 00:36:07 UTC (rev 223265)
@@ -763,14 +763,6 @@
return;
}
- if (WKStringIsEqualToUTF8CString(messageName, "ClearDOMCache")) {
- ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
- WKStringRef origin = static_cast<WKStringRef>(messageBody);
-
- TestController::singleton().clearDOMCache(origin);
- return;
- }
-
ASSERT_NOT_REACHED();
}
@@ -1210,6 +1202,14 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "ClearDOMCache")) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ WKStringRef origin = static_cast<WKStringRef>(messageBody);
+
+ TestController::singleton().clearDOMCache(origin);
+ return nullptr;
+ }
+
ASSERT_NOT_REACHED();
return nullptr;
}