WebKit Bugzilla
Attachment 343265 Details for
Bug 183216
: [iOS Debug] Multiple resourceLoadStatistics redirect tests are flaky timeouts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-183216-20180621133803.patch (text/plain), 32.77 KB, created by
Brent Fulgham
on 2018-06-21 13:38:03 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Brent Fulgham
Created:
2018-06-21 13:38:03 PDT
Size:
32.77 KB
patch
obsolete
>Subversion Revision: 233012 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 74119bb35a3e3a958c84e7635300330e49d65bbf..b96069b30c4a782207990f6a5d7d7ce9acdabc1b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,51 @@ >+2018-06-21 Brent Fulgham <bfulgham@apple.com> >+ >+ [iOS Debug] Multiple resourceLoadStatistics redirect tests are flaky timeouts >+ https://bugs.webkit.org/show_bug.cgi?id=183216 >+ <rdar://problem/37992317> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Improve consistency of test results by make sure that completion handlers written to run >+ on the main thread are only called on the main thread. Add additional assertions to help >+ catch any cases where this invariant is not being honored. >+ >+ * UIProcess/WebResourceLoadStatisticsStore.cpp: >+ (WebKit::WebResourceLoadStatisticsStore::hasStorageAccess): Use Completion handler and make sure >+ we assert we are on the right thread. >+ (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::grantStorageAccess): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::logUserInteraction): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::logNonRecentUserInteraction): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::clearUserInteraction): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::hasHadUserInteraction): Revise naming to be clear that the >+ completion handler should be called on the main thread. >+ (WebKit::WebResourceLoadStatisticsStore::setLastSeen): Assert we are on the right thread. >+ (WebKit::WebResourceLoadStatisticsStore::setPrevalentResource): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::isPrevalentResource): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::isVeryPrevalentResource): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::clearPrevalentResource): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setGrandfathered): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::isGrandfathered): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset): >+ (WebKit::WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent): Update to perform callbacks >+ on the main thread (as intended). This function was doing them on a work queue. >+ (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains): Ditto. >+ (WebKit::WebResourceLoadStatisticsStore::clearPartitioningStateForDomains): Ditto. >+ * UIProcess/WebResourceLoadStatisticsStore.h: >+ > 2018-06-19 Dean Jackson <dino@apple.com> > > Blank viewer comes up and then auto-dismisses when device is not connected to Internet >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >index 6dab2637b9a8857c8db23714453167d8ef6dbc09..bbe26211bc0ad873dec3ce1e4970b04da013c77f 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp >@@ -371,37 +371,37 @@ void WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated(Vector<WebCor > processStatisticsAndDataRecords(); > } > >-void WebResourceLoadStatisticsStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, WTF::CompletionHandler<void (bool)>&& callback) >+void WebResourceLoadStatisticsStore::hasStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, CompletionHandler<void (bool)>&& completionHandler) > { > ASSERT(subFrameHost != topFrameHost); > ASSERT(RunLoop::isMain()); > >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), frameID, pageID, callback = WTFMove(callback)] () mutable { >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost), topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost), frameID, pageID, completionHandler = WTFMove(completionHandler)] () mutable { > > auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); > if (shouldBlockCookies(subFrameStatistic)) { >- RunLoop::main().dispatch([callback = WTFMove(callback)] { >- callback(false); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(false); > }); > return; > } > > if (!shouldPartitionCookies(subFrameStatistic)) { >- RunLoop::main().dispatch([callback = WTFMove(callback)] { >- callback(true); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(true); > }); > return; > } > >- m_hasStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, [callback = WTFMove(callback)] (bool value) mutable { >- RunLoop::main().dispatch([callback = WTFMove(callback), value] () mutable { >- callback(value); >+ m_hasStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, [completionHandler = WTFMove(completionHandler)] (bool value) mutable { >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), value] () mutable { >+ completionHandler(value); > }); > }); > }); > } > >-void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& callback) >+void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&& completionHandler) > { > ASSERT(subFrameHost != topFrameHost); > ASSERT(RunLoop::isMain()); >@@ -409,40 +409,40 @@ void WebResourceLoadStatisticsStore::requestStorageAccess(String&& subFrameHost, > auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost); > auto topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost); > if (subFramePrimaryDomain == topFramePrimaryDomain) { >- callback(StorageAccessStatus::HasAccess); >+ completionHandler(StorageAccessStatus::HasAccess); > return; > } > >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, promptEnabled, callback = WTFMove(callback)] () mutable { >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = crossThreadCopy(subFramePrimaryDomain), topFramePrimaryDomain = crossThreadCopy(topFramePrimaryDomain), frameID, pageID, promptEnabled, completionHandler = WTFMove(completionHandler)] () mutable { > > auto& subFrameStatistic = ensureResourceStatisticsForPrimaryDomain(subFramePrimaryDomain); > if (shouldBlockCookies(subFrameStatistic)) { >- RunLoop::main().dispatch([callback = WTFMove(callback)] { >- callback(StorageAccessStatus::CannotRequestAccess); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(StorageAccessStatus::CannotRequestAccess); > }); > return; > } > > if (!shouldPartitionCookies(subFrameStatistic)) { >- RunLoop::main().dispatch([callback = WTFMove(callback)] { >- callback(StorageAccessStatus::HasAccess); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(StorageAccessStatus::HasAccess); > }); > return; > } > > auto userWasPromptedEarlier = promptEnabled && hasUserGrantedStorageAccessThroughPrompt(subFrameStatistic, topFramePrimaryDomain); > if (promptEnabled && !userWasPromptedEarlier) { >- RunLoop::main().dispatch([callback = WTFMove(callback)] { >- callback(StorageAccessStatus::RequiresUserPrompt); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(StorageAccessStatus::RequiresUserPrompt); > }); > return; > } > > subFrameStatistic.timesAccessedAsFirstPartyDueToStorageAccessAPI++; > >- grantStorageAccessInternal(WTFMove(subFramePrimaryDomain), WTFMove(topFramePrimaryDomain), frameID, pageID, userWasPromptedEarlier, [callback = WTFMove(callback)] (bool wasGrantedAccess) mutable { >- RunLoop::main().dispatch([callback = WTFMove(callback), wasGrantedAccess] () mutable { >- callback(wasGrantedAccess ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); >+ grantStorageAccessInternal(WTFMove(subFramePrimaryDomain), WTFMove(topFramePrimaryDomain), frameID, pageID, userWasPromptedEarlier, [completionHandler = WTFMove(completionHandler)] (bool wasGrantedAccess) mutable { >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), wasGrantedAccess] () mutable { >+ completionHandler(wasGrantedAccess ? StorageAccessStatus::HasAccess : StorageAccessStatus::CannotRequestAccess); > }); > }); > }); >@@ -473,10 +473,10 @@ void WebResourceLoadStatisticsStore::requestStorageAccessUnderOpener(String&& pr > grantStorageAccessInternal(WTFMove(primaryDomainInNeedOfStorageAccess), WTFMove(openerPrimaryDomain), std::nullopt, openerPageID, false, [](bool) { }); > } > >-void WebResourceLoadStatisticsStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& callback) >+void WebResourceLoadStatisticsStore::grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPromptedNow, CompletionHandler<void(bool)>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFrameHost = crossThreadCopy(subFrameHost), topFrameHost = crossThreadCopy(topFrameHost), frameID, pageID, userWasPromptedNow, callback = WTFMove(callback)] () mutable { >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFrameHost = crossThreadCopy(subFrameHost), topFrameHost = crossThreadCopy(topFrameHost), frameID, pageID, userWasPromptedNow, completionHandler = WTFMove(completionHandler)] () mutable { > auto subFramePrimaryDomain = isolatedPrimaryDomain(subFrameHost); > auto topFramePrimaryDomain = isolatedPrimaryDomain(topFrameHost); > if (userWasPromptedNow) { >@@ -484,9 +484,9 @@ void WebResourceLoadStatisticsStore::grantStorageAccess(String&& subFrameHost, S > ASSERT(subFrameStatistic.hadUserInteraction); > subFrameStatistic.storageAccessUnderTopFrameOrigins.add(topFramePrimaryDomain); > } >- grantStorageAccessInternal(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPromptedNow, [callback = WTFMove(callback)] (bool wasGrantedAccess) mutable { >- RunLoop::main().dispatch([callback = WTFMove(callback), wasGrantedAccess] () mutable { >- callback(wasGrantedAccess); >+ grantStorageAccessInternal(WTFMove(subFrameHost), WTFMove(topFrameHost), frameID, pageID, userWasPromptedNow, [completionHandler = WTFMove(completionHandler)] (bool wasGrantedAccess) mutable { >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), wasGrantedAccess] () mutable { >+ completionHandler(wasGrantedAccess); > }); > }); > }); >@@ -672,6 +672,8 @@ void WebResourceLoadStatisticsStore::logFrameNavigation(const WebFrameProxy& fra > > void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -687,6 +689,8 @@ void WebResourceLoadStatisticsStore::logUserInteraction(const URL& url) > > void WebResourceLoadStatisticsStore::logNonRecentUserInteraction(const URL& url) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -701,6 +705,8 @@ void WebResourceLoadStatisticsStore::logNonRecentUserInteraction(const URL& url) > > void WebResourceLoadStatisticsStore::clearUserInteraction(const URL& url) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -711,8 +717,10 @@ void WebResourceLoadStatisticsStore::clearUserInteraction(const URL& url) > }); > } > >-void WebResourceLoadStatisticsStore::hasHadUserInteraction(const URL& url, WTF::Function<void (bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::hasHadUserInteraction(const URL& url, CompletionHandler<void (bool)>&& completionHandler) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) { > completionHandler(false); > return; >@@ -729,6 +737,8 @@ void WebResourceLoadStatisticsStore::hasHadUserInteraction(const URL& url, WTF:: > > void WebResourceLoadStatisticsStore::setLastSeen(const URL& url, Seconds seconds) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -740,6 +750,8 @@ void WebResourceLoadStatisticsStore::setLastSeen(const URL& url, Seconds seconds > > void WebResourceLoadStatisticsStore::setPrevalentResource(const URL& url) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -778,8 +790,10 @@ void WebResourceLoadStatisticsStore::setPrevalentResource(WebCore::ResourceLoadS > } > } > >-void WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url, WTF::Function<void (bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url, CompletionHandler<void (bool)>&& completionHandler) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) { > completionHandler(false); > return; >@@ -794,7 +808,7 @@ void WebResourceLoadStatisticsStore::isPrevalentResource(const URL& url, WTF::Fu > }); > } > >-void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const URL& url, WTF::Function<void(bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const URL& url, CompletionHandler<void(bool)>&& completionHandler) > { > ASSERT(isMainThread()); > >@@ -812,8 +826,10 @@ void WebResourceLoadStatisticsStore::isVeryPrevalentResource(const URL& url, WTF > }); > } > >-void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, WTF::Function<void (bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const URL& subFrame, const URL& topFrame, CompletionHandler<void (bool)>&& completionHandler) > { >+ ASSERT(RunLoop::isMain()); >+ > m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), subFramePrimaryDomain = isolatedPrimaryDomain(subFrame), topFramePrimaryDomain = isolatedPrimaryDomain(topFrame), completionHandler = WTFMove(completionHandler)] () mutable { > auto mapEntry = m_resourceStatisticsMap.find(subFramePrimaryDomain); > bool isRegisteredAsSubFrameUnder = mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subframeUnderTopFrameOrigins.contains(topFramePrimaryDomain); >@@ -823,8 +839,10 @@ void WebResourceLoadStatisticsStore::isRegisteredAsSubFrameUnder(const URL& subF > }); > } > >-void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, WTF::Function<void (bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const URL& hostRedirectedFrom, const URL& hostRedirectedTo, CompletionHandler<void (bool)>&& completionHandler) > { >+ ASSERT(RunLoop::isMain()); >+ > m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), hostRedirectedFromPrimaryDomain = isolatedPrimaryDomain(hostRedirectedFrom), hostRedirectedToPrimaryDomain = isolatedPrimaryDomain(hostRedirectedTo), completionHandler = WTFMove(completionHandler)] () mutable { > auto mapEntry = m_resourceStatisticsMap.find(hostRedirectedFromPrimaryDomain); > bool isRegisteredAsRedirectingTo = mapEntry == m_resourceStatisticsMap.end() ? false : mapEntry->value.subresourceUniqueRedirectsTo.contains(hostRedirectedToPrimaryDomain); >@@ -836,6 +854,8 @@ void WebResourceLoadStatisticsStore::isRegisteredAsRedirectingTo(const URL& host > > void WebResourceLoadStatisticsStore::clearPrevalentResource(const URL& url) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -848,6 +868,8 @@ void WebResourceLoadStatisticsStore::clearPrevalentResource(const URL& url) > > void WebResourceLoadStatisticsStore::setGrandfathered(const URL& url, bool value) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) > return; > >@@ -857,8 +879,10 @@ void WebResourceLoadStatisticsStore::setGrandfathered(const URL& url, bool value > }); > } > >-void WebResourceLoadStatisticsStore::isGrandfathered(const URL& url, WTF::Function<void (bool)>&& completionHandler) >+void WebResourceLoadStatisticsStore::isGrandfathered(const URL& url, CompletionHandler<void (bool)>&& completionHandler) > { >+ ASSERT(RunLoop::isMain()); >+ > if (url.isBlankURL() || url.isEmpty()) { > completionHandler(false); > return; >@@ -875,6 +899,8 @@ void WebResourceLoadStatisticsStore::isGrandfathered(const URL& url, WTF::Functi > > void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const URL& subframe, const URL& topFrame) > { >+ ASSERT(RunLoop::isMain()); >+ > if (subframe.isBlankURL() || subframe.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty()) > return; > >@@ -888,6 +914,8 @@ void WebResourceLoadStatisticsStore::setSubframeUnderTopFrameOrigin(const URL& s > > void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const URL& subresource, const URL& topFrame) > { >+ ASSERT(RunLoop::isMain()); >+ > if (subresource.isBlankURL() || subresource.isEmpty() || topFrame.isBlankURL() || topFrame.isEmpty()) > return; > >@@ -901,6 +929,8 @@ void WebResourceLoadStatisticsStore::setSubresourceUnderTopFrameOrigin(const URL > > void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const URL& subresource, const URL& hostNameRedirectedTo) > { >+ ASSERT(RunLoop::isMain()); >+ > if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty()) > return; > >@@ -914,6 +944,8 @@ void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectTo(const URL& s > > void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const URL& subresource, const URL& hostNameRedirectedFrom) > { >+ ASSERT(RunLoop::isMain()); >+ > if (subresource.isBlankURL() || subresource.isEmpty() || hostNameRedirectedFrom.isBlankURL() || hostNameRedirectedFrom.isEmpty()) > return; > >@@ -927,6 +959,8 @@ void WebResourceLoadStatisticsStore::setSubresourceUniqueRedirectFrom(const URL& > > void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const URL& topFrameHostName, const URL& hostNameRedirectedTo) > { >+ ASSERT(RunLoop::isMain()); >+ > if (topFrameHostName.isBlankURL() || topFrameHostName.isEmpty() || hostNameRedirectedTo.isBlankURL() || hostNameRedirectedTo.isEmpty()) > return; > >@@ -940,6 +974,8 @@ void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectTo(const URL& topF > > void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const URL& topFrameHostName, const URL& hostNameRedirectedFrom) > { >+ ASSERT(RunLoop::isMain()); >+ > if (topFrameHostName.isBlankURL() || topFrameHostName.isEmpty() || hostNameRedirectedFrom.isBlankURL() || hostNameRedirectedFrom.isEmpty()) > return; > >@@ -951,37 +987,38 @@ void WebResourceLoadStatisticsStore::setTopFrameUniqueRedirectFrom(const URL& to > }); > } > >-void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate(CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdate(CompletionHandler<void()>&& completionHandler) > { > // Helper function used by testing system. Should only be called from the main thread. > ASSERT(RunLoop::isMain()); > >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), callback = WTFMove(callback)] () mutable { >- updateCookiePartitioning(WTFMove(callback)); >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), completionHandler = WTFMove(completionHandler)] () mutable { >+ updateCookiePartitioning(WTFMove(completionHandler)); > }); > } > >-void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::scheduleCookiePartitioningUpdateForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > // Helper function used by testing system. Should only be called from the main thread. > ASSERT(RunLoop::isMain()); >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), shouldClearFirst, callback = WTFMove(callback)] () mutable { >- updateCookiePartitioningForDomains(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(callback)); >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), shouldClearFirst, completionHandler = WTFMove(completionHandler)] () mutable { >+ updateCookiePartitioningForDomains(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, shouldClearFirst, WTFMove(completionHandler)); > }); > } > >-void WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::scheduleClearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler) > { > // Helper function used by testing system. Should only be called from the main thread. > ASSERT(RunLoop::isMain()); >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domains = crossThreadCopy(domains), callback = WTFMove(callback)] () mutable { >- clearPartitioningStateForDomains(domains, WTFMove(callback)); >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), domains = crossThreadCopy(domains), completionHandler = WTFMove(completionHandler)] () mutable { >+ clearPartitioningStateForDomains(domains, WTFMove(completionHandler)); > }); > } > > #if HAVE(CFNETWORK_STORAGE_PARTITIONING) > void WebResourceLoadStatisticsStore::scheduleCookiePartitioningStateReset() > { >+ ASSERT(RunLoop::isMain()); > m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this)] { > resetCookiePartitioningState(); > }); >@@ -996,19 +1033,23 @@ void WebResourceLoadStatisticsStore::scheduleClearInMemory() > }); > } > >-void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::scheduleClearInMemoryAndPersistent(ShouldGrandfather shouldGrandfather, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >- m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), shouldGrandfather, callback = WTFMove(callback)] () mutable { >+ m_statisticsQueue->dispatch([this, protectedThis = makeRef(*this), shouldGrandfather, completionHandler = WTFMove(completionHandler)] () mutable { > clearInMemory(); > m_persistentStorage.clear(); > > if (shouldGrandfather == ShouldGrandfather::Yes) >- grandfatherExistingWebsiteData([protectedThis = WTFMove(protectedThis), callback = WTFMove(callback)]() { >- callback(); >+ grandfatherExistingWebsiteData([protectedThis = WTFMove(protectedThis), completionHandler = WTFMove(completionHandler)]() mutable { >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() { >+ completionHandler(); >+ }); > }); > else { >- callback(); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() { >+ completionHandler(); >+ }); > } > }); > } >@@ -1190,7 +1231,7 @@ bool WebResourceLoadStatisticsStore::hasUserGrantedStorageAccessThroughPrompt(co > return statistic.storageAccessUnderTopFrameOrigins.contains(firstPartyPrimaryDomain); > } > >-void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > >@@ -1216,7 +1257,9 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler< > } > > if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty()) { >- callback(); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(); >+ }); > return; > } > >@@ -1254,20 +1297,22 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioning(CompletionHandler< > } > #endif > >- RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), callback = WTFMove(callback)] () { >+ RunLoop::main().dispatch([this, protectedThis = makeRef(*this), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), completionHandler = WTFMove(completionHandler)] () { > m_updatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No); >- callback(); >+ completionHandler(); > #if !RELEASE_LOG_DISABLED > RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done updating cookie partitioning and blocking."); > #endif > }); > } > >-void WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, ShouldClearFirst shouldClearFirst, CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > if (domainsToPartition.isEmpty() && domainsToBlock.isEmpty() && domainsToNeitherPartitionNorBlock.isEmpty() && shouldClearFirst == ShouldClearFirst::No) { >- callback(); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(); >+ }); > return; > } > >@@ -1291,14 +1336,18 @@ void WebResourceLoadStatisticsStore::updateCookiePartitioningForDomains(const Ve > for (auto& domain : domainsToBlock) > ensureResourceStatisticsForPrimaryDomain(domain).isMarkedForCookieBlocking = true; > >- callback(); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(); >+ }); > } > >-void WebResourceLoadStatisticsStore::clearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& callback) >+void WebResourceLoadStatisticsStore::clearPartitioningStateForDomains(const Vector<String>& domains, CompletionHandler<void()>&& completionHandler) > { > ASSERT(!RunLoop::isMain()); > if (domains.isEmpty()) { >- callback(); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(); >+ }); > return; > } > >@@ -1312,7 +1361,9 @@ void WebResourceLoadStatisticsStore::clearPartitioningStateForDomains(const Vect > statistic.isMarkedForCookieBlocking = false; > } > >- callback(); >+ RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)] { >+ completionHandler(); >+ }); > } > > void WebResourceLoadStatisticsStore::resetCookiePartitioningState() >diff --git a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >index 4f116244ba1e4c0dcf404648aecebb3931f54450..ee68e850d83357a58f41190d2c715aaeda686bab 100644 >--- a/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >+++ b/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h >@@ -105,17 +105,17 @@ public: > void logUserInteraction(const WebCore::URL&); > void logNonRecentUserInteraction(const WebCore::URL&); > void clearUserInteraction(const WebCore::URL&); >- void hasHadUserInteraction(const WebCore::URL&, WTF::Function<void (bool)>&&); >+ void hasHadUserInteraction(const WebCore::URL&, CompletionHandler<void (bool)>&&); > void setLastSeen(const WebCore::URL&, Seconds); > void setPrevalentResource(const WebCore::URL&); > void setVeryPrevalentResource(const WebCore::URL&); >- void isPrevalentResource(const WebCore::URL&, WTF::Function<void (bool)>&&); >- void isVeryPrevalentResource(const WebCore::URL&, WTF::Function<void(bool)>&&); >- void isRegisteredAsSubFrameUnder(const WebCore::URL& subFrame, const WebCore::URL& topFrame, WTF::Function<void (bool)>&&); >- void isRegisteredAsRedirectingTo(const WebCore::URL& hostRedirectedFrom, const WebCore::URL& hostRedirectedTo, WTF::Function<void (bool)>&&); >+ void isPrevalentResource(const WebCore::URL&, CompletionHandler<void (bool)>&&); >+ void isVeryPrevalentResource(const WebCore::URL&, CompletionHandler<void(bool)>&&); >+ void isRegisteredAsSubFrameUnder(const WebCore::URL& subFrame, const WebCore::URL& topFrame, CompletionHandler<void (bool)>&&); >+ void isRegisteredAsRedirectingTo(const WebCore::URL& hostRedirectedFrom, const WebCore::URL& hostRedirectedTo, CompletionHandler<void (bool)>&&); > void clearPrevalentResource(const WebCore::URL&); > void setGrandfathered(const WebCore::URL&, bool); >- void isGrandfathered(const WebCore::URL&, WTF::Function<void (bool)>&&); >+ void isGrandfathered(const WebCore::URL&, CompletionHandler<void (bool)>&&); > void setSubframeUnderTopFrameOrigin(const WebCore::URL& subframe, const WebCore::URL& topFrame); > void setSubresourceUnderTopFrameOrigin(const WebCore::URL& subresource, const WebCore::URL& topFrame); > void setSubresourceUniqueRedirectTo(const WebCore::URL& subresource, const WebCore::URL& hostNameRedirectedTo);
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 183216
:
343265
|
343280
|
343299
|
343304