Diff
Modified: trunk/Source/WTF/ChangeLog (228966 => 228967)
--- trunk/Source/WTF/ChangeLog 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WTF/ChangeLog 2018-02-23 23:26:40 UTC (rev 228967)
@@ -1,3 +1,14 @@
+2018-02-23 John Wilander <wilan...@apple.com>
+
+ Introduce ITP debug logging as an opt-in developer feature
+ https://bugs.webkit.org/show_bug.cgi?id=183065
+ <rdar://problem/37803761>
+
+ Reviewed by Brent Fulgham.
+
+ * wtf/Assertions.h:
+ Introduces RELEASE_LOG_INFO() and RELEASE_LOG_INFO_IF().
+
2018-02-23 Fujii Hironori <hironori.fu...@sony.com>
warning: unused variable 'InitialBufferSize' in Assertions.cpp
Modified: trunk/Source/WTF/wtf/Assertions.h (228966 => 228967)
--- trunk/Source/WTF/wtf/Assertions.h 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WTF/wtf/Assertions.h 2018-02-23 23:26:40 UTC (rev 228967)
@@ -456,9 +456,11 @@
#else
#define RELEASE_LOG( channel, format, ...) os_log( LOG_CHANNEL(channel).osLogChannel, format, ##__VA_ARGS__)
#define RELEASE_LOG_ERROR(channel, format, ...) os_log_error(LOG_CHANNEL(channel).osLogChannel, format, ##__VA_ARGS__)
+#define RELEASE_LOG_INFO(channel, format, ...) os_log_info(LOG_CHANNEL(channel).osLogChannel, format, ##__VA_ARGS__)
#define RELEASE_LOG_IF( isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG( channel, format, ##__VA_ARGS__); } while (0)
#define RELEASE_LOG_ERROR_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_ERROR(channel, format, ##__VA_ARGS__); } while (0)
+#define RELEASE_LOG_INFO_IF(isAllowed, channel, format, ...) do { if (isAllowed) RELEASE_LOG_INFO(channel, format, ##__VA_ARGS__); } while (0)
#define RELEASE_LOG_WITH_LEVEL(channel, logLevel, format, ...) do { \
if (LOG_CHANNEL(channel).level >= (logLevel)) \
Modified: trunk/Source/WebKit/ChangeLog (228966 => 228967)
--- trunk/Source/WebKit/ChangeLog 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WebKit/ChangeLog 2018-02-23 23:26:40 UTC (rev 228967)
@@ -1,3 +1,29 @@
+2018-02-23 John Wilander <wilan...@apple.com>
+
+ Introduce ITP debug logging as an opt-in developer feature
+ https://bugs.webkit.org/show_bug.cgi?id=183065
+ <rdar://problem/37803761>
+
+ Reviewed by Brent Fulgham.
+
+ * Platform/Logging.h:
+ Added a dedicated channel for Resource Load Statistics debug logging
+ since this will be part of a developer-facing feature and should not
+ be mixed with general Resource Load Statistics logging.
+ * UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm:
+ (WebKit::WebResourceLoadStatisticsStore::registerUserDefaultsIfNeeded):
+ Now picks up the user default setting for
+ ResourceLoadStatisticsDebugLoggingEnabled.
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::removeDataRecords):
+ Now logs for which domains it purges website data if
+ ResourceLoadStatisticsDebugLoggingEnabled is set.
+ (WebKit::WebResourceLoadStatisticsStore::updateCookiePartitioning):
+ Now logs for which domains it partitions and blocks cookies
+ in third-party contexts if ResourceLoadStatisticsDebugLoggingEnabled
+ is set.
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+
2018-02-23 Brent Fulgham <bfulg...@apple.com>
[macOS] Correct sandbox violation during media playback
Modified: trunk/Source/WebKit/Platform/Logging.h (228966 => 228967)
--- trunk/Source/WebKit/Platform/Logging.h 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WebKit/Platform/Logging.h 2018-02-23 23:26:40 UTC (rev 228967)
@@ -64,6 +64,7 @@
M(RemoteLayerTree) \
M(Resize) \
M(ResourceLoadStatistics) \
+ M(ResourceLoadStatisticsDebug) \
M(Selection) \
M(ServiceWorker) \
M(SessionState) \
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm (228966 => 228967)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebResourceLoadStatisticsStoreCocoa.mm 2018-02-23 23:26:40 UTC (rev 228967)
@@ -48,6 +48,8 @@
Seconds grandfatheringTime([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsGrandfatheringTime"]);
if (grandfatheringTime > 0_s && grandfatheringTime <= 24_h * 7)
setGrandfatheringTime(grandfatheringTime);
+
+ setDebugLogggingEnabled([[NSUserDefaults standardUserDefaults] boolForKey:@"ResourceLoadStatisticsDebugLoggingEnabled"]);
});
}
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (228966 => 228967)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-02-23 23:26:40 UTC (rev 228967)
@@ -41,6 +41,9 @@
#include <wtf/DateMath.h>
#include <wtf/MathExtras.h>
#include <wtf/NeverDestroyed.h>
+#if !RELEASE_LOG_DISABLED
+#include <wtf/text/StringBuilder.h>
+#endif
namespace WebKit {
using namespace WebCore;
@@ -184,7 +187,16 @@
{
m_persistentStorage.finishAllPendingWorkSynchronously();
}
-
+
+#if !RELEASE_LOG_DISABLED
+static void appendWithDelimiter(StringBuilder& builder, const String& domain, bool isFirstItem)
+{
+ if (!isFirstItem)
+ builder.appendLiteral(", ");
+ builder.append(domain);
+}
+#endif
+
void WebResourceLoadStatisticsStore::removeDataRecords(CompletionHandler<void()>&& callback)
{
ASSERT(!RunLoop::isMain());
@@ -206,6 +218,18 @@
return;
}
+#if !RELEASE_LOG_DISABLED
+ if (m_debugLoggingEnabled) {
+ StringBuilder domainsToRemoveDataRecordsForBuilder;
+ bool isFirstItem = true;
+ for (auto& domain : prevalentResourceDomains) {
+ appendWithDelimiter(domainsToRemoveDataRecordsForBuilder, domain, isFirstItem);
+ isFirstItem = false;
+ }
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to remove data records for %{public}s.", domainsToRemoveDataRecordsForBuilder.toString().utf8().data());
+ }
+#endif
+
setDataRecordsBeingRemoved(true);
RunLoop::main().dispatch([prevalentResourceDomains = crossThreadCopy(prevalentResourceDomains), callback = WTFMove(callback), this, protectedThis = makeRef(*this)] () mutable {
@@ -217,6 +241,9 @@
}
setDataRecordsBeingRemoved(false);
callback();
+#if !RELEASE_LOG_DISABLED
+ RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done removing data records.");
+#endif
});
});
});
@@ -929,9 +956,47 @@
return;
}
+#if !RELEASE_LOG_DISABLED
+ if (m_debugLoggingEnabled) {
+ if (!domainsToPartition.isEmpty()) {
+ StringBuilder domainsToPartitionBuilder;
+ bool isFirstDomain = true;
+ for (auto& domain : domainsToPartition) {
+ appendWithDelimiter(domainsToPartitionBuilder, domain, isFirstDomain);
+ isFirstDomain = false;
+ }
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %{public}s.", domainsToPartitionBuilder.toString().utf8().data());
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to partition cookies in third-party contexts for %s.", domainsToPartitionBuilder.toString().utf8().data());
+ }
+
+ if (!domainsToBlock.isEmpty()) {
+ StringBuilder domainsToBlockBuilder;
+ bool isFirstDomain = true;
+ for (auto& domain : domainsToBlock) {
+ appendWithDelimiter(domainsToBlockBuilder, domain, isFirstDomain);
+ isFirstDomain = false;
+ }
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to block cookies in third-party contexts for %{public}s.", domainsToBlockBuilder.toString().utf8().data());
+ }
+
+ if (!domainsToNeitherPartitionNorBlock.isEmpty()) {
+ StringBuilder domainsToNeitherPartitionNorBlockBuilder;
+ bool isFirstDomain = true;
+ for (auto& domain : domainsToNeitherPartitionNorBlock) {
+ appendWithDelimiter(domainsToNeitherPartitionNorBlockBuilder, domain, isFirstDomain);
+ isFirstDomain = false;
+ }
+ RELEASE_LOG_INFO(ResourceLoadStatisticsDebug, "About to neither partition nor block cookies in third-party contexts for %{public}s.", domainsToNeitherPartitionNorBlockBuilder.toString().utf8().data());
+ }
+ }
+#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();
+#if !RELEASE_LOG_DISABLED
+ RELEASE_LOG_INFO_IF(m_debugLoggingEnabled, ResourceLoadStatisticsDebug, "Done updating cookie partitioning and blocking.");
+#endif
});
}
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (228966 => 228967)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-02-23 23:16:59 UTC (rev 228966)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-02-23 23:26:40 UTC (rev 228967)
@@ -176,6 +176,8 @@
void resetCookiePartitioningState();
+ void setDebugLogggingEnabled(bool enabled) { m_debugLoggingEnabled = enabled; }
+
#if PLATFORM(COCOA)
void registerUserDefaultsIfNeeded();
#endif
@@ -220,6 +222,8 @@
#endif
bool m_dataRecordsBeingRemoved { false };
+ bool m_debugLoggingEnabled { false };
+
Function<void (const String&)> m_statisticsTestingCallback;
};