WebKit Bugzilla
Attachment 370605 Details for
Bug 198227
: 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
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198227-20190524162909.patch (text/plain), 42.95 KB, created by
John Wilander
on 2019-05-24 16:29:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
John Wilander
Created:
2019-05-24 16:29:10 PDT
Size:
42.95 KB
patch
obsolete
>Subversion Revision: 245700 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2647ae55d94ba10178dbec89d72c64b67658c325..aafcc00c72bf2bd997079aa4ea1ff21fab439ba2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,29 @@ >+2019-05-24 John Wilander <wilander@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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-23 Antoine Quint <graouts@apple.com> > > [Pointer Events] Compatibility mouse events can only be prevented while the pointer is pressed >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index f9c188a92c4e9885cf18d091e302c2d60a7e642b..0cfc5562b5ca107adce152fc905c4606e5739ae7 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,45 @@ >+2019-05-24 John Wilander <wilander@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ 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. >+ >+ * 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-23 Youenn Fablet <youenn@apple.com> > > Set default WebsiteDataStore storage quota based on StorageQuotaManager >diff --git a/Source/WebCore/Headers.cmake b/Source/WebCore/Headers.cmake >index c2c7c2249e3f1ec07164a9309865b57582328913..e38c773c82fa139bb1b5e7ec3161ad79396804d5 100644 >--- a/Source/WebCore/Headers.cmake >+++ b/Source/WebCore/Headers.cmake >@@ -742,6 +742,7 @@ set(WebCore_PRIVATE_FRAMEWORK_HEADERS > page/ContextMenuContext.h > page/ContextMenuController.h > page/ContextMenuProvider.h >+ page/CrossSiteNavigationDataTransfer.h > page/DOMSelection.h > page/DOMTimer.h > page/DOMWindow.h >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index e6a1f5f1d719b4af63fd9dda7e1afd745a6de907..e70e54834e5b40b5fbba90e5a52b79873b2cfe80 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -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, ); }; }; >@@ -9053,6 +9054,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>"; }; >@@ -20089,6 +20091,7 @@ > 065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */, > 065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */, > 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */, >+ 6B1F480F22989EC400DE8B82 /* CrossSiteNavigationDataTransfer.h */, > 975CA287130365F800E99AD9 /* Crypto.cpp */, > 975CA288130365F800E99AD9 /* Crypto.h */, > 975CA289130365F800E99AD9 /* Crypto.idl */, >@@ -28548,6 +28551,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 */, >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index d6d35291cb96434425b0baae7449a06aa180d136..a4a75c85ea7ebc7a2904af9cd728c4e1905e2c16 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -4842,6 +4842,10 @@ ExceptionOr<void> Document::setCookie(const String& value) > > 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(); >@@ -7826,6 +7830,37 @@ void Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction(const > { > 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) >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index d061a0bd491d1c054548076221546e17448b44aa..9946f972fc1658252b144a844898658a2febb4d5 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -1495,6 +1495,8 @@ public: > #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&); >@@ -2033,6 +2035,7 @@ private: > > #if ENABLE(RESOURCE_LOAD_STATISTICS) > RegistrableDomain m_registrableDomainRequestedPageSpecificStorageAccessWithUserInteraction { }; >+ String m_referrerOverride; > #endif > > CSSRegisteredCustomPropertySet m_CSSRegisteredPropertySet; >diff --git a/Source/WebCore/page/CrossSiteNavigationDataTransfer.h b/Source/WebCore/page/CrossSiteNavigationDataTransfer.h >new file mode 100644 >index 0000000000000000000000000000000000000000..8995fe2a920385ffa2e81d0664e16003fe9e1180 >--- /dev/null >+++ b/Source/WebCore/page/CrossSiteNavigationDataTransfer.h >@@ -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 Flag { >+ DestinationLinkDecoration = 1 << 1, >+ ReferrerLinkDecoration = 1 << 2, >+ }; >+}; >+ >+} // namespace WebCore >+#endif >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.cpp b/Source/WebCore/platform/network/NetworkStorageSession.cpp >index 3b18e62fe3987db5fc8619bffca62a486f48a808..465da57bf387ca5bcf9bbea272f2c24ff1265dcb 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.cpp >+++ b/Source/WebCore/platform/network/NetworkStorageSession.cpp >@@ -215,10 +215,9 @@ void NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources() > 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() >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.h b/Source/WebCore/platform/network/NetworkStorageSession.h >index 030200df9c44fd4bcf2f5872dddfda563259850b..84d4eb66a7405e9c66c94d67a80918a08d7ddf7e 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.h >+++ b/Source/WebCore/platform/network/NetworkStorageSession.h >@@ -144,6 +144,7 @@ public: > #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 @@ public: > 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 @@ private: > 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; >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index a5d6f5cfcc7c4325e9ad73136f36fda299d1de0b..1e1cdbcf643a6aaaac77037844cae60313d31712 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -1155,21 +1155,30 @@ void NetworkProcess::resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID ses > 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, CompletionHandler<void()>&& completionHandler) > { >- if (auto* networkStorageSession = storageSession(sessionID)) >- networkStorageSession->committedCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, pageID); >- else >- ASSERT_NOT_REACHED(); >+ ASSERT(!navigationDataTransfer.isEmpty()); >+ >+ auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler)); > >- if (auto* networkSession = this->networkSession(sessionID)) { >- if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >- resourceLoadStatistics->logCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, WTFMove(completionHandler)); >- else >- completionHandler(); >- } else { >+ if (auto* networkStorageSession = storageSession(sessionID)) { >+ if (!networkStorageSession->shouldBlockThirdPartyCookies(fromDomain)) >+ return; >+ >+ if (navigationDataTransfer.contains(CrossSiteNavigationDataTransfer::DestinationLinkDecoration)) >+ networkStorageSession->didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(toDomain, pageID); >+ >+ if (navigationDataTransfer.contains(CrossSiteNavigationDataTransfer::ReferrerLinkDecoration)) >+ parentProcessConnection()->sendWithAsyncReply(Messages::NetworkProcessProxy::DidCommitCrossSiteLoadWithDataTransferFromPrevalentResource(pageID), [callbackAggregator = callbackAggregator.copyRef()] { }); >+ } else > ASSERT_NOT_REACHED(); >- completionHandler(); >+ >+ if (navigationDataTransfer.contains(CrossSiteNavigationDataTransfer::DestinationLinkDecoration)) { >+ if (auto* networkSession = this->networkSession(sessionID)) { >+ if (auto* resourceLoadStatistics = networkSession->resourceLoadStatistics()) >+ resourceLoadStatistics->logCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, [callbackAggregator = callbackAggregator.copyRef()] { }); >+ } else >+ ASSERT_NOT_REACHED(); > } > } > >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h >index 7acb3f9675c3d9487398c7a7d0cf363a997457aa..21560c1187c359030f9ac0ae9f3e330c4f54ae60 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h >@@ -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 @@ public: > 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, CompletionHandler<void()>&&); > void setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&&); > void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&); > #endif >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >index d9fee078fe73534bce46d522af3cd24b639b7c62..fe654350a5bd3e56e9fe33b29334e6a1a34113a0 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.messages.in >@@ -131,7 +131,7 @@ messages -> NetworkProcess LegacyReceiver { > 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) -> () Async > 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 >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index 3443b385fac741cd8b24bacee08b0734d07e0272..390a817011e886fe39cb05e9351eabcc0eac99a8 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -908,14 +908,25 @@ void NetworkProcessProxy::notifyResourceLoadStatisticsTelemetryFinished(unsigned > 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, CompletionHandler<void()>&& completionHandler) > { > if (!canSendMessage()) { > completionHandler(); > return; > } > >- sendWithAsyncReply(Messages::NetworkProcess::CommittedCrossSiteLoadWithLinkDecoration(sessionID, fromDomain, toDomain, pageID), WTFMove(completionHandler)); >+ sendWithAsyncReply(Messages::NetworkProcess::DidCommitCrossSiteLoadWithDataTransfer(sessionID, fromDomain, toDomain, navigationDataTransfer, pageID), WTFMove(completionHandler)); >+} >+ >+void NetworkProcessProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(uint64_t pageID, CompletionHandler<void()>&& completionHandler) >+{ >+ WebPageProxy* page = WebProcessProxy::webPage(pageID); >+ if (!page) { >+ completionHandler(); >+ return; >+ } >+ >+ page->didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(WTFMove(completionHandler)); > } > > void NetworkProcessProxy::setCrossSiteLoadWithLinkDecorationForTesting(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, CompletionHandler<void()>&& completionHandler) >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >index 20a7998c4dc24ab1656f39387f5700fa3ce9a68e..34e00aade4641a23f0a633380e7277445719a838 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >@@ -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 @@ public: > 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, CompletionHandler<void()>&&); >+ void didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(PageID, CompletionHandler<void()>&&); > 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()>&&); >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >index be98e66630fad790610920cef85275dc97ad1f1d..8abe7ffce2ed2ddde2f769cf0b54d5773bf4dd27 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >@@ -48,6 +48,7 @@ messages -> NetworkProcessProxy LegacyReceiver { > 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) -> () Async > #endif > #if ENABLE(CONTENT_EXTENSIONS) > ContentExtensionRules(WebKit::UserContentControllerIdentifier identifier) >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 656c8dcc59c4aebcf136d70c7f400f977681d50c..d8525a75f8bdc8118ea4bffe62d0f673de545559 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -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 @@ void WebPageProxy::clearLoadDependentCallbacks() > } > > #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::DestinationLinkDecoration); >+ >+ URL referrerURL { URL(), currentRequest.httpReferrer() }; >+ if (!referrerURL.query().isEmpty() || !referrerURL.fragmentIdentifier().isEmpty()) >+ navigationDataTransfer.add(CrossSiteNavigationDataTransfer::ReferrerLinkDecoration); >+ >+ return navigationDataTransfer; > } > #endif > >@@ -4155,12 +4168,13 @@ void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID > 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,11 @@ void WebPageProxy::requestStorageAccessConfirm(const RegistrableDomain& subFrame > { > m_uiClient->requestStorageAccessConfirm(*this, m_process->webFrame(frameID), subFrameDomain, topFrameDomain, WTFMove(completionHandler)); > } >+ >+void WebPageProxy::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(CompletionHandler<void()>&& completionHandler) >+{ >+ m_process->connection()->sendWithAsyncReply(Messages::WebPage::WasLoadedWithDataTransferFromPrevalentResource(), WTFMove(completionHandler), m_pageID); >+} > #endif > > bool WebPageProxy::useDarkAppearance() const >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 6c5ad625d1204c7c0d839699e7e2f65a5ba64e03..d6cdbdc83c82bcd8983bb028dc5b08f31f4b0507 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1447,6 +1447,7 @@ public: > > #if ENABLE(RESOURCE_LOAD_STATISTICS) > void requestStorageAccessConfirm(const WebCore::RegistrableDomain& subFrameDomain, const WebCore::RegistrableDomain& topFrameDomain, uint64_t frameID, CompletionHandler<void(bool)>&&); >+ void didCommitCrossSiteLoadWithDataTransferFromPrevalentResource(CompletionHandler<void()>&&); > #endif > > #if ENABLE(DEVICE_ORIENTATION) >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index 0e139f30d9cef9f63233c613b5e42bcdd598ee68..0231df8746e7c4b244167c6f4c7d71b4b9d6bbd7 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -2519,20 +2519,15 @@ void WebProcessPool::clearCurrentModifierStateForTesting() > 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 (!m_networkProcess) > return; > >- m_networkProcess->committedCrossSiteLoadWithLinkDecoration(sessionID, fromDomain, toDomain, pageID, [] { }); >-#else >- UNUSED_PARAM(sessionID); >- UNUSED_PARAM(fromDomain); >- UNUSED_PARAM(toDomain); >- UNUSED_PARAM(pageID); >-#endif >+ m_networkProcess->didCommitCrossSiteLoadWithDataTransfer(sessionID, fromDomain, toDomain, navigationDataTransfer, pageID, [] { }); > } >+#endif > > void WebProcessPool::setWebProcessHasUploads(ProcessIdentifier processID) > { >diff --git a/Source/WebKit/UIProcess/WebProcessPool.h b/Source/WebKit/UIProcess/WebProcessPool.h >index 165545b1a2f86eaa4b833c93abe80dc90ee52633..d0a923672bbd27da894db6add48bc0881ce3c5c1 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.h >+++ b/Source/WebKit/UIProcess/WebProcessPool.h >@@ -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 @@ public: > 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; }; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 6ed8f272f2ee887e569c1ff43fa210e8067782cc..3d2c2edeb70c75cc6fd46d8b3dc4ed129714841d 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -6492,6 +6492,18 @@ void WebPage::requestStorageAccess(RegistrableDomain&& subFrameDomain, Registrab > { > WebProcess::singleton().ensureNetworkProcessConnection().connection().sendWithAsyncReply(Messages::NetworkConnectionToWebProcess::RequestStorageAccess(sessionID(), WTFMove(subFrameDomain), WTFMove(topFrameDomain), frameID, m_pageID), WTFMove(completionHandler)); > } >+ >+void WebPage::wasLoadedWithDataTransferFromPrevalentResource(CompletionHandler<void()>&& completionHandler) >+{ >+ auto* frame = mainFrame(); >+ if (!frame || !frame->document()) { >+ completionHandler(); >+ return; >+ } >+ >+ frame->document()->wasLoadedWithDataTransferFromPrevalentResource(); >+ completionHandler(); >+} > #endif > > #if ENABLE(DEVICE_ORIENTATION) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 868ae92f2fb3293510110baee8ccb678231c33ad..c43759fff305f278fd5f00d5f42b285d9ce29568 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -1129,6 +1129,7 @@ public: > #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(CompletionHandler<void()>&&); > #endif > > #if ENABLE(DEVICE_ORIENTATION) >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 18f06f884e19774ffca1d781b68809ffee170d08..6fe09ee6a0b9f1f23ee10235904fa8e40bbe53c3 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -566,4 +566,8 @@ GenerateSyntheticEditingCommand(enum:uint8_t WebKit::SyntheticEditingCommandType > > TextInputContextsInRect(WebCore::FloatRect rect) -> (Vector<struct WebKit::TextInputContext> contexts) Async > FocusTextInputContext(struct WebKit::TextInputContext context) -> (bool success) Async >+ >+#if ENABLE(RESOURCE_LOAD_STATISTICS) >+ WasLoadedWithDataTransferFromPrevalentResource() -> () Async >+#endif > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 929ab9e164463c6d72b3c110bb987b37fd81ff3f..1c976c53eee300a5e3b85ba1b14e1433bc7cdb94 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-05-24 John Wilander <wilander@apple.com> >+ >+ 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 NOBODY (OOPS!). >+ >+ * 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-23 Antoine Quint <graouts@apple.com> > > [Pointer Events] Compatibility mouse events can only be prevented while the pointer is pressed >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt b/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0fba81035e2fecba1394d01df2e9be20695e85a5 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html b/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e90a3ed29b342fd81a274d969e9aa0a66f999481 >--- /dev/null >+++ b/LayoutTests/http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <script src="/js-test-resources/js-test.js"></script> >+ <script src="/cookies/resources/cookie-utilities.js"></script> >+ <script src="resources/util.js"></script> >+</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; >+ >+ function testReferrer() { >+ if (document.referrer === prevalentResourceOrigin + "/") >+ testPassed("The referrer is downgraded."); >+ else >+ testFailed("The referrer is not downgraded: " + document.referrer); >+ setEnableFeature(false, finishJSTest); >+ } >+ >+ function navigateSameOriginToAddQuery() { >+ document.location.href = prevalentResourceOrigin + "/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html?link=query"; >+ } >+ >+ function navigateCrossOrigin() { >+ document.location.href = destinationOrigin + "/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>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198227
:
370601
|
370605
|
370658