https://bugs.webkit.org/show_bug.cgi?id=203822
Reviewed by Youenn Fablet.
Source/WebKit:
Right now tests that set the cache model do so using a race condition. I think this will fix the flakyness we've observed.
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setCacheModelSynchronouslyForTesting):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting):
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setCacheModelSynchronouslyForTesting):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::setCacheModelSynchronouslyForTesting):
* UIProcess/WebsiteData/WebsiteDataStore.h:
Tools:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::setCacheModel):
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
(WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252259
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2019-11-08 Alex Christensen <achristensen@webkit.org>
+ Fix flaky tests in http/tests/cache/disk-cache
+ https://bugs.webkit.org/show_bug.cgi?id=203822
+
+ Reviewed by Youenn Fablet.
+
+ Right now tests that set the cache model do so using a race condition. I think this will fix the flakyness we've observed.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::setCacheModelSynchronouslyForTesting):
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting):
+ * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::setCacheModelSynchronouslyForTesting):
+ * UIProcess/WebProcessPool.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::setCacheModelSynchronouslyForTesting):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
+2019-11-08 Alex Christensen <achristensen@webkit.org>
+
Revert some changes accidentally committed with r252257
https://bugs.webkit.org/show_bug.cgi?id=202178
downloadManager().continueDecidePendingDownloadDestination(downloadID, destination, WTFMove(sandboxExtensionHandle), allowOverwrite);
}
+void NetworkProcess::setCacheModelSynchronouslyForTesting(CacheModel cacheModel, CompletionHandler<void()>&& completionHandler)
+{
+ setCacheModel(cacheModel, { });
+ completionHandler();
+}
+
void NetworkProcess::setCacheModel(CacheModel cacheModel, String cacheStorageDirectory)
{
if (m_hasSetCacheModel && (cacheModel == m_cacheModel))
void applicationWillEnterForeground();
void setCacheModel(CacheModel, String overrideCacheStorageDirectory);
+ void setCacheModelSynchronouslyForTesting(CacheModel, CompletionHandler<void()>&&);
void allowSpecificHTTPSCertificateForHost(const WebCore::CertificateInfo&, const String& host);
void clearCacheForAllOrigins(uint32_t cachesToClear);
void setAllowsAnySSLCertificateForWebSocket(bool, CompletionHandler<void()>&&);
AllowSpecificHTTPSCertificateForHost(WebCore::CertificateInfo certificate, String host)
ClearCacheForAllOrigins(uint32_t cachesToClear)
- SetCacheModel(enum:uint8_t WebKit::CacheModel cacheModel, String overrideCacheStorageDirectory);
+ SetCacheModel(enum:uint8_t WebKit::CacheModel cacheModel, String overrideCacheStorageDirectory)
+ SetCacheModelSynchronouslyForTesting(enum:uint8_t WebKit::CacheModel cacheModel) -> () Synchronous
ProcessDidTransitionToBackground()
ProcessDidTransitionToForeground()
});
}
+void WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting(WKWebsiteDataStoreRef dataStoreRef, WKCacheModel cacheModel)
+{
+ WebKit::toImpl(dataStoreRef)->setCacheModelSynchronouslyForTesting(WebKit::toCacheModel(cacheModel));
+}
extern "C" {
#endif
+typedef uint32_t WKCacheModel;
+
WK_EXPORT WKTypeID WKWebsiteDataStoreGetTypeID();
WK_EXPORT WKWebsiteDataStoreRef WKWebsiteDataStoreGetDefaultDataStore();
typedef void (*WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemoval(WKWebsiteDataStoreRef dataStoreRef, void* context, WKWebsiteDataStoreClearAdClickAttributionsThroughWebsiteDataRemovalFunction callback);
+WK_EXPORT void WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting(WKWebsiteDataStoreRef dataStoreRef, WKCacheModel cacheModel);
+
#ifdef __cplusplus
}
#endif
m_networkProcess->send(Messages::NetworkProcess::SetCacheModel(cacheModel, { }), 0);
}
+void WebProcessPool::setCacheModelSynchronouslyForTesting(CacheModel cacheModel)
+{
+ updateBackForwardCacheCapacity();
+
+ if (m_networkProcess)
+ m_networkProcess->sendSync(Messages::NetworkProcess::SetCacheModelSynchronouslyForTesting(cacheModel), { }, { });
+}
+
void WebProcessPool::setDefaultRequestTimeoutInterval(double timeoutInterval)
{
sendToAllProcesses(Messages::WebProcess::SetDefaultRequestTimeoutInterval(timeoutInterval));
VisitedLinkStore& visitedLinkStore() { return m_visitedLinkStore.get(); }
void setCacheModel(CacheModel);
+ void setCacheModelSynchronouslyForTesting(CacheModel);
+
void setDefaultRequestTimeoutInterval(double);
return WebCore::StorageQuotaManager::defaultThirdPartyQuotaFromPerOriginQuota(perOriginStorageQuota());
}
+void WebsiteDataStore::setCacheModelSynchronouslyForTesting(CacheModel cacheModel)
+{
+ for (auto processPool : WebProcessPool::allProcessPools())
+ processPool->setCacheModelSynchronouslyForTesting(cacheModel);
+}
+
#if !PLATFORM(COCOA)
WebsiteDataStoreParameters WebsiteDataStore::parameters()
{
class WebProcessPool;
class WebProcessProxy;
class WebResourceLoadStatisticsStore;
+enum class CacheModel : uint8_t;
enum class WebsiteDataFetchOption;
enum class WebsiteDataType;
struct WebsiteDataRecord;
void removeData(OptionSet<WebsiteDataType>, const Vector<WebsiteDataRecord>&, Function<void()>&& completionHandler);
void getLocalStorageDetails(Function<void(Vector<LocalStorageDatabaseTracker::OriginDetails>&&)>&&);
+ void setCacheModelSynchronouslyForTesting(CacheModel);
#if ENABLE(RESOURCE_LOAD_STATISTICS)
void fetchDataForRegistrableDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<WebCore::RegistrableDomain>&, CompletionHandler<void(Vector<WebsiteDataRecord>&&, HashSet<WebCore::RegistrableDomain>&&)>&&);
+2019-11-08 Alex Christensen <achristensen@webkit.org>
+
+ Fix flaky tests in http/tests/cache/disk-cache
+ https://bugs.webkit.org/show_bug.cgi?id=203822
+
+ Reviewed by Youenn Fablet.
+
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::setCacheModel):
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+
2019-11-08 Aakash Jain <aakash_jain@apple.com>
Clicking on EWS status-bubble should open the results in new tab
{
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("SetCacheModel"));
WKRetainPtr<WKUInt64Ref> messageBody = adoptWK(WKUInt64Create(model));
- WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
+ WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), messageBody.get(), nullptr);
}
bool InjectedBundle::shouldProcessWorkQueue() const
return;
}
- if (WKStringIsEqualToUTF8CString(messageName, "SetCacheModel")) {
- ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
- uint64_t model = WKUInt64GetValue(static_cast<WKUInt64Ref>(messageBody));
- WKContextSetCacheModel(TestController::singleton().context(), model);
- return;
- }
-
if (WKStringIsEqualToUTF8CString(messageName, "SetCustomPolicyDelegate")) {
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
WKDictionaryRef messageBodyDictionary = static_cast<WKDictionaryRef>(messageBody);
return result;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetCacheModel")) {
+ ASSERT(WKGetTypeID(messageBody) == WKUInt64GetTypeID());
+ uint64_t model = WKUInt64GetValue(static_cast<WKUInt64Ref>(messageBody));
+ WKWebsiteDataStoreSetCacheModelSynchronouslyForTesting(TestController::websiteDataStore(), model);
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "IsWorkQueueEmpty")) {
bool isEmpty = TestController::singleton().workQueueManager().isWorkQueueEmpty();
WKRetainPtr<WKTypeRef> result = adoptWK(WKBooleanCreate(isEmpty));