WebKit Bugzilla
Attachment 343297 Details for
Bug 186903
: Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186903-20180621172353.patch (text/plain), 27.78 KB, created by
John Wilander
on 2018-06-21 17:23:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2018-06-21 17:23:53 PDT
Size:
27.78 KB
patch
obsolete
>Subversion Revision: 233041 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b45a04da9d10ad58c3d367d184d542e2f3908f2d..53a6041533904625834c6aec09ac199417595a6c 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,39 @@ >+2018-06-21 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback >+ https://bugs.webkit.org/show_bug.cgi?id=186903 >+ <rdar://problem/41350182> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This patch stores the callback sent to >+ WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(), >+ sets up a context ID, and sends that ID to the network process when >+ asking it to update cookie partitioning and blocking. The network >+ process then tells the UI process when it's done, at which point the >+ callback is called. >+ >+ This patch is meant to address layout test flakiness. >+ >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies): >+ * NetworkProcess/NetworkProcess.h: >+ * NetworkProcess/NetworkProcess.messages.in: >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::nextUpdatePartitionOrBlockCookiesContextId): >+ (WebKit::NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies): >+ (WebKit::NetworkProcessProxy::updatePartitionOrBlockCookiesDone): >+ * UIProcess/Network/NetworkProcessProxy.h: >+ * UIProcess/Network/NetworkProcessProxy.messages.in: >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): >+ (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ * UIProcess/WebsiteData/WebsiteDataStore.cpp: >+ (WebKit::WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies): >+ (WebKit::WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback): >+ * UIProcess/WebsiteData/WebsiteDataStore.h: >+ > 2018-06-21 Zan Dobersek <zdobersek@igalia.com> > > [GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index 184d127c38bf66af5e6c01df80039b2206f9e458..ba2dea5f71b4dee926fce2b6de5d7adbb64fd821 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -403,10 +403,11 @@ void NetworkProcess::writeBlobToFilePath(const WebCore::URL& url, const String& > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >-void NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool shouldClearFirst) >+void NetworkProcess::updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool shouldClearFirst, uint64_t contextId) > { > if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID)) > networkStorageSession->setPrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); >+ parentProcessConnection()->send(Messages::NetworkProcessProxy::UpdatePartitionOrBlockCookiesDone(contextId), 0); > } > > void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h >index be349319b1a4db8d34884bbb5192485a05052284..4cf6e45fd739dde06aa4675db450697871e65f0d 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h >@@ -134,7 +134,7 @@ public: > void grantSandboxExtensionsToStorageProcessForBlobs(const Vector<String>& filenames, Function<void ()>&& completionHandler); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool shouldClearFirst); >+ void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool shouldClearFirst, uint64_t contextId); > void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId); > void getAllStorageAccessEntries(PAL::SessionID, uint64_t contextId); > void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId); >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >index 8376bbc9b48a6b4138c414abdd9a6cc8f94eeadb..bba1df7f30387e72f900ae1600b50be8644b28a6 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >@@ -81,7 +81,7 @@ messages -> NetworkProcess LegacyReceiver { > PreconnectTo(WebCore::URL url, enum WebCore::StoredCredentialsPolicy storedCredentialsPolicy); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- UpdatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, Vector<String> domainsToPartition, Vector<String> domainsToBlock, Vector<String> domainsToNeitherPartitionNorBlock, bool shouldClearFirst) >+ UpdatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, Vector<String> domainsToPartition, Vector<String> domainsToBlock, Vector<String> domainsToNeitherPartitionNorBlock, bool shouldClearFirst, uint64_t contextId) > HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId) > GetAllStorageAccessEntries(PAL::SessionID sessionID, uint64_t contextId) > GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId) >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index cbb182b65a6c0ace15300de964333013464624be..332d31b9f35b48b9e086bfc560c90a97f631effd 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -428,6 +428,31 @@ void NetworkProcessProxy::canAuthenticateAgainstProtectionSpace(uint64_t loaderI > #endif > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >+static uint64_t nextUpdatePartitionOrBlockCookiesContextId() >+{ >+ static uint64_t nextContextId = 0; >+ return ++nextContextId; >+} >+ >+void NetworkProcessProxy::updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID sessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) >+{ >+ if (!canSendMessage()) { >+ callback(); >+ return; >+ } >+ >+ auto contextId = nextUpdatePartitionOrBlockCookiesContextId(); >+ auto addResult = m_updatePartitionOrBlockCookiesCallbackMap.add(contextId, WTFMove(callback)); >+ ASSERT_UNUSED(addResult, addResult.isNewEntry); >+ send(Messages::NetworkProcess::UpdatePrevalentDomainsToPartitionOrBlockCookies(sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst == ShouldClearFirst::Yes, contextId), 0); >+} >+ >+void NetworkProcessProxy::updatePartitionOrBlockCookiesDone(uint64_t contextId) >+{ >+ auto callback = m_updatePartitionOrBlockCookiesCallbackMap.take(contextId); >+ callback(); >+} >+ > static uint64_t nextRequestStorageAccessContextId() > { > static uint64_t nextContextId = 0; >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >index 6cc521c6ac1d4c4cf0aa48727498107c20a3a46f..2d394f76c4c4c01826f98c04877b45599d071168 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >@@ -78,6 +78,7 @@ public: > void deleteWebsiteDataForOrigins(PAL::SessionID, OptionSet<WebKit::WebsiteDataType>, const Vector<WebCore::SecurityOriginData>& origins, const Vector<String>& cookieHostNames, WTF::Function<void()>&& completionHandler); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >+ void updatePrevalentDomainsToPartitionOrBlockCookies(PAL::SessionID, const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); > void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); > void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String>&& domains)>&&); > void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback); >@@ -144,6 +145,7 @@ private: > void canAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, const WebCore::ProtectionSpace&); > #endif > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >+ void updatePartitionOrBlockCookiesDone(uint64_t contextId); > void storageAccessRequestResult(bool wasGranted, uint64_t contextId); > void allStorageAccessEntriesResult(Vector<String>&& domains, uint64_t contextId); > #endif >@@ -176,6 +178,7 @@ private: > unsigned m_syncAllCookiesCounter { 0 }; > > HashMap<uint64_t, CompletionHandler<void(bool success)>> m_writeBlobToFilePathCallbackMap; >+ HashMap<uint64_t, CompletionHandler<void()>> m_updatePartitionOrBlockCookiesCallbackMap; > HashMap<uint64_t, WTF::CompletionHandler<void(bool wasGranted)>> m_storageAccessResponseCallbackMap; > HashMap<uint64_t, CompletionHandler<void(Vector<String>&& domains)>> m_allStorageAccessEntriesCallbackMap; > >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >index 996a4a595d293537287d2e0a67222983f0c2b505..953b7c3d240fcd8046f307815e5e2394f7efcce3 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >@@ -47,6 +47,7 @@ messages -> NetworkProcessProxy LegacyReceiver { > CanAuthenticateAgainstProtectionSpace(uint64_t loaderID, uint64_t pageID, uint64_t frameID, WebCore::ProtectionSpace protectionSpace) > #endif > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >+ UpdatePartitionOrBlockCookiesDone(uint64_t contextId) > StorageAccessRequestResult(bool wasGranted, uint64_t contextId) > AllStorageAccessEntriesResult(Vector<String> domains, uint64_t contextId) > #endif >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index 6dab2637b9a8857c8db23714453167d8ef6dbc09..1974fc60ced06e8d56e5973bcde541eb2d1a5ffe 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -1216,7 +1216,9 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler< > } > > if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty()) { >- callback(); >+ RunLoop::main().dispatch([callback = WTFMove(callback)] () { >+ callback(); >+ }); > return; > } > >@@ -1254,9 +1256,8 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler< > } > #endif > >- RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), callback = WTFMove(callback)] () { >- m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No); >- callback(); >+ RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), callback = WTFMove(callback)] () mutable { >+ m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No, WTFMove(callback)); > #if !RELEASE_LOG_DISABLED > RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done updating cookie partitioning and blocking."); > #endif >@@ -1267,12 +1268,14 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(const Ve > { > ASSERT(!RunLoop::isMain()); > if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty() && shouldClearFirst == ShouldClearFirst::No) { >- callback(); >+ RunLoop::main().dispatch([callback = WTFMove(callback)] () { >+ callback(); >+ }); > return; > } > >- RunLoop::main().dispatch([this, shouldClearFirst, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock)] () { >- m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); >+ RunLoop::main().dispatch([this, shouldClearFirst, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), callback = WTFMove(callback)] () mutable { >+ m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(callback)); > }); > > if (shouldClearFirst == ShouldClearFirst::Yes) >@@ -1290,8 +1293,6 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(const Ve > > for (auto& domain : domainsToBlock) > ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookieBlocking = true; >- >- callback(); > } > > void WebResourceLoadStatisticsStore::clearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& callback) >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index 4f116244ba1e4c0dcf404648aecebb3931f54450..fa82f78cd0bae3d7b9338c3f73d5f209cfd24f70 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -68,12 +68,12 @@ enum class StorageAccessStatus { > > class WebResourceLoadStatisticsStore final : public IPC::Connection::WorkQueueMessageReceiver { > public: >- using UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler = WTF::Function<void(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst)>; >+ using UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler = WTF::Function<void(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&)>; > using HasStorageAccessForFrameHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::Function<void(bool hasAccess)>&& callback)>; > using GrantStorageAccessHandler = WTF::Function<void(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::Function<void(bool wasGranted)>&& callback)>; > using RemoveAllStorageAccessHandler = WTF::Function<void()>; > using RemovePrevalentDomainsHandler = WTF::Function<void (const Vector<String>&)>; >- static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { }) >+ static Ref<WebResourceLoadStatisticsStore> create(const String& resourceLoadStatisticsDirectory, Function<void (const String&)>&& testingCallback, bool isEphemeral, UpdatePrevalentDomainsToPartitionOrBlockCookiesHandler&& updatePrevalentDomainsToPartitionOrBlockCookiesHandler = [](const WTF::Vector<String>&, const WTF::Vector<String>&, const WTF::Vector<String>&, ShouldClearFirst, CompletionHandler<void()>&& callback = []() { }) { }, HasStorageAccessForFrameHandler&& hasStorageAccessForFrameHandler = [](const String&, const String&, uint64_t, uint64_t, WTF::Function<void(bool)>&&) { }, GrantStorageAccessHandler&& grantStorageAccessHandler = [](const String&, const String&, std::optional<uint64_t>, uint64_t, WTF::Function<void(bool)>&&) { }, RemoveAllStorageAccessHandler&& removeAllStorageAccessHandler = []() { }, RemovePrevalentDomainsHandler&& removeDomainsHandler = [] (const WTF::Vector<String>&) { }) > { > return adoptRef(*new WebResourceLoadStatisticsStore(resourceLoadStatisticsDirectory, WTFMove(testingCallback), isEphemeral, WTFMove(updatePrevalentDomainsToPartitionOrBlockCookiesHandler), WTFMove(hasStorageAccessForFrameHandler), WTFMove(grantStorageAccessHandler), WTFMove(removeAllStorageAccessHandler), WTFMove(removeDomainsHandler))); > } >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >index c3f3182df05c8f1c558031b5c5fea4c01cd3cdc5..9f72e14ddcd4b7c95933ccf130b08d7ee0a7b51e 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp >@@ -1205,10 +1205,10 @@ void WebsiteDataStore::removeDataForTopPrivatelyControlledDomains(OptionSet<Webs > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >-void WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst) >+void WebsiteDataStore::updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) > { > for (auto& processPool : processPools()) >- processPool->sendToNetworkingProcess(Messages::NetworkProcess::UpdatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst == ShouldClearFirst::Yes)); >+ processPool->networkProcess()->updatePrevalentDomainsToPartitionOrBlockCookies(m_sessionID, domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(callback)); > } > > void WebsiteDataStore::hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback) >@@ -1472,9 +1472,9 @@ void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Functio > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), m_sessionID.isEphemeral(), [weakThis = makeWeakPtr(*this)] (const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst) { >+ m_resourceLoadStatistics = WebResourceLoadStatisticsStore::create(m_configuration.resourceLoadStatisticsDirectory, WTFMove(callback), m_sessionID.isEphemeral(), [weakThis = makeWeakPtr(*this)] (const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) { > if (weakThis) >- weakThis->updatePrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst); >+ weakThis->updatePrevalentDomainsToPartitionOrBlockCookies(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(callback)); > }, [weakThis = makeWeakPtr(*this)] (const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback) { > if (weakThis) > weakThis->hasStorageAccessForFrameHandler(resourceDomain, firstPartyDomain, frameID, pageID, WTFMove(callback)); >diff --git a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >index 978c3d945c5c083cbcfcf67c842ab2639d0071aa..567a24e51e38444db4e033677e36c68a3d7c0e33 100644 >--- a/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >+++ b/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h >@@ -130,7 +130,7 @@ public: > void removeDataForTopPrivatelyControlledDomains(OptionSet<WebsiteDataType>, OptionSet<WebsiteDataFetchOption>, const Vector<String>& topPrivatelyControlledDomains, Function<void(HashSet<String>&&)>&& completionHandler); > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) >- void updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst); >+ void updatePrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst, CompletionHandler<void()>&&); > void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void(bool hasAccess)>&& callback); > void getAllStorageAccessEntries(CompletionHandler<void(Vector<String>&& domains)>&&); > void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, WTF::CompletionHandler<void(bool wasGranted)>&& callback); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 9a98178629728832b6d38c4be8d9695b0eb7f23d..b5146f6479d63dc59aa8851b7e5480c228b35671 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-21 John Wilander <wilander@apple.com> >+ >+ Resource Load Statistics: Make WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains() wait for the network process before calling its callback >+ https://bugs.webkit.org/show_bug.cgi?id=186903 >+ <rdar://problem/41350182> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/storageAccess/grant-storage-access-under-opener-expected.txt: >+ * http/tests/storageAccess/grant-storage-access-under-opener.html: >+ Moved the code block to the page's body instead of its head. >+ Added an initial console log statement. The reason for these >+ changes is that we're seeing flaky timeouts with no output. >+ > 2018-06-21 Ryan Haddad <ryanhaddad@apple.com> > > Update TestExpectations for http/wpt/service-workers/third-party-registration.html. >diff --git a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt >index 530880414211bfb87e316df5b15e421ea218d75f..bc5a8098515387071dce1aeb7ca5e26064e9aa30 100644 >--- a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt >+++ b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener-expected.txt >@@ -1,7 +1,8 @@ >-CONSOLE MESSAGE: line 54: Running test. >-CONSOLE MESSAGE: line 67: About to call testRunner.statisticsUpdateCookiePartitioning(). >-CONSOLE MESSAGE: line 69: About to open the new window. >-CONSOLE MESSAGE: line 43: About to open the third party iframe. >+CONSOLE MESSAGE: line 8: First JavaScript statement. >+CONSOLE MESSAGE: line 57: Running test. >+CONSOLE MESSAGE: line 73: About to call testRunner.statisticsUpdateCookiePartitioning(). >+CONSOLE MESSAGE: line 75: About to open the new window. >+CONSOLE MESSAGE: line 45: About to open the third party iframe. > Tests that a cross-origin window from a prevalent domain with non-recent user interaction gets immediate storage access under its opener. > > On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >diff --git a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html >index 1cbd1c77b9b31a2f9cf47984396ac6c772c00513..aa74369a2768b3c302009722daffbb2bf8fa7d7e 100644 >--- a/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html >+++ b/LayoutTests/http/tests/storageAccess/grant-storage-access-under-opener.html >@@ -2,7 +2,11 @@ > <html> > <head> > <script src="/js-test-resources/js-test.js"></script> >+</head> >+<body onload="run()"> > <script> >+ console.log("First JavaScript statement."); >+ > description("Tests that a cross-origin window from a prevalent domain with non-recent user interaction gets immediate storage access under its opener."); > jsTestIsAsync = true; > >@@ -14,8 +18,6 @@ > testRunner.setStorageAccessAPIEnabled(enable); > } > >- window.addEventListener("message", receiveMessage, false); >- > function finishTest() { > setEnableFeature(false); > finishJSTest(); >@@ -50,9 +52,13 @@ > const firstPartyCookieName = "firstPartyCookie"; > const subPathToGetCookies = "/get-cookies.php?name1=" + firstPartyCookieName; > var newWin; >+ > function run() { > console.log("Running test."); > setEnableFeature(true); >+ >+ window.addEventListener("message", receiveMessage, false); >+ > testRunner.setCanOpenWindows(); > > testRunner.setStatisticsPrevalentResource(thirdPartyOrigin, true); >@@ -71,7 +77,5 @@ > }); > } > </script> >-</head> >-<body onload="run()"> > </body> > </html> >\ No newline at end of file
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186903
:
343297
|
343370
|
343389
|
343520
|
343539
|
343550
|
343614