haikuwebkit/Source/WebCore/page/CrossSiteNavigationDataTran...

54 lines
2.0 KiB
C
Raw Permalink Normal View History

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. Canonical link: https://commits.webkit.org/212304@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-26 22:39:09 +00:00
/*
[IPC hardening] OptionSet<> values should be validated <https://webkit.org/b/213199> <rdar://problem/64369963> Reviewed by Anders Carlsson. Source/WebCore: Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * loader/CrossOriginAccessControl.h: * page/ActivityState.h: * page/AutoplayEvent.h: * page/CrossSiteNavigationDataTransfer.h: * page/LayoutMilestone.h: * page/TextIndicator.h: * platform/PlatformEvent.h: * platform/graphics/GraphicsContext.h: Source/WebKit: Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSession.h: * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<OptionSet<T>>::encode): (IPC::ArgumentCoder<OptionSet<T>>::decode): - Add WTF::isValidOptionSet() checks. * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.h: - Replace <wtf/EnumTraits.h> with <wtf/OptionSet.h> since the latter now includes the former. * Platform/IPC/MessageFlags.h: * Shared/DocumentEditingContext.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/WebEvent.h: * Shared/WebsiteAutoplayQuirk.h: * Shared/WebsiteData/WebsiteData.h: * Shared/WebsiteData/WebsiteDataFetchOption.h: * Shared/WebsiteData/WebsiteDataType.h: * Shared/ios/GestureTypes.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessManager.h: * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebProcess.h: Source/WTF: * wtf/OptionSet.h: (WTF::isValidOptionSet): Add. Canonical link: https://commits.webkit.org/226130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-18 15:53:25 +00:00
* Copyright (C) 2019-2020 Apple Inc. All rights reserved.
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. Canonical link: https://commits.webkit.org/212304@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-26 22:39:09 +00:00
*
* 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
[IPC hardening] OptionSet<> values should be validated <https://webkit.org/b/213199> <rdar://problem/64369963> Reviewed by Anders Carlsson. Source/WebCore: Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * loader/CrossOriginAccessControl.h: * page/ActivityState.h: * page/AutoplayEvent.h: * page/CrossSiteNavigationDataTransfer.h: * page/LayoutMilestone.h: * page/TextIndicator.h: * platform/PlatformEvent.h: * platform/graphics/GraphicsContext.h: Source/WebKit: Summary: - Add WTF::EnumTraits<> for all OptionSet<> enums. - Specify unsigned backing types for enum classes. * NetworkProcess/NetworkProcess.h: * NetworkProcess/NetworkSession.h: * Platform/IPC/ArgumentCoders.h: (IPC::ArgumentCoder<OptionSet<T>>::encode): (IPC::ArgumentCoder<OptionSet<T>>::decode): - Add WTF::isValidOptionSet() checks. * Platform/IPC/Decoder.h: * Platform/IPC/Encoder.h: - Replace <wtf/EnumTraits.h> with <wtf/OptionSet.h> since the latter now includes the former. * Platform/IPC/MessageFlags.h: * Shared/DocumentEditingContext.h: * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: * Shared/WebEvent.h: * Shared/WebsiteAutoplayQuirk.h: * Shared/WebsiteData/WebsiteData.h: * Shared/WebsiteData/WebsiteDataFetchOption.h: * Shared/WebsiteData/WebsiteDataType.h: * Shared/ios/GestureTypes.h: * UIProcess/Network/NetworkProcessProxy.h: * UIProcess/Plugins/PluginProcessManager.h: * UIProcess/WebProcessProxy.h: * UIProcess/WebsiteData/WebsiteDataStore.h: * WebProcess/WebProcess.h: Source/WTF: * wtf/OptionSet.h: (WTF::isValidOptionSet): Add. Canonical link: https://commits.webkit.org/226130@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263208 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-18 15:53:25 +00:00
namespace WTF {
template<> struct EnumTraits<WebCore::CrossSiteNavigationDataTransfer::Flag> {
using values = EnumValues<
WebCore::CrossSiteNavigationDataTransfer::Flag,
WebCore::CrossSiteNavigationDataTransfer::Flag::DestinationLinkDecoration,
WebCore::CrossSiteNavigationDataTransfer::Flag::ReferrerLinkDecoration
>;
};
} // namespace WTF
#endif // ENABLE(RESOURCE_LOAD_STATISTICS)