Title: [227991] trunk/Source/WebKit
Revision
227991
Author
[email protected]
Date
2018-02-01 16:54:43 -0800 (Thu, 01 Feb 2018)

Log Message

Improve NetworkResourceLogger to report blocked (versus non-partitioned) cookies
https://bugs.webkit.org/show_bug.cgi?id=182408
<rdar://problem/36918028>

Reviewed by Chris Dumez.

Update the logging method to report blocked origins, rather than logging them as non-partitioned
loads that have no cookies or other content.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::logCookieInformation const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (227990 => 227991)


--- trunk/Source/WebKit/ChangeLog	2018-02-02 00:40:31 UTC (rev 227990)
+++ trunk/Source/WebKit/ChangeLog	2018-02-02 00:54:43 UTC (rev 227991)
@@ -1,3 +1,17 @@
+2018-02-01  Brent Fulgham  <[email protected]>
+
+        Improve NetworkResourceLogger to report blocked (versus non-partitioned) cookies
+        https://bugs.webkit.org/show_bug.cgi?id=182408
+        <rdar://problem/36918028>
+
+        Reviewed by Chris Dumez.
+
+        Update the logging method to report blocked origins, rather than logging them as non-partitioned
+        loads that have no cookies or other content.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::logCookieInformation const):
+
 2018-02-01  David Kilzer  <[email protected]>
 
         REGRESSION (r222824): UI process crashes in WebKit::WebBackForwardList::backItem const

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (227990 => 227991)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2018-02-02 00:40:31 UTC (rev 227990)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2018-02-02 00:54:43 UTC (rev 227991)
@@ -717,10 +717,31 @@
 
 void NetworkResourceLoader::logCookieInformation() const
 {
+    ASSERT(shouldLogCookieInformation());
+
     auto networkStorageSession = WebCore::NetworkStorageSession::storageSession(sessionID());
     ASSERT(networkStorageSession);
 
+#define LOCAL_LOG(str, ...) \
+    RELEASE_LOG_IF_ALLOWED("logCookieInformation: pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ": " str, pageID(), frameID(), identifier(), ##__VA_ARGS__)
+
+    auto escapeForJSON = [](String s) {
+        return s.replace('\\', "\\\\").replace('"', "\\\"");
+    };
+
     auto url = ""
+    if (networkStorageSession->shouldBlockCookies(originalRequest())) {
+        auto escapedURL = escapeForJSON(url.string());
+        auto escapedReferrer = escapeForJSON(originalRequest().httpReferrer());
+
+        LOCAL_LOG(R"({ "url": "%{public}s",)", escapedURL.utf8().data());
+        LOCAL_LOG(R"(  "partition": "%{public}s",)", "BLOCKED");
+        LOCAL_LOG(R"(  "hasStorageAccess": %{public}s,)", "false");
+        LOCAL_LOG(R"(  "referer": "%{public}s",)", escapedReferrer.utf8().data());
+        LOCAL_LOG(R"(  "cookies": []})");
+        return;
+    }
+
     auto partition = WebCore::URL(ParsedURLString, networkStorageSession->cookieStoragePartition(originalRequest(), frameID(), pageID()));
     bool hasStorageAccessForFrame = networkStorageSession->hasStorageAccessForFrame(originalRequest(), frameID(), pageID());
 
@@ -728,13 +749,6 @@
     bool result = WebCore::getRawCookies(*networkStorageSession, partition, url, frameID(), pageID(), cookies);
 
     if (result) {
-#define LOCAL_LOG(str, ...) \
-        RELEASE_LOG_IF_ALLOWED("logCookieInformation: pageID = %" PRIu64 ", frameID = %" PRIu64 ", resourceID = %" PRIu64 ": " str, pageID(), frameID(), identifier(), ##__VA_ARGS__)
-
-        auto escapeForJSON = [](String s) {
-            s.replace('\\', "\\\\").replace('"', "\\\"");
-            return s;
-        };
         auto escapedURL = escapeForJSON(url.string());
         auto escapedPartition = escapeForJSON(partition.string());
         auto escapedReferrer = escapeForJSON(originalRequest().httpReferrer());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to