Diff
Modified: trunk/LayoutTests/ChangeLog (234079 => 234080)
--- trunk/LayoutTests/ChangeLog 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/LayoutTests/ChangeLog 2018-07-21 03:10:53 UTC (rev 234080)
@@ -1,3 +1,19 @@
+2018-07-20 John Wilander <wilan...@apple.com>
+
+ Resource Load Statistics: Enable basic functionality in experimental debug mode
+ https://bugs.webkit.org/show_bug.cgi?id=187835
+ <rdar://problem/42408590>
+
+ Reviewed by Chris Dumez.
+
+ This patch makes the experimental ITP Debug Mode feature work, at least
+ to a basic level.
+
+ * http/tests/resourceLoadStatistics/enable-debug-mode-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/enable-debug-mode.html: Added.
+ * http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode-expected.txt: Added.
+ * http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html: Added.
+
2018-07-20 Sihui Liu <sihui_...@apple.com>
[ MacOS iOS ] Layout Test storage/indexeddb/modern/opendatabase-after-storage-crash.html is flaky
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode-expected.txt (0 => 234080)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode-expected.txt 2018-07-21 03:10:53 UTC (rev 234080)
@@ -0,0 +1,10 @@
+Test for enabling debug mode and that it permanently treats 3rdpartytestwebkit.org as a prevalent resource.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS http://3rdpartytestwebkit.org got set as prevalent resource in debug mode.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html (0 => 234080)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/enable-debug-mode.html 2018-07-21 03:10:53 UTC (rev 234080)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <script src=""
+</head>
+<body>
+<script>
+ description("Test for enabling debug mode and that it permanently treats 3rdpartytestwebkit.org as a prevalent resource.");
+ jsTestIsAsync = true;
+
+ const thirdPartyOrigin = "http://3rdpartytestwebkit.org";
+
+ function setEnableFeature(enable, completionHandler) {
+ internals.setResourceLoadStatisticsEnabled(enable);
+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable);
+ testRunner.setCookieStoragePartitioningEnabled(enable);
+ if (!enable)
+ testRunner.statisticsResetToConsistentState(completionHandler);
+ else
+ completionHandler();
+ }
+
+ if (window.testRunner && window.internals) {
+ setEnableFeature(true, function() {
+ if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
+ testFailed(thirdPartyOrigin + " already set as prevalent resource.");
+
+ testRunner.setStatisticsDebugMode(true, function() {
+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
+ testFailed(thirdPartyOrigin + " didn't get set as prevalent resource.");
+ else
+ testPassed(thirdPartyOrigin + " got set as prevalent resource in debug mode.");
+ testRunner.setStatisticsDebugMode(false, function() {
+ setEnableFeature(false, finishJSTest);
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode-expected.txt (0 => 234080)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode-expected.txt 2018-07-21 03:10:53 UTC (rev 234080)
@@ -0,0 +1,10 @@
+Test for enabling debug mode and that it allows setting a custom domain as a prevalent resource.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS http://localhost:8000 got set as a custom prevalent resource in debug mode.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html (0 => 234080)
--- trunk/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/set-custom-prevalent-resource-in-debug-mode.html 2018-07-21 03:10:53 UTC (rev 234080)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <script src=""
+</head>
+<body>
+<script>
+ description("Test for enabling debug mode and that it allows setting a custom domain as a prevalent resource.");
+ jsTestIsAsync = true;
+
+ const thirdPartyOrigin = "http://localhost:8000";
+
+ function setEnableFeature(enable, completionHandler) {
+ internals.setResourceLoadStatisticsEnabled(enable);
+ testRunner.setStatisticsNotifyPagesWhenDataRecordsWereScanned(enable);
+ testRunner.setCookieStoragePartitioningEnabled(enable);
+ if (!enable)
+ testRunner.statisticsResetToConsistentState(completionHandler);
+ else
+ completionHandler();
+ }
+
+ if (window.testRunner && window.internals) {
+ setEnableFeature(true, function() {
+ if (testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
+ testFailed(thirdPartyOrigin + " already set as prevalent resource.");
+
+ testRunner.setStatisticsDebugMode(true, function() {
+ testRunner.setStatisticsPrevalentResourceForDebugMode(thirdPartyOrigin, function() {
+ if (!testRunner.isStatisticsPrevalentResource(thirdPartyOrigin))
+ testFailed(thirdPartyOrigin + " didn't get set as prevalent resource.");
+ else
+ testPassed(thirdPartyOrigin + " got set as a custom prevalent resource in debug mode.");
+ testRunner.setStatisticsDebugMode(false, function() {
+ setEnableFeature(false, finishJSTest);
+ });
+ });
+ });
+ });
+ }
+</script>
+</body>
+</html>
Modified: trunk/Source/WebKit/ChangeLog (234079 => 234080)
--- trunk/Source/WebKit/ChangeLog 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/ChangeLog 2018-07-21 03:10:53 UTC (rev 234080)
@@ -1,3 +1,63 @@
+2018-07-20 John Wilander <wilan...@apple.com>
+
+ Resource Load Statistics: Enable basic functionality in experimental debug mode
+ https://bugs.webkit.org/show_bug.cgi?id=187835
+ <rdar://problem/42408590>
+
+ Reviewed by Chris Dumez.
+
+ This patch makes the experimental ITP Debug Mode feature work, at least
+ to a basic level. This means:
+ - Debug logging on the INFO level.
+ - Permanently treat 3rdpartytestwebkit.org as a prevalent resource.
+ - Support manual setting of a custom permanently prevalent resource through user
+ defaults on Cocoa platforms.
+
+ * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+ (WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler):
+ (WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode):
+ Test infrastructure.
+ * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+ * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
+ (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
+ Used to pick up custom set prevalent resource on Cocoa platforms (for debug mode).
+ * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+ (WebKit::ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode):
+ (WebKit::ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords):
+ Now skips processing of debug mode prevalent resources so that they
+ stay prevalent.
+ (WebKit::ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode):
+ Convenience function to make 3rdpartytestwebkit.org and any custom domain
+ set through ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode()
+ be prevalent resources.
+ (WebKit::ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode):
+ (WebKit::ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode):
+ Sets a custom domain to always be treated as prevalent in debug mode.
+ (WebKit::ResourceLoadStatisticsMemoryStore::clear):
+ Now makes sure 3rdpartytestwebkit.org and any custom domain set through
+ ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode()
+ are prevalent resources even after a clear of the store.
+ (WebKit::debugLogDomainsInBatches):
+ We may have too many domain names to fit in a single log statement.
+ This function logs them in batches of 50, if we have more than 50.
+ (WebKit::ResourceLoadStatisticsMemoryStore::updateCookiePartitioning):
+ Now makes use of debugLogDomainsInBatches() in debug mode.
+ * UIProcess/ResourceLoadStatisticsMemoryStore.h:
+ (WebKit::ResourceLoadStatisticsMemoryStore::isDebugModeEnabled const):
+ * UIProcess/ResourceLoadStatisticsPersistentStorage.cpp:
+ (WebKit::ResourceLoadStatisticsPersistentStorage::populateMemoryStoreFromDisk):
+ Now accepts a non-empty memory store in debug mode. This is to support a
+ pre-populated store with 3rdpartytestwebkit.org and any custom domain already
+ set as prevalent.
+ (WebKit::ResourceLoadStatisticsPersistentStorage::setResourceLoadStatisticsDebugMode):
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode):
+ (WebKit::WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode):
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::setResourceLoadStatisticsDebugMode):
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2018-07-20 Tim Horton <timothy_hor...@apple.com>
Occasional crash under -[WKFormInputSession setSuggestions:]
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -69,6 +69,31 @@
WebKit::toImpl(dataStoreRef)->setResourceLoadStatisticsDebugMode(enable);
}
+void WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler(WKWebsiteDataStoreRef dataStoreRef, bool enable, void* context, WKWebsiteDataStoreStatisticsDebugModeFunction completionHandler)
+{
+ auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics();
+ if (!store) {
+ completionHandler(context);
+ return;
+ }
+
+ store->setResourceLoadStatisticsDebugMode(enable, [context, completionHandler] {
+ completionHandler(context);
+ });
+}
+
+void WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreStatisticsDebugModeFunction completionHandler)
+{
+ auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics();
+ if (!store) {
+ completionHandler(context);
+ return;
+ }
+
+ store->setPrevalentResourceForDebugMode(WebCore::URL(WebCore::URL(), WebKit::toImpl(host)->string()), [context, completionHandler] {
+ completionHandler(context);
+ });
+}
void WKWebsiteDataStoreSetStatisticsLastSeen(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, double seconds, void* context, WKWebsiteDataStoreStatisticsLastSeenFunction completionHandler)
{
auto* store = WebKit::toImpl(dataStoreRef)->websiteDataStore().resourceLoadStatistics();
Modified: trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -40,6 +40,9 @@
WK_EXPORT bool WKWebsiteDataStoreGetResourceLoadStatisticsEnabled(WKWebsiteDataStoreRef dataStoreRef);
WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsEnabled(WKWebsiteDataStoreRef dataStoreRef, bool enable);
WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsDebugMode(WKWebsiteDataStoreRef dataStoreRef, bool enable);
+typedef void (*WKWebsiteDataStoreStatisticsDebugModeFunction)(void* functionContext);
+WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler(WKWebsiteDataStoreRef dataStoreRef, bool enable, void* context, WKWebsiteDataStoreStatisticsDebugModeFunction completionHandler);
+WK_EXPORT void WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, void* context, WKWebsiteDataStoreStatisticsDebugModeFunction completionHandler);
typedef void (*WKWebsiteDataStoreStatisticsLastSeenFunction)(void* functionContext);
WK_EXPORT void WKWebsiteDataStoreSetStatisticsLastSeen(WKWebsiteDataStoreRef dataStoreRef, WKStringRef host, double seconds, void* context, WKWebsiteDataStoreStatisticsLastSeenFunction completionHandler);
typedef void (*WKWebsiteDataStoreStatisticsPrevalentResourceFunction)(void* functionContext);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm 2018-07-21 03:10:53 UTC (rev 234080)
@@ -25,6 +25,7 @@
#import "config.h"
#import "ResourceLoadStatisticsMemoryStore.h"
+#import <wtf/text/WTFString.h>
namespace WebKit {
@@ -51,6 +52,9 @@
setDebugLogggingEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ResourceLoadStatisticsDebugLoggingEnabled"]);
setResourceLoadStatisticsDebugMode([[NSUserDefaults standardUserDefaults] boolForKey:@"ExperimentalResourceLoadStatisticsDebugMode"]);
+ auto* debugManualPrevalentResource = [[NSUserDefaults standardUserDefaults] stringForKey:@"ResourceLoadStatisticsManualPrevalentResource"];
+ if (debugManualPrevalentResource)
+ setPrevalentResourceForDebugMode(debugManualPrevalentResource);
setStorageAccessPromptsEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ExperimentalStorageAccessPromptsEnabled"]);
});
}
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -51,6 +51,7 @@
constexpr Seconds minimumStatisticsProcessingInterval { 5_s };
constexpr unsigned operatingDatesWindow { 30 };
constexpr unsigned maxImportance { 3 };
+static const char* debugStaticPrevalentResource { "3rdpartytestwebkit.org" };
#if !RELEASE_LOG_DISABLED
static String domainsToString(const Vector<String>& domains)
@@ -319,6 +320,14 @@
}
}
+bool ResourceLoadStatisticsMemoryStore::isPrevalentDueToDebugMode(ResourceLoadStatistics& resourceStatistic)
+{
+ if (!m_debugModeEnabled)
+ return false;
+
+ return resourceStatistic.highLevelDomain == debugStaticPrevalentResource || resourceStatistic.highLevelDomain == m_debugManualPrevalentResource;
+}
+
void ResourceLoadStatisticsMemoryStore::processStatisticsAndDataRecords()
{
ASSERT(!RunLoop::isMain());
@@ -325,7 +334,9 @@
if (m_parameters.shouldClassifyResourcesBeforeDataRecordsRemoval) {
for (auto& resourceStatistic : m_resourceStatisticsMap.values()) {
- if (!resourceStatistic.isVeryPrevalentResource) {
+ if (isPrevalentDueToDebugMode(resourceStatistic))
+ setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
+ else if (!resourceStatistic.isVeryPrevalentResource) {
markAsPrevalentIfHasRedirectedToPrevalent(resourceStatistic);
auto currentPrevalence = resourceStatistic.isPrevalentResource ? ResourceLoadPrevalence::High : ResourceLoadPrevalence::Low;
auto newPrevalence = m_resourceLoadStatisticsClassifier.calculateResourcePrevalence(resourceStatistic, currentPrevalence);
@@ -507,13 +518,48 @@
});
}
+Vector<String> ResourceLoadStatisticsMemoryStore::ensurePrevalentResourcesForDebugMode()
+{
+ if (!m_debugModeEnabled)
+ return { };
+
+ Vector<String> primaryDomainsToBlock;
+ primaryDomainsToBlock.reserveInitialCapacity(2);
+
+ auto& staticSesourceStatistic = ensureResourceStatisticsForPrimaryDomain(debugStaticPrevalentResource);
+ setPrevalentResource(staticSesourceStatistic, ResourceLoadPrevalence::High);
+ primaryDomainsToBlock.uncheckedAppend(debugStaticPrevalentResource);
+
+ if (!m_debugManualPrevalentResource.isEmpty()) {
+ auto& manualResourceStatistic = ensureResourceStatisticsForPrimaryDomain(m_debugManualPrevalentResource);
+ setPrevalentResource(manualResourceStatistic, ResourceLoadPrevalence::High);
+ primaryDomainsToBlock.uncheckedAppend(m_debugManualPrevalentResource);
+ }
+
+ return primaryDomainsToBlock;
+}
+
void ResourceLoadStatisticsMemoryStore::setResourceLoadStatisticsDebugMode(bool enable)
{
ASSERT(!RunLoop::isMain());
m_debugModeEnabled = enable;
+ m_debugLoggingEnabled = enable;
+
+ ensurePrevalentResourcesForDebugMode();
+}
+
+void ResourceLoadStatisticsMemoryStore::setPrevalentResourceForDebugMode(const String& domain)
+{
+ if (!m_debugModeEnabled)
+ return;
+
+ m_debugManualPrevalentResource = domain;
+ auto& resourceStatistic = ensureResourceStatisticsForPrimaryDomain(domain);
+ setPrevalentResource(resourceStatistic, ResourceLoadPrevalence::High);
+
#if !RELEASE_LOG_DISABLED
- RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "ITP Debug Mode %{public}s.", (m_debugModeEnabled ? "enabled" : "disabled"));
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "Did set %{public}s as prevalent resource for the purposes of ITP Debug Mode.", domain.utf8().data());
#endif
}
@@ -891,7 +937,9 @@
m_operatingDates.clear();
removeAllStorageAccess();
- updateCookiePartitioningForDomains({ }, { }, { }, ShouldClearFirst::Yes, []() { });
+
+ auto primaryDomainsToBlock = ensurePrevalentResourcesForDebugMode();
+ updateCookiePartitioningForDomains({ }, primaryDomainsToBlock, { }, ShouldClearFirst::Yes, []() { });
}
bool ResourceLoadStatisticsMemoryStore::wasAccessedAsFirstPartyDueToUserInteraction(const ResourceLoadStatistics& current, const ResourceLoadStatistics& updated) const
@@ -935,6 +983,39 @@
return statistic.storageAccessUnderTopFrameOrigins.contains(firstPartyPrimaryDomain);
}
+static void debugLogDomainsInBatches(const char* action, const Vector<String>& domains)
+{
+#if !RELEASE_LOG_DISABLED
+ static const auto maxNumberOfDomainsInOneLogStatement = 50;
+ if (domains.isEmpty())
+ return;
+
+ if (domains.size() <= maxNumberOfDomainsInOneLogStatement) {
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to %{public}s cookies in third-party contexts for: %{public}s.", action, domainsToString(domains).utf8().data());
+ return;
+ }
+
+ Vector<String> batch;
+ batch.reserveInitialCapacity(maxNumberOfDomainsInOneLogStatement);
+ auto batchNumber = 1;
+ unsigned numberOfBatches = std::ceil(domains.size() / static_cast<float>(maxNumberOfDomainsInOneLogStatement));
+
+ for (auto& domain : domains) {
+ if (batch.size() == maxNumberOfDomainsInOneLogStatement) {
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to %{public}s cookies in third-party contexts for (%{public}d of %u): %{public}s.", action, batchNumber, numberOfBatches, domainsToString(batch).utf8().data());
+ batch.shrink(0);
+ ++batchNumber;
+ }
+ batch.append(domain);
+ }
+ if (!batch.isEmpty())
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to %{public}s cookies in third-party contexts for (%{public}d of %u): %{public}s.", action, batchNumber, numberOfBatches, domainsToString(batch).utf8().data());
+#else
+ UNUSED_PARAM(action);
+ UNUSED_PARAM(domains);
+#endif
+}
+
void ResourceLoadStatisticsMemoryStore::updateCookiePartitioning(CompletionHandler<void()>&& completionHandler)
{
ASSERT(!RunLoop::isMain());
@@ -965,16 +1046,14 @@
return;
}
-#if !RELEASE_LOG_DISABLED
if (m_debugLoggingEnabled) {
if (!domainsToPartition.isEmpty())
- RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %{public}s.", domainsToString(domainsToPartition).utf8().data());
+ debugLogDomainsInBatches("partition", domainsToPartition);
if (!domainsToBlock.isEmpty())
- RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to block cookies in third-party contexts for %{public}s.", domainsToString(domainsToBlock).utf8().data());
+ debugLogDomainsInBatches("block", domainsToBlock);
if (!domainsToNeitherPartitionNorBlock.isEmpty())
- RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to neither partition nor block cookies in third-party contexts for %{public}s.", domainsToString(domainsToNeitherPartitionNorBlock).utf8().data());
+ debugLogDomainsInBatches("neither partition nor block", domainsToNeitherPartitionNorBlock);
}
-#endif
RunLoop::main().dispatch([this, store = makeRef(m_store), domainsToPartition = crossThreadCopy(domainsToPartition), domainsToBlock = crossThreadCopy(domainsToBlock), domainsToNeitherPartitionNorBlock = crossThreadCopy(domainsToNeitherPartitionNorBlock), completionHandler = WTFMove(completionHandler)] () mutable {
store->callUpdatePrevalentDomainsToPartitionOrBlockCookiesHandler(domainsToPartition, domainsToBlock, domainsToNeitherPartitionNorBlock, ShouldClearFirst::No, [this, store = store.copyRef(), completionHandler = WTFMove(completionHandler)]() mutable {
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -113,6 +113,8 @@
void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
void setGrandfatheringTime(Seconds);
void setResourceLoadStatisticsDebugMode(bool);
+ bool isDebugModeEnabled() const { return m_debugModeEnabled; };
+ void setPrevalentResourceForDebugMode(const String& domain);
void hasStorageAccess(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
void requestStorageAccess(String&& subFramePrimaryDomain, String&& topFramePrimaryDomain, uint64_t frameID, uint64_t pageID, bool promptEnabled, CompletionHandler<void(StorageAccessStatus)>&&);
@@ -143,6 +145,8 @@
void scheduleStatisticsProcessingRequestIfNecessary();
void grantStorageAccessInternal(String&& subFrameHost, String&& topFrameHost, std::optional<uint64_t> frameID, uint64_t pageID, bool userWasPromptedNowOrEarlier, CompletionHandler<void(bool)>&&);
void markAsPrevalentIfHasRedirectedToPrevalent(WebCore::ResourceLoadStatistics&);
+ bool isPrevalentDueToDebugMode(WebCore::ResourceLoadStatistics&);
+ Vector<String> ensurePrevalentResourcesForDebugMode();
void removeDataRecords(CompletionHandler<void()>&&);
void pruneStatisticsIfNeeded();
WebCore::ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
@@ -181,6 +185,7 @@
WallTime m_endOfGrandfatheringTimestamp;
bool m_debugLoggingEnabled { false };
bool m_debugModeEnabled { false };
+ String m_debugManualPrevalentResource;
bool m_storageAccessPromptsEnabled { false };
bool m_dataRecordsBeingRemoved { false };
MonotonicTime m_lastTimeDataRecordsWereRemoved;
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsPersistentStorage.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -235,7 +235,8 @@
return;
}
- ASSERT_WITH_MESSAGE(m_memoryStore.isEmpty(), "This is the initial import so the store should be empty");
+ // Debug mode has a prepoulated memory store.
+ ASSERT_WITH_MESSAGE(m_memoryStore.isEmpty() || m_memoryStore.isDebugModeEnabled(), "This is the initial import so the store should be empty");
m_memoryStore.mergeWithDataFromDecoder(*decoder);
m_lastStatisticsFileSyncTime = readTime;
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -169,16 +169,32 @@
semaphore.wait(WallTime::infinity());
}
-void WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode(bool value)
+void WebResourceLoadStatisticsStore::setResourceLoadStatisticsDebugMode(bool value, CompletionHandler<void()>&& completionHandler)
{
ASSERT(RunLoop::isMain());
- postTask([this, value] {
+ postTask([this, value, completionHandler = WTFMove(completionHandler)]() mutable {
if (m_memoryStore)
m_memoryStore->setResourceLoadStatisticsDebugMode(value);
+ postTaskReply([completionHandler = WTFMove(completionHandler)] {
+ completionHandler();
+ });
});
}
+void WebResourceLoadStatisticsStore::setPrevalentResourceForDebugMode(const WebCore::URL& url, CompletionHandler<void()>&& completionHandler)
+{
+ ASSERT(RunLoop::isMain());
+
+ postTask([this, primaryDomain = isolatedPrimaryDomain(url), completionHandler = WTFMove(completionHandler)]() mutable {
+ if (m_memoryStore)
+ m_memoryStore->setPrevalentResourceForDebugMode(primaryDomain);
+ postTaskReply([completionHandler = WTFMove(completionHandler)] {
+ completionHandler();
+ });
+ });
+}
+
void WebResourceLoadStatisticsStore::scheduleStatisticsAndDataRecordsProcessing()
{
ASSERT(RunLoop::isMain());
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -132,8 +132,9 @@
void resetParametersToDefaultValues(CompletionHandler<void()>&&);
- void setResourceLoadStatisticsDebugMode(bool);
-
+ void setResourceLoadStatisticsDebugMode(bool, CompletionHandler<void()>&&);
+ void setPrevalentResourceForDebugMode(const WebCore::URL&, CompletionHandler<void()>&&);
+
void setStatisticsTestingCallback(WTF::Function<void(const String&)>&& callback) { m_statisticsTestingCallback = WTFMove(callback); }
void logTestingEvent(const String&);
void callGrantStorageAccessHandler(const String& subFramePrimaryDomain, const String& topFramePrimaryDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&&);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -1508,9 +1508,16 @@
void WebsiteDataStore::setResourceLoadStatisticsDebugMode(bool enabled)
{
+ setResourceLoadStatisticsDebugMode(enabled, []() { });
+}
+
+void WebsiteDataStore::setResourceLoadStatisticsDebugMode(bool enabled, CompletionHandler<void()>&& completionHandler)
+{
m_resourceLoadStatisticsDebugMode = enabled;
if (m_resourceLoadStatistics)
- m_resourceLoadStatistics->setResourceLoadStatisticsDebugMode(enabled);
+ m_resourceLoadStatistics->setResourceLoadStatisticsDebugMode(enabled, WTFMove(completionHandler));
+ else
+ completionHandler();
}
void WebsiteDataStore::enableResourceLoadStatisticsAndSetTestingCallback(Function<void (const String&)>&& callback)
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (234079 => 234080)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -109,6 +109,7 @@
void setResourceLoadStatisticsEnabled(bool);
bool resourceLoadStatisticsDebugMode() const;
void setResourceLoadStatisticsDebugMode(bool);
+ void setResourceLoadStatisticsDebugMode(bool, CompletionHandler<void()>&&);
uint64_t cacheStoragePerOriginQuota() const { return m_resolvedConfiguration.cacheStoragePerOriginQuota; }
void setCacheStoragePerOriginQuota(uint64_t quota) { m_resolvedConfiguration.cacheStoragePerOriginQuota = quota; }
Modified: trunk/Tools/ChangeLog (234079 => 234080)
--- trunk/Tools/ChangeLog 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/ChangeLog 2018-07-21 03:10:53 UTC (rev 234080)
@@ -1,3 +1,34 @@
+2018-07-20 John Wilander <wilan...@apple.com>
+
+ Resource Load Statistics: Enable basic functionality in experimental debug mode
+ https://bugs.webkit.org/show_bug.cgi?id=187835
+ <rdar://problem/42408590>
+
+ Reviewed by Chris Dumez.
+
+ This patch makes the experimental ITP Debug Mode feature work, at least
+ to a basic level. All of the changes to TestRunner are to support the
+ layout tests for the functionality.
+
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setStatisticsDebugMode):
+ (WTR::TestRunner::statisticsCallDidSetDebugModeCallback):
+ (WTR::TestRunner::setStatisticsPrevalentResourceForDebugMode):
+ (WTR::TestRunner::statisticsCallDidSetPrevalentResourceForDebugModeCallback):
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::setStatisticsDebugMode):
+ (WTR::TestController::setStatisticsPrevalentResourceForDebugMode):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle):
+ (WTR::TestInvocation::didSetStatisticsDebugMode):
+ (WTR::TestInvocation::didSetPrevalentResourceForDebugMode):
+ * WebKitTestRunner/TestInvocation.h:
+
2018-07-20 Ryosuke Niwa <rn...@apple.com>
Picking a color from the color panel for typing attributes needs to inverse transform through color-filter
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2018-07-21 03:10:53 UTC (rev 234080)
@@ -272,6 +272,8 @@
void installStatisticsDidModifyDataRecordsCallback(object callback);
void installStatisticsDidScanDataRecordsCallback(object callback);
void installStatisticsDidRunTelemetryCallback(object callback);
+ void setStatisticsDebugMode(boolean value, object completionHandler);
+ void setStatisticsPrevalentResourceForDebugMode(DOMString hostName, object completionHandler);
void setStatisticsLastSeen(DOMString hostName, double seconds, object completionHandler);
void setStatisticsPrevalentResource(DOMString hostName, boolean value, object completionHandler);
void setStatisticsVeryPrevalentResource(DOMString hostName, boolean value, object completionHandler);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -315,6 +315,16 @@
return;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetStatisticsDebugMode")) {
+ m_testRunner->statisticsCallDidSetDebugModeCallback();
+ return;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetPrevalentResourceForDebugMode")) {
+ m_testRunner->statisticsCallDidSetPrevalentResourceForDebugModeCallback();
+ return;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "CallDidSetLastSeen")) {
m_testRunner->statisticsCallDidSetLastSeenCallback();
return;
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -736,6 +736,8 @@
WillEndSwipeCallbackID,
DidEndSwipeCallbackID,
DidRemoveSwipeSnapshotCallbackID,
+ SetStatisticsDebugModeCallbackID,
+ SetStatisticsPrevalentResourceForDebugModeCallbackID,
SetStatisticsLastSeenCallbackID,
SetStatisticsPrevalentResourceCallbackID,
SetStatisticsVeryPrevalentResourceCallbackID,
@@ -1331,6 +1333,35 @@
callTestRunnerCallback(DidRemoveSwipeSnapshotCallbackID);
}
+void TestRunner::setStatisticsDebugMode(bool value, JSValueRef completionHandler)
+{
+ cacheTestRunnerCallback(SetStatisticsDebugModeCallbackID, completionHandler);
+
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsDebugMode"));
+ WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+
+}
+
+void TestRunner::statisticsCallDidSetDebugModeCallback()
+{
+ callTestRunnerCallback(SetStatisticsDebugModeCallbackID);
+}
+
+void TestRunner::setStatisticsPrevalentResourceForDebugMode(JSStringRef hostName, JSValueRef completionHandler)
+{
+ cacheTestRunnerCallback(SetStatisticsPrevalentResourceForDebugModeCallbackID, completionHandler);
+
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetStatisticsPrevalentResourceForDebugMode"));
+ WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(hostName));
+ WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get(), nullptr);
+}
+
+void TestRunner::statisticsCallDidSetPrevalentResourceForDebugModeCallback()
+{
+ callTestRunnerCallback(SetStatisticsPrevalentResourceForDebugModeCallbackID);
+}
+
void TestRunner::setStatisticsLastSeen(JSStringRef hostName, double seconds, JSValueRef completionHandler)
{
cacheTestRunnerCallback(SetStatisticsLastSeenCallbackID, completionHandler);
@@ -1363,7 +1394,6 @@
callTestRunnerCallback(SetStatisticsLastSeenCallbackID);
}
-
void TestRunner::setStatisticsPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler)
{
cacheTestRunnerCallback(SetStatisticsPrevalentResourceCallbackID, completionHandler);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -382,6 +382,10 @@
void statisticsSetShouldPartitionCookiesForHost(JSStringRef hostName, bool value, JSValueRef callback);
void statisticsCallDidSetPartitionOrBlockCookiesForHostCallback();
void statisticsSubmitTelemetry();
+ void setStatisticsDebugMode(bool value, JSValueRef completionHandler);
+ void statisticsCallDidSetDebugModeCallback();
+ void setStatisticsPrevalentResourceForDebugMode(JSStringRef hostName, JSValueRef completionHandler);
+ void statisticsCallDidSetPrevalentResourceForDebugModeCallback();
void setStatisticsLastSeen(JSStringRef hostName, double seconds, JSValueRef completionHandler);
void statisticsCallDidSetLastSeenCallback();
void setStatisticsPrevalentResource(JSStringRef hostName, bool value, JSValueRef completionHandler);
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -2645,7 +2645,25 @@
context->done = true;
context->testController.notifyDone();
}
-
+
+void TestController::setStatisticsDebugMode(bool value)
+{
+ auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
+ ResourceStatisticsCallbackContext context(*this);
+ WKWebsiteDataStoreSetResourceLoadStatisticsDebugModeWithCompletionHandler(dataStore, value, &context, resourceStatisticsVoidResultCallback);
+ runUntil(context.done, noTimeout);
+ m_currentInvocation->didSetStatisticsDebugMode();
+}
+
+void TestController::setStatisticsPrevalentResourceForDebugMode(WKStringRef hostName)
+{
+ auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
+ ResourceStatisticsCallbackContext context(*this);
+ WKWebsiteDataStoreSetResourceLoadStatisticsPrevalentResourceForDebugMode(dataStore, hostName, &context, resourceStatisticsVoidResultCallback);
+ runUntil(context.done, noTimeout);
+ m_currentInvocation->didSetPrevalentResourceForDebugMode();
+}
+
void TestController::setStatisticsLastSeen(WKStringRef host, double seconds)
{
auto* dataStore = WKContextGetWebsiteDataStore(platformContext());
Modified: trunk/Tools/WebKitTestRunner/TestController.h (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/TestController.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -156,6 +156,8 @@
void setShouldDownloadUndisplayableMIMETypes(bool value) { m_shouldDownloadUndisplayableMIMETypes = value; }
+ void setStatisticsDebugMode(bool value);
+ void setStatisticsPrevalentResourceForDebugMode(WKStringRef hostName);
void setStatisticsLastSeen(WKStringRef hostName, double seconds);
void setStatisticsPrevalentResource(WKStringRef hostName, bool value);
void setStatisticsVeryPrevalentResource(WKStringRef hostName, bool value);
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2018-07-21 03:10:53 UTC (rev 234080)
@@ -1036,6 +1036,20 @@
return result;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsDebugMode")) {
+ ASSERT(WKGetTypeID(messageBody) == WKBooleanGetTypeID());
+ WKBooleanRef value = static_cast<WKBooleanRef>(messageBody);
+ TestController::singleton().setStatisticsDebugMode(WKBooleanGetValue(value));
+ return nullptr;
+ }
+
+ if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsPrevalentResourceForDebugMode")) {
+ ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
+ WKStringRef hostName = static_cast<WKStringRef>(messageBody);
+ TestController::singleton().setStatisticsPrevalentResourceForDebugMode(hostName);
+ return nullptr;
+ }
+
if (WKStringIsEqualToUTF8CString(messageName, "SetStatisticsLastSeen")) {
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
@@ -1527,6 +1541,18 @@
WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
}
+void TestInvocation::didSetStatisticsDebugMode()
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetStatisticsDebugMode"));
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+}
+
+void TestInvocation::didSetPrevalentResourceForDebugMode()
+{
+ WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetPrevalentResourceForDebugMode"));
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
+}
+
void TestInvocation::didSetLastSeen()
{
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallDidSetLastSeen"));
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.h (234079 => 234080)
--- trunk/Tools/WebKitTestRunner/TestInvocation.h 2018-07-21 01:10:47 UTC (rev 234079)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.h 2018-07-21 03:10:53 UTC (rev 234080)
@@ -74,6 +74,8 @@
void didClearStatisticsThroughWebsiteDataRemoval();
void didResetStatisticsToConsistentState();
void didSetPartitionOrBlockCookiesForHost();
+ void didSetStatisticsDebugMode();
+ void didSetPrevalentResourceForDebugMode();
void didSetLastSeen();
void didSetPrevalentResource();
void didSetVeryPrevalentResource();