Title: [227860] trunk/Source
Revision
227860
Author
[email protected]
Date
2018-01-30 15:12:03 -0800 (Tue, 30 Jan 2018)

Log Message

Add telemetry to track storage access API adoption
https://bugs.webkit.org/show_bug.cgi?id=182197
<rdar://problem/35803309>

Reviewed by Chris Dumez.

Part 2: Add telemetry for the Storage Access API case

Source/WebCore:

Adds a new convenience method to identify origin/page/frame combinations that
have been granted access to the Storage Access API. This is used for debug
logging in the NetworkProcess. It is not used in production builds.

* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Added.

Source/WebKit:

This change increments a counter when an origin is loaded in a first part context because
it was granted Storage Access API permissions.

* NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::logCookieInformation const): Add logging to indicate
loads that happened with the Storage Access API enabled.
* UIProcess/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Increment counter for
loads using the new API.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (227859 => 227860)


--- trunk/Source/WebCore/ChangeLog	2018-01-30 23:05:57 UTC (rev 227859)
+++ trunk/Source/WebCore/ChangeLog	2018-01-30 23:12:03 UTC (rev 227860)
@@ -1,3 +1,21 @@
+2018-01-30  Brent Fulgham  <[email protected]>
+
+        Add telemetry to track storage access API adoption
+        https://bugs.webkit.org/show_bug.cgi?id=182197
+        <rdar://problem/35803309>
+
+        Reviewed by Chris Dumez.
+
+        Part 2: Add telemetry for the Storage Access API case
+
+        Adds a new convenience method to identify origin/page/frame combinations that
+        have been granted access to the Storage Access API. This is used for debug
+        logging in the NetworkProcess. It is not used in production builds.
+
+        * platform/network/NetworkStorageSession.h:
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+        (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Added.
+
 2018-01-30  Ryosuke Niwa  <[email protected]>
 
         Release assert in updateLayout() via AXObjectCache::childrenChanged

Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (227859 => 227860)


--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2018-01-30 23:05:57 UTC (rev 227859)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2018-01-30 23:12:03 UTC (rev 227860)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -99,6 +99,7 @@
     WEBCORE_EXPORT void setPrevalentDomainsToPartitionOrBlockCookies(const Vector<String>& domainsToPartition, const Vector<String>& domainsToBlock, const Vector<String>& domainsToNeitherPartitionNorBlock, bool clearFirst);
     WEBCORE_EXPORT void removePrevalentDomains(const Vector<String>& domains);
     WEBCORE_EXPORT bool hasStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID) const;
+    WEBCORE_EXPORT bool hasStorageAccessForFrame(const ResourceRequest&, uint64_t frameID, uint64_t pageID) const;
     WEBCORE_EXPORT void grantStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID);
     WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
     WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID);

Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (227859 => 227860)


--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2018-01-30 23:05:57 UTC (rev 227859)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2018-01-30 23:12:03 UTC (rev 227860)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -296,6 +296,14 @@
     return it2->value == resourceDomain;
 }
 
+bool NetworkStorageSession::hasStorageAccessForFrame(const ResourceRequest& request, uint64_t frameID, uint64_t pageID) const
+{
+    if (!cookieStoragePartitioningEnabled)
+        return false;
+
+    return hasStorageAccessForFrame(getPartitioningDomain(request.url()), getPartitioningDomain(request.firstPartyForCookies()), frameID, pageID);
+}
+
 void NetworkStorageSession::grantStorageAccessForFrame(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID)
 {
     UNUSED_PARAM(firstPartyDomain);

Modified: trunk/Source/WebKit/ChangeLog (227859 => 227860)


--- trunk/Source/WebKit/ChangeLog	2018-01-30 23:05:57 UTC (rev 227859)
+++ trunk/Source/WebKit/ChangeLog	2018-01-30 23:12:03 UTC (rev 227860)
@@ -1,3 +1,23 @@
+2018-01-30  Brent Fulgham  <[email protected]>
+
+        Add telemetry to track storage access API adoption
+        https://bugs.webkit.org/show_bug.cgi?id=182197
+        <rdar://problem/35803309>
+
+        Reviewed by Chris Dumez.
+
+        Part 2: Add telemetry for the Storage Access API case
+
+        This change increments a counter when an origin is loaded in a first part context because
+        it was granted Storage Access API permissions.
+
+        * NetworkProcess/NetworkResourceLoader.cpp:
+        (WebKit::NetworkResourceLoader::logCookieInformation const): Add logging to indicate
+        loads that happened with the Storage Access API enabled.
+        * UIProcess/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::requestStorageAccess): Increment counter for
+        loads using the new API.
+
 2018-01-30  Megan Gardner  <[email protected]>
 
         Make preserve and restore focus more likely to be symmetrical

Modified: trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp (227859 => 227860)


--- trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2018-01-30 23:05:57 UTC (rev 227859)
+++ trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp	2018-01-30 23:12:03 UTC (rev 227860)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -722,6 +722,7 @@
 
     auto url = ""
     auto partition = WebCore::URL(ParsedURLString, networkStorageSession->cookieStoragePartition(originalRequest(), frameID(), pageID()));
+    bool hasStorageAccessForFrame = networkStorageSession->hasStorageAccessForFrame(originalRequest(), frameID(), pageID());
 
     Vector<WebCore::Cookie> cookies;
     bool result = WebCore::getRawCookies(*networkStorageSession, partition, url, frameID(), pageID(), cookies);
@@ -740,6 +741,7 @@
 
         LOCAL_LOG(R"({ "url": "%{public}s",)", escapedURL.utf8().data());
         LOCAL_LOG(R"(  "partition": "%{public}s",)", escapedPartition.utf8().data());
+        LOCAL_LOG(R"(  "hasStorageAccess": %{public}s,)", hasStorageAccessForFrame ? "true" : "false");
         LOCAL_LOG(R"(  "referer": "%{public}s",)", escapedReferrer.utf8().data());
         LOCAL_LOG(R"(  "cookies": [)");
 

Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (227859 => 227860)


--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp	2018-01-30 23:05:57 UTC (rev 227859)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp	2018-01-30 23:12:03 UTC (rev 227860)
@@ -304,7 +304,9 @@
             callback(true);
             return;
         }
-        
+
+        subFrameStatistic.timesAccessedAsFirstPartyDueToStorageAccessAPI++;
+
         m_grantStorageAccessForFrameHandler(subFramePrimaryDomain, topFramePrimaryDomain, frameID, pageID, WTFMove(callback));
     });
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to