Title: [245784] trunk
Revision
245784
Author
[email protected]
Date
2019-05-26 15:39:09 -0700 (Sun, 26 May 2019)

Log Message

Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
https://bugs.webkit.org/show_bug.cgi?id=198227
<rdar://problem/51117258>

Reviewed by Alex Christensen.

Source/WebCore:

Test: http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* dom/Document.cpp:
(WebCore::Document::referrer const):
    Now checks if the referrer has been overridden.
(WebCore::Document::wasLoadedWithDataTransferFromPrevalentResource):
(WebCore::Document::downgradeReferrerToRegistrableDomain):
* dom/Document.h:
* page/CrossSiteNavigationDataTransfer.h: Added.
    New option set for the growing number of navigational data transfers we care about.
* platform/network/NetworkStorageSession.cpp:
(WebCore::NetworkStorageSession::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
(WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration): Deleted.
    New name since we no longer only look for link decoration but also other means of navigational data transfer.
* platform/network/NetworkStorageSession.h:

Source/WebKit:

This patch adds a call back to the UI process if the network process finds the navigational
data transfer was done by a prevalent resource and we need to adjust something for the page.
Currently, that adjustment is to downgrade document.referrer.

The patch also removes an unused completion handler.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::didCommitCrossSiteLoadWithDataTransfer):
(WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration): Deleted.
    New name since we no longer only look for link decoration but also other means of navigational data transfer.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransfer):
(WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
(WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration): Deleted.
    New name since we no longer only look for link decoration but also other means of navigational data transfer.
* UIProcess/Network/NetworkProcessProxy.h:
* UIProcess/Network/NetworkProcessProxy.messages.in:
* UIProcess/WebPageProxy.cpp:
(WebKit::checkIfNavigationContainsDataTransfer):
(WebKit::WebPageProxy::didCommitLoadForFrame):
(WebKit::WebPageProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
(WebKit::isNonUniqueNavigationWithLinkDecoration): Deleted.
    New name since we no longer only look for link decoration but also other means of navigational data transfer.
* UIProcess/WebPageProxy.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer):
(WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration): Deleted.
    New name since we no longer only look for link decoration but also other means of navigational data transfer.
* UIProcess/WebProcessPool.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::wasLoadedWithDataTransferFromPrevalentResource):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

LayoutTests:

* http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt: Added.
* http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (245783 => 245784)


--- trunk/LayoutTests/ChangeLog	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/LayoutTests/ChangeLog	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1,3 +1,14 @@
+2019-05-26  John Wilander  <[email protected]>
+
+        Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
+        https://bugs.webkit.org/show_bug.cgi?id=198227
+        <rdar://problem/51117258>
+
+        Reviewed by Alex Christensen.
+
+        * http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt: Added.
+        * http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html: Added.
+
 2019-05-25  Youenn Fablet  <[email protected]>
 
         media/video-remote-control-playpause.html is timing out after r245712

Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt (0 => 245784)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt	2019-05-26 22:39:09 UTC (rev 245784)
@@ -0,0 +1,10 @@
+Check that document.referrer is downgraded to the eTLD+1 after a cross-site navigation with link query.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS The referrer is downgraded.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html (0 => 245784)


