Title: [226835] trunk/Source
Revision
226835
Author
[email protected]
Date
2018-01-11 17:53:58 -0800 (Thu, 11 Jan 2018)

Log Message

Add optional logging of ITP-related user interaction information
https://bugs.webkit.org/show_bug.cgi?id=181556

Reviewed by Brent Fulgham.

In order to support the tracking of the efficacy of Intelligent
Tracking Protection, add some logging indicating when the user
interacts with a page in a way that affects cookie partitioning. This
logging is off by default, and is enabled with `defaults write -g
WebKitLogCookieInformation -bool true`.

Source/WebCore:

No new tests -- no changed functionality.

* loader/ResourceLoadObserver.cpp:
(WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
* loader/ResourceLoadObserver.h:
(WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
(WebCore::ResourceLoadObserver::setShouldLogUserInteraction):

Source/WebKit:

* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode const):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226834 => 226835)


--- trunk/Source/WebCore/ChangeLog	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebCore/ChangeLog	2018-01-12 01:53:58 UTC (rev 226835)
@@ -1,3 +1,24 @@
+2018-01-11  Keith Rollin  <[email protected]>
+
+        Add optional logging of ITP-related user interaction information
+        https://bugs.webkit.org/show_bug.cgi?id=181556
+
+        Reviewed by Brent Fulgham.
+
+        In order to support the tracking of the efficacy of Intelligent
+        Tracking Protection, add some logging indicating when the user
+        interacts with a page in a way that affects cookie partitioning. This
+        logging is off by default, and is enabled with `defaults write -g
+        WebKitLogCookieInformation -bool true`.
+
+        No new tests -- no changed functionality.
+
+        * loader/ResourceLoadObserver.cpp:
+        (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
+        * loader/ResourceLoadObserver.h:
+        (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
+        (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
+
 2018-01-11  James Craig  <[email protected]>
 
         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.cpp (226834 => 226835)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.cpp	2018-01-12 01:53:58 UTC (rev 226835)
@@ -299,6 +299,20 @@
 
     m_notificationTimer.stop();
     notifyObserver();
+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    if (shouldLogUserInteraction()) {
+        auto counter = ++m_loggingCounter;
+#define LOCAL_LOG(str, ...) \
+        RELEASE_LOG(ResourceLoadStatistics, "ResourceLoadObserver::logUserInteraction: counter = %" PRIu64 ": " str, counter, ##__VA_ARGS__)
+
+        LOCAL_LOG(R"({ "url": "%{public}s",)", url.string().utf8().data());
+        LOCAL_LOG(R"(  "domain" : "%{public}s",)", domain.utf8().data());
+        LOCAL_LOG(R"(  "until" : %f })", newTime.secondsSinceEpoch().seconds());
+
+#undef LOCAL_LOG
+    }
+#endif
 }
 
 ResourceLoadStatistics& ResourceLoadObserver::ensureResourceStatisticsForPrimaryDomain(const String& primaryDomain)

Modified: trunk/Source/WebCore/loader/ResourceLoadObserver.h (226834 => 226835)


--- trunk/Source/WebCore/loader/ResourceLoadObserver.h	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebCore/loader/ResourceLoadObserver.h	2018-01-12 01:53:58 UTC (rev 226835)
@@ -64,6 +64,12 @@
 
     WEBCORE_EXPORT void notifyObserver();
     WEBCORE_EXPORT void clearState();
+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    bool shouldLogUserInteraction() const { return m_shouldLogUserInteraction; }
+    void setShouldLogUserInteraction(bool shouldLogUserInteraction) { m_shouldLogUserInteraction = shouldLogUserInteraction; }
+#endif
+
 private:
     ResourceLoadObserver();
 
@@ -77,6 +83,10 @@
     HashMap<String, WTF::WallTime> m_lastReportedUserInteractionMap;
     WTF::Function<void (Vector<ResourceLoadStatistics>&&)> m_notificationCallback;
     Timer m_notificationTimer;
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    uint64_t m_loggingCounter { 0 };
+    bool m_shouldLogUserInteraction { false };
+#endif
 
     URL nonNullOwnerURL(const Document&) const;
 };

Modified: trunk/Source/WebKit/ChangeLog (226834 => 226835)


--- trunk/Source/WebKit/ChangeLog	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebKit/ChangeLog	2018-01-12 01:53:58 UTC (rev 226835)
@@ -1,3 +1,25 @@
+2018-01-11  Keith Rollin  <[email protected]>
+
+        Add optional logging of ITP-related user interaction information
+        https://bugs.webkit.org/show_bug.cgi?id=181556
+
+        Reviewed by Brent Fulgham.
+
+        In order to support the tracking of the efficacy of Intelligent
+        Tracking Protection, add some logging indicating when the user
+        interacts with a page in a way that affects cookie partitioning. This
+        logging is off by default, and is enabled with `defaults write -g
+        WebKitLogCookieInformation -bool true`.
+
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode const):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+
 2018-01-11  Megan Gardner  <[email protected]>
 
         Implement MultiDocument protocol for restoring focus to a WKWebView

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp (226834 => 226835)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp	2018-01-12 01:53:58 UTC (rev 226835)
@@ -146,6 +146,10 @@
 #if USE(SOUP)
     encoder << proxySettings;
 #endif
+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    encoder << shouldLogUserInteraction;
+#endif
 }
 
 bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreationParameters& parameters)
@@ -382,6 +386,11 @@
         return false;
 #endif
 
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    if (!decoder.decode(parameters.shouldLogUserInteraction))
+        return false;
+#endif
+
     return true;
 }
 

Modified: trunk/Source/WebKit/Shared/WebProcessCreationParameters.h (226834 => 226835)


--- trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebKit/Shared/WebProcessCreationParameters.h	2018-01-12 01:53:58 UTC (rev 226835)
@@ -180,6 +180,10 @@
 #if USE(SOUP)
     WebCore::SoupNetworkProxySettings proxySettings;
 #endif
+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    bool shouldLogUserInteraction { false };
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (226834 => 226835)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2018-01-12 01:53:58 UTC (rev 226835)
@@ -275,6 +275,10 @@
     if (isSafari && !parameters.shouldCaptureAudioInUIProcess && mediaDevicesEnabled)
         SandboxExtension::createHandleForGenericExtension("com.apple.webkit.microphone", parameters.audioCaptureExtensionHandle);
 #endif
+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    parameters.shouldLogUserInteraction = [defaults boolForKey:WebKitLogCookieInformationDefaultsKey];
+#endif
 }
 
 void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationParameters& parameters)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (226834 => 226835)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2018-01-12 01:50:49 UTC (rev 226834)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2018-01-12 01:53:58 UTC (rev 226835)
@@ -423,6 +423,10 @@
 #if ENABLE(WEBASSEMBLY)
     JSC::Wasm::enableFastMemory();
 #endif
+
+#if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED
+    ResourceLoadObserver::shared().setShouldLogUserInteraction(parameters.shouldLogUserInteraction);
+#endif
 }
 
 void WebProcess::registerURLSchemeAsEmptyDocument(const String& urlScheme)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to