--- trunk/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html	2019-05-26 22:39:09 UTC (rev 245784)
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+    <script src=""
+</head>
+<body _onload_="setTimeout('runTest()', 0)">
+<script>
+    description("Check that document.referrer is downgraded to the eTLD+1 after a cross-site navigation with link query.");
+    jsTestIsAsync = true;
+
+    let numberOfTries = 0;
+    function testReferrer() {
+        if (document.referrer === prevalentResourceOrigin + "/") {
+            testPassed("The referrer is downgraded.");
+            setEnableFeature(false, finishJSTest);
+        } else if (++numberOfTries <= 5)
+            setTimeout(testReferrer, 200);
+        else {
+            testFailed("The referrer is not downgraded: " + document.referrer);
+            setEnableFeature(false, finishJSTest);
+        }
+    }
+
+    function navigateSameOriginToAddQuery() {
+        document.location.href = "" + "/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html?link=query";
+    }
+
+    function navigateCrossOrigin() {
+        document.location.href = "" + "/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html";
+    }
+
+    const destinationOrigin = "http://localhost:8000";
+    const prevalentResourceOrigin = "http://127.0.0.1:8000";
+    function runTest() {
+        if (document.location.origin === prevalentResourceOrigin && document.location.search === "") {
+            navigateSameOriginToAddQuery();
+        } else if (document.location.origin === prevalentResourceOrigin) {
+            setEnableFeature(true, function () {
+                testRunner.setStatisticsPrevalentResource(prevalentResourceOrigin, true, function() {
+                    if (!testRunner.isStatisticsPrevalentResource(prevalentResourceOrigin))
+                        testFailed("Host did not get set as prevalent resource.");
+                    testRunner.statisticsUpdateCookieBlocking(navigateCrossOrigin);
+                });
+            });
+        } else {
+            testReferrer();
+        }
+    }
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (245783 => 245784)


--- trunk/Source/WebCore/ChangeLog	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/ChangeLog	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1,3 +1,29 @@
+2019-05-26  John Wilander  <[email protected]>
+
+        Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
+        https://bugs.webkit.org/show_bug.cgi?id=198227
+        <rdar://problem/51117258>
+
+        Reviewed by Alex Christensen.
+
+        Test: http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html
+
+        * Headers.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Document.cpp:
+        (WebCore::Document::referrer const):
+            Now checks if the referrer has been overridden.
+        (WebCore::Document::wasLoadedWithDataTransferFromPrevalentResource):
+        (WebCore::Document::downgradeReferrerToRegistrableDomain):
+        * dom/Document.h:
+        * page/CrossSiteNavigationDataTransfer.h: Added.
+            New option set for the growing number of navigational data transfers we care about.
+        * platform/network/NetworkStorageSession.cpp:
+        (WebCore::NetworkStorageSession::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
+        (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration): Deleted.
+            New name since we no longer only look for link decoration but also other means of navigational data transfer.
+        * platform/network/NetworkStorageSession.h:
+
 2019-05-26  Zalan Bujtas  <[email protected]>
 
         [LFC][Verification] Add areEssentiallyEqual for LayoutRect

Modified: trunk/Source/WebCore/Headers.cmake (245783 => 245784)


--- trunk/Source/WebCore/Headers.cmake	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/Headers.cmake	2019-05-26 22:39:09 UTC (rev 245784)
@@ -742,6 +742,7 @@
     page/ContextMenuContext.h
     page/ContextMenuController.h
     page/ContextMenuProvider.h
+    page/CrossSiteNavigationDataTransfer.h
     page/DOMSelection.h
     page/DOMTimer.h
     page/DOMWindow.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (245783 => 245784)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1978,6 +1978,7 @@
 		6A22E8701F10418600F546C3 /* InspectorCanvas.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A22E86F1F10418600F546C3 /* InspectorCanvas.h */; };
 		6A72798B1F16C29C003F39B8 /* InspectorShaderProgram.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A7279881F16C29B003F39B8 /* InspectorShaderProgram.h */; };
 		6B0A07F221FA4B5C00D57391 /* AdClickAttribution.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B0A07F021FA4B5C00D57391 /* AdClickAttribution.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		6B1F48112298A37E00DE8B82 /* CrossSiteNavigationDataTransfer.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6B3480940EEF50D400AC1B41 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6B4E8613221B713F0022F389 /* RegistrableDomain.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4E8612221B713F0022F389 /* RegistrableDomain.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		6B693A2E1C51A82E00B03BEF /* ResourceLoadObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9055,6 +9056,7 @@
 		6A7279891F16C29B003F39B8 /* InspectorShaderProgram.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorShaderProgram.cpp; sourceTree = "<group>"; };
 		6B0A07F021FA4B5C00D57391 /* AdClickAttribution.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AdClickAttribution.h; sourceTree = "<group>"; };
 		6B0A07F121FA4B5C00D57391 /* AdClickAttribution.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AdClickAttribution.cpp; sourceTree = "<group>"; };
+		6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrossSiteNavigationDataTransfer.h; sourceTree = "<group>"; };
 		6B3480920EEF50D400AC1B41 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
 		6B4E8612221B713F0022F389 /* RegistrableDomain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegistrableDomain.h; sourceTree = "<group>"; };
 		6B693A2D1C51A82E00B03BEF /* ResourceLoadObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadObserver.h; sourceTree = "<group>"; };
@@ -20095,6 +20097,7 @@
 				065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */,
 				065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */,
 				7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */,
+				6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */,
 				975CA287130365F800E99AD9 /* Crypto.cpp */,
 				975CA288130365F800E99AD9 /* Crypto.h */,
 				975CA289130365F800E99AD9 /* Crypto.idl */,
@@ -28554,6 +28557,7 @@
 				E1C416120F6562FD0092D2FB /* CrossOriginAccessControl.h in Headers */,
 				41ABE67B1D0580DB006D862D /* CrossOriginPreflightChecker.h in Headers */,
 				E1C415DA0F655D6F0092D2FB /* CrossOriginPreflightResultCache.h in Headers */,
+				6B1F48112298A37E00DE8B82 /* CrossSiteNavigationDataTransfer.h in Headers */,
 				E169803D1133542D00894115 /* CRuntimeObject.h in Headers */,
 				975CA28B130365F800E99AD9 /* Crypto.h in Headers */,
 				7C9ACA981F3CCDAD00F3AA09 /* CryptoAesKeyAlgorithm.h in Headers */,

Modified: trunk/Source/WebCore/dom/Document.cpp (245783 => 245784)


--- trunk/Source/WebCore/dom/Document.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -4863,6 +4863,10 @@
 
 String Document::referrer() const
 {
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    if (!m_referrerOverride.isEmpty())
+        return m_referrerOverride;
+#endif
     if (frame())
         return frame()->loader().referrer();
     return String();
@@ -7847,6 +7851,37 @@
 {
     m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction = domain;
 }
+
+void Document::wasLoadedWithDataTransferFromPrevalentResource()
+{
+    downgradeReferrerToRegistrableDomain();
+}
+
+void Document::downgradeReferrerToRegistrableDomain()
+{
+    auto referrerStr = referrer();
+    if (referrerStr.isEmpty())
+        return;
+
+    URL referrerURL { URL(), referrerStr };
+    auto referrerPort = referrerURL.port();
+    RegistrableDomain referrerRegistrableDomain { referrerURL };
+    auto referrerRegistrableDomainStr = referrerRegistrableDomain.string();
+    if (referrerRegistrableDomainStr.isEmpty())
+        return;
+
+    StringBuilder builder;
+    builder.append(referrerURL.protocol());
+    builder.appendLiteral("://");
+    builder.append(referrerRegistrableDomainStr);
+    if (referrerPort) {
+        builder.append(':');
+        builder.appendNumber(*referrerPort);
+    }
+    builder.append('/');
+
+    m_referrerOverride = builder.toString();
+}
 #endif
 
 void Document::setConsoleMessageListener(RefPtr<StringCallback>&& listener)

Modified: trunk/Source/WebCore/dom/Document.h (245783 => 245784)


--- trunk/Source/WebCore/dom/Document.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/dom/Document.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1496,6 +1496,8 @@
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     bool hasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain&);
     void setHasRequestedPageSpecificStorageAccessWithUserInteraction(const RegistrableDomain&);
+    WEBCORE_EXPORT void wasLoadedWithDataTransferFromPrevalentResource();
+    void downgradeReferrerToRegistrableDomain();
 #endif
 
     String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&);
@@ -2043,6 +2045,7 @@
     
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     RegistrableDomain m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction { };
+    String m_referrerOverride;
 #endif
     
     CSSRegisteredCustomPropertySet m_CSSRegisteredPropertySet;

Added: trunk/Source/WebCore/page/CrossSiteNavigationDataTransfer.h (0 => 245784)


--- trunk/Source/WebCore/page/CrossSiteNavigationDataTransfer.h	                        (rev 0)
+++ trunk/Source/WebCore/page/CrossSiteNavigationDataTransfer.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+#include <wtf/OptionSet.h>
+
+namespace WebCore {
+
+struct CrossSiteNavigationDataTransfer {
+    enum class Flag : uint8_t {
+        DestinationLinkDecoration = 1 << 1,
+        ReferrerLinkDecoration = 1 << 2,
+    };
+};
+
+} // namespace WebCore
+#endif

Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (245783 => 245784)


--- trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -215,10 +215,9 @@
     m_cacheMaxAgeCapForPrevalentResources = WTF::nullopt;
 }
 
-void NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration(const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID)
+void NetworkStorageSession::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(const RegistrableDomain& toDomain, uint64_t pageID)
 {
-    if (shouldBlockThirdPartyCookies(fromDomain))
-        m_navigatedToWithLinkDecorationByPrevalentResource.add(pageID, toDomain);
+    m_navigatedToWithLinkDecorationByPrevalentResource.add(pageID, toDomain);
 }
 
 void NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting()

Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (245783 => 245784)


--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -144,6 +144,7 @@
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&, Optional<uint64_t> frameID, Optional<uint64_t> pageID) const;
     WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, Optional<uint64_t> frameID, Optional<uint64_t> pageID) const;
+    WEBCORE_EXPORT bool shouldBlockThirdPartyCookies(const RegistrableDomain&) const;
     WEBCORE_EXPORT void setPrevalentDomainsToBlockCookiesFor(const Vector<RegistrableDomain>&);
     WEBCORE_EXPORT void setAgeCapForClientSideCookies(Optional<Seconds>);
     WEBCORE_EXPORT void removePrevalentDomains(const Vector<RegistrableDomain>& domains);
@@ -156,7 +157,7 @@
     WEBCORE_EXPORT void setCacheMaxAgeCapForPrevalentResources(Seconds);
     WEBCORE_EXPORT void resetCacheMaxAgeCapForPrevalentResources();
     WEBCORE_EXPORT Optional<Seconds> maxAgeCacheCap(const ResourceRequest&);
-    WEBCORE_EXPORT void committedCrossSiteLoadWithLinkDecoration(const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID);
+    WEBCORE_EXPORT void didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(const RegistrableDomain& toDomain, uint64_t pageID);
     WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting();
 #endif
 
@@ -181,7 +182,6 @@
     CredentialStorage m_credentialStorage;
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-    bool shouldBlockThirdPartyCookies(const RegistrableDomain&) const;
     Optional<Seconds> clientSideCookieCap(const RegistrableDomain& firstParty, Optional<uint64_t> pageID) const;
     HashSet<RegistrableDomain> m_registrableDomainsToBlockCookieFor;
     HashMap<uint64_t, HashMap<uint64_t, RegistrableDomain, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;

Modified: trunk/Source/WebKit/ChangeLog (245783 => 245784)


--- trunk/Source/WebKit/ChangeLog	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/ChangeLog	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1,3 +1,47 @@
+2019-05-26  John Wilander  <[email protected]>
+
+        Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
+        https://bugs.webkit.org/show_bug.cgi?id=198227
+        <rdar://problem/51117258>
+
+        Reviewed by Alex Christensen.
+
+        This patch adds a call back to the UI process if the network process finds the navigational
+        data transfer was done by a prevalent resource and we need to adjust something for the page.
+        Currently, that adjustment is to downgrade document.referrer.
+
+        The patch also removes an unused completion handler.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::didCommitCrossSiteLoadWithDataTransfer):
+        (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration): Deleted.
+            New name since we no longer only look for link decoration but also other means of navigational data transfer.
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransfer):
+        (WebKit::NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
+        (WebKit::NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration): Deleted.
+            New name since we no longer only look for link decoration but also other means of navigational data transfer.
+        * UIProcess/Network/NetworkProcessProxy.h:
+        * UIProcess/Network/NetworkProcessProxy.messages.in:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::checkIfNavigationContainsDataTransfer):
+        (WebKit::WebPageProxy::didCommitLoadForFrame):
+        (WebKit::WebPageProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
+        (WebKit::isNonUniqueNavigationWithLinkDecoration): Deleted.
+            New name since we no longer only look for link decoration but also other means of navigational data transfer.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::didCommitCrossSiteLoadWithDataTransfer):
+        (WebKit::WebProcessPool::committedCrossSiteLoadWithLinkDecoration): Deleted.
+            New name since we no longer only look for link decoration but also other means of navigational data transfer.
+        * UIProcess/WebProcessPool.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::wasLoadedWithDataTransferFromPrevalentResource):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2019-05-26  Wenson Hsieh  <[email protected]>
 
         [iOS] Dropped text, attachments, and images should animate into place

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (245783 => 245784)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1155,21 +1155,28 @@
     completionHandler();
 }
 
-void NetworkProcess::committedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID, CompletionHandler<void()>&& completionHandler)
+void NetworkProcess::didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag> navigationDataTransfer, uint64_t pageID)
 {
-    if (auto* networkStorageSession = storageSession(sessionID))
-        networkStorageSession->committedCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, pageID);
-    else
+    ASSERT(!navigationDataTransfer.isEmpty());
+
+    if (auto* networkStorageSession = storageSession(sessionID)) {
+        if (!networkStorageSession->shouldBlockThirdPartyCookies(fromDomain))
+            return;
+
+        if (navigationDataTransfer.contains(CrossSiteNavigationDataTransfer::Flag::DestinationLinkDecoration))
+            networkStorageSession->didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(toDomain, pageID);
+
+        if (navigationDataTransfer.contains(CrossSiteNavigationDataTransfer::Flag::ReferrerLinkDecoration))
+            parentProcessConnection()->send(Messages::NetworkProcessProxy::DidCommitCrossSiteLoadWithDataTransferFromPrevalentResource(pageID), 0);
+    } else
         ASSERT_NOT_REACHED();
-    
-    if (auto* networkSession = this->networkSession(sessionID)) {
-        if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
-            resourceLoadStatistics->logCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, WTFMove(completionHandler));
-        else
-            completionHandler();
-    } else {
-        ASSERT_NOT_REACHED();
-        completionHandler();
+
+    if (navigationDataTransfer.contains(CrossSiteNavigationDataTransfer::Flag::DestinationLinkDecoration)) {
+        if (auto* networkSession = this->networkSession(sessionID)) {
+            if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics())
+                resourceLoadStatistics->logCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, [] { });
+        } else
+            ASSERT_NOT_REACHED();
     }
 }
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (245783 => 245784)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -37,6 +37,7 @@
 #include "WebsiteData.h"
 #include <WebCore/AdClickAttribution.h>
 #include <WebCore/ClientOrigin.h>
+#include <WebCore/CrossSiteNavigationDataTransfer.h>
 #include <WebCore/DiagnosticLoggingClient.h>
 #include <WebCore/FetchIdentifier.h>
 #include <WebCore/IDBKeyData.h>
@@ -258,7 +259,7 @@
     void setTopFrameUniqueRedirectTo(PAL::SessionID, const TopFrameDomain&, const RedirectedToDomain&, CompletionHandler<void()>&&);
     void setTopFrameUniqueRedirectFrom(PAL::SessionID, const TopFrameDomain&, const RedirectedFromDomain&, CompletionHandler<void()>&&);
     void registrableDomainsWithWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&);
-    void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID, CompletionHandler<void()>&&);
+    void didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag>, uint64_t pageID);
     void setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&&);
     void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
 #endif

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (245783 => 245784)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in	2019-05-26 22:39:09 UTC (rev 245784)
@@ -131,7 +131,7 @@
     SetTopFrameUniqueRedirectTo(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain redirectedToDomain) -> () Async
     SetTopFrameUniqueRedirectFrom(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain redirectedFromDomain) -> () Async
     ResetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID) -> () Async
-    CommittedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain, uint64_t pageID) -> () Async
+    DidCommitCrossSiteLoadWithDataTransfer(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag> navigationDataTransfer, uint64_t pageID)
     SetCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain) -> () Async
     ResetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID) -> () Async
     DeleteCookiesForTesting(PAL::SessionID sessionID, WebCore::RegistrableDomain domain, bool includeHttpOnlyCookies) -> () Async

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -908,16 +908,26 @@
     WebProcessProxy::notifyPageStatisticsTelemetryFinished(API::Dictionary::create(messageBody).ptr());
 }
 
-void NetworkProcessProxy::committedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID, CompletionHandler<void()>&& completionHandler)
+void NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag> navigationDataTransfer, uint64_t pageID)
 {
-    if (!canSendMessage()) {
-        completionHandler();
+    if (!canSendMessage())
         return;
-    }
-    
-    sendWithAsyncReply(Messages::NetworkProcess::CommittedCrossSiteLoadWithLinkDecoration(sessionID, fromDomain, toDomain, pageID), WTFMove(completionHandler));
+
+    send(Messages::NetworkProcess::DidCommitCrossSiteLoadWithDataTransfer(sessionID, fromDomain, toDomain, navigationDataTransfer, pageID), 0);
 }
 
+void NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(uint64_t pageID)
+{
+    if (!canSendMessage())
+        return;
+
+    WebPageProxy* page = WebProcessProxy::webPage(pageID);
+    if (!page)
+        return;
+
+    page->didCommitCrossSiteLoadWithDataTransferFromPrevalentResource();
+}
+
 void NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&& completionHandler)
 {
     if (!canSendMessage()) {

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -36,6 +36,7 @@
 #include "ProcessThrottlerClient.h"
 #include "UserContentControllerIdentifier.h"
 #include "WebProcessProxyMessages.h"
+#include <WebCore/CrossSiteNavigationDataTransfer.h>
 #include <WebCore/RegistrableDomain.h>
 #include <memory>
 #include <wtf/Deque.h>
@@ -145,7 +146,8 @@
     void setResourceLoadStatisticsDebugMode(PAL::SessionID, bool debugMode, CompletionHandler<void()>&&);
     void setShouldClassifyResourcesBeforeDataRecordsRemoval(PAL::SessionID, bool, CompletionHandler<void()>&&);
     void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
-    void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const NavigatedFromDomain&, const NavigatedToDomain&, PageID, CompletionHandler<void()>&&);
+    void didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID, const NavigatedFromDomain&, const NavigatedToDomain&, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag>, PageID);
+    void didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(PageID);
     void setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID, const NavigatedFromDomain&, const NavigatedToDomain&, CompletionHandler<void()>&&);
     void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
     void deleteCookiesForTesting(PAL::SessionID, const RegistrableDomain&, bool includeHttpOnlyCookies, CompletionHandler<void()>&&);

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in	2019-05-26 22:39:09 UTC (rev 245784)
@@ -48,6 +48,7 @@
     NotifyResourceLoadStatisticsTelemetryFinished(unsigned totalPrevalentResources, unsigned totalPrevalentResourcesWithUserInteraction, unsigned top3SubframeUnderTopFrameOrigins)
     RequestStorageAccessConfirm(uint64_t pageID, uint64_t frameID, WebCore::RegistrableDomain subFrameDomain, WebCore::RegistrableDomain topFrameDomain) -> (bool userDidGrantAccess) Async
     DeleteWebsiteDataInUIProcessForRegistrableDomains(PAL::SessionID sessionID, OptionSet<WebKit::WebsiteDataType> dataTypes, OptionSet<WebKit::WebsiteDataFetchOption> fetchOptions, Vector<WebCore::RegistrableDomain> domains) -> (HashSet<WebCore::RegistrableDomain> domainsWithMatchingDataRecords) Async
+    DidCommitCrossSiteLoadWithDataTransferFromPrevalentResource(uint64_t pageID)
 #endif
 #if ENABLE(CONTENT_EXTENSIONS)
     ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -134,6 +134,7 @@
 #include "WebsiteDataStore.h"
 #include <WebCore/AdClickAttribution.h>
 #include <WebCore/BitmapImage.h>
+#include <WebCore/CrossSiteNavigationDataTransfer.h>
 #include <WebCore/DOMPasteAccess.h>
 #include <WebCore/DeprecatedGlobalSettings.h>
 #include <WebCore/DiagnosticLoggingClient.h>
@@ -4133,9 +4134,21 @@
 }
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
-static bool isNonUniqueNavigationWithLinkDecoration(const SecurityOriginData requesterOrigin, const URL& currentURL)
+static OptionSet<CrossSiteNavigationDataTransfer::Flag> checkIfNavigationContainsDataTransfer(const SecurityOriginData requesterOrigin, const ResourceRequest& currentRequest)
 {
-    return !requesterOrigin.securityOrigin()->isUnique() && (!currentURL.query().isEmpty() || !currentURL.fragmentIdentifier().isEmpty());
+    OptionSet<CrossSiteNavigationDataTransfer::Flag> navigationDataTransfer;
+    if (requesterOrigin.securityOrigin()->isUnique())
+        return navigationDataTransfer;
+
+    auto currentURL = currentRequest.url();
+    if (!currentURL.query().isEmpty() || !currentURL.fragmentIdentifier().isEmpty())
+        navigationDataTransfer.add(CrossSiteNavigationDataTransfer::Flag::DestinationLinkDecoration);
+
+    URL referrerURL { URL(), currentRequest.httpReferrer() };
+    if (!referrerURL.query().isEmpty() || !referrerURL.fragmentIdentifier().isEmpty())
+        navigationDataTransfer.add(CrossSiteNavigationDataTransfer::Flag::ReferrerLinkDecoration);
+
+    return navigationDataTransfer;
 }
 #endif
 
@@ -4155,12 +4168,13 @@
     if (frame->isMainFrame() && navigationID && (navigation = navigationState().navigation(navigationID))) {
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
         auto requesterOrigin = navigation->lastNavigationAction().requesterOrigin;
-        auto currentURL = navigation->currentRequest().url();
-        if (isNonUniqueNavigationWithLinkDecoration(requesterOrigin, currentURL)) {
-            RegistrableDomain currentDomain { currentURL };
+        auto currentRequest = navigation->currentRequest();
+        auto navigationDataTransfer = checkIfNavigationContainsDataTransfer(requesterOrigin, currentRequest);
+        if (!navigationDataTransfer.isEmpty()) {
+            RegistrableDomain currentDomain { currentRequest.url() };
             URL requesterURL { URL(), requesterOrigin.toString() };
             if (!currentDomain.matches(requesterURL))
-                m_process->processPool().committedCrossSiteLoadWithLinkDecoration(m_websiteDataStore->sessionID(), RegistrableDomain { requesterURL }, currentDomain, m_pageID);
+                m_process->processPool().didCommitCrossSiteLoadWithDataTransfer(m_websiteDataStore->sessionID(), RegistrableDomain { requesterURL }, currentDomain, navigationDataTransfer, m_pageID);
         }
 #endif
     }
@@ -8634,6 +8648,14 @@
 {
     m_uiClient->requestStorageAccessConfirm(*this, m_process->webFrame(frameID), subFrameDomain, topFrameDomain, WTFMove(completionHandler));
 }
+
+void WebPageProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource()
+{
+    if (!hasRunningProcess())
+        return;
+
+    m_process->send(Messages::WebPage::WasLoadedWithDataTransferFromPrevalentResource(), m_pageID);
+}
 #endif
 
 bool WebPageProxy::useDarkAppearance() const

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1449,6 +1449,7 @@
 
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     void requestStorageAccessConfirm(const WebCore::RegistrableDomain& subFrameDomain, const WebCore::RegistrableDomain& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&&);
+    void didCommitCrossSiteLoadWithDataTransferFromPrevalentResource();
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION)

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.cpp (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -2519,20 +2519,15 @@
     sendToAllProcesses(Messages::WebProcess::ClearCurrentModifierStateForTesting());
 }
 
-void WebProcessPool::committedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID)
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+void WebProcessPool::didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, OptionSet<CrossSiteNavigationDataTransfer::Flag> navigationDataTransfer, uint64_t pageID)
 {
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
     if (!m_networkProcess)
         return;
 
-    m_networkProcess->committedCrossSiteLoadWithLinkDecoration(sessionID, fromDomain, toDomain, pageID, [] { });
-#else
-    UNUSED_PARAM(sessionID);
-    UNUSED_PARAM(fromDomain);
-    UNUSED_PARAM(toDomain);
-    UNUSED_PARAM(pageID);
+    m_networkProcess->didCommitCrossSiteLoadWithDataTransfer(sessionID, fromDomain, toDomain, navigationDataTransfer, pageID);
+}
 #endif
-}
 
 void WebProcessPool::setWebProcessHasUploads(ProcessIdentifier processID)
 {

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (245783 => 245784)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -44,6 +44,7 @@
 #include "WebContextClient.h"
 #include "WebContextConnectionClient.h"
 #include "WebProcessProxy.h"
+#include <WebCore/CrossSiteNavigationDataTransfer.h>
 #include <WebCore/ProcessIdentifier.h>
 #include <WebCore/RegistrableDomain.h>
 #include <WebCore/SecurityOriginHash.h>
@@ -53,6 +54,7 @@
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/MemoryPressureHandler.h>
+#include <wtf/OptionSet.h>
 #include <wtf/RefCounter.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/StringHash.h>
@@ -493,7 +495,9 @@
     void sendDisplayConfigurationChangedMessageForTesting();
     void clearCurrentModifierStateForTesting();
 
-    void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const WebCore::RegistrableDomain& fromDomain, const WebCore::RegistrableDomain& toDomain, uint64_t pageID);
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    void didCommitCrossSiteLoadWithDataTransfer(PAL::SessionID, const WebCore::RegistrableDomain& fromDomain, const WebCore::RegistrableDomain& toDomain, OptionSet<WebCore::CrossSiteNavigationDataTransfer::Flag>, uint64_t pageID);
+#endif
 
 #if PLATFORM(GTK) || PLATFORM(WPE)
     void setSandboxEnabled(bool enabled) { m_sandboxEnabled = enabled; };

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (245783 => 245784)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-26 22:39:09 UTC (rev 245784)
@@ -6492,6 +6492,15 @@
 {
     WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, m_pageID), WTFMove(completionHandler));
 }
+
+void WebPage::wasLoadedWithDataTransferFromPrevalentResource()
+{
+    auto* frame = mainFrame();
+    if (!frame || !frame->document())
+        return;
+
+    frame->document()->wasLoadedWithDataTransferFromPrevalentResource();
+}
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (245783 => 245784)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-26 22:39:09 UTC (rev 245784)
@@ -1133,6 +1133,7 @@
 #if ENABLE(RESOURCE_LOAD_STATISTICS)
     void hasStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&&);
     void requestStorageAccess(WebCore::RegistrableDomain&& subFrameDomain, WebCore::RegistrableDomain&& topFrameDomain, uint64_t frameID, CompletionHandler<void(WebCore::StorageAccessWasGranted, WebCore::StorageAccessPromptWasShown)>&&);
+    void wasLoadedWithDataTransferFromPrevalentResource();
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (245783 => 245784)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-05-26 19:56:11 UTC (rev 245783)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-05-26 22:39:09 UTC (rev 245784)
@@ -567,4 +567,8 @@
 
     TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebKit::TextInputContext> contexts) Async
     FocusTextInputContext(struct WebKit::TextInputContext context) -> (bool success) Async
+
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    WasLoadedWithDataTransferFromPrevalentResource()
+#endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to