⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242288 in webkit


Ignore:
Timestamp:
Mar 1, 2019, 2:11:33 PM (7 years ago)
Author:
wilander@apple.com
Message:

Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
https://bugs.webkit.org/show_bug.cgi?id=195196
<rdar://problem/48006419>

Reviewed by Brent Fulgham.

Source/WebCore:

Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html

http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html

Trackers abuse link query parameters to transport user identifiers cross-site.
This patch detects such navigations and applies further restrictions to
client-site cookies on the destination page.

  • platform/network/NetworkStorageSession.cpp:

(WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):

Now sets the regular 7-day cap and a reduced 1-day cap.

(WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):

Renamed NetworkStorageSession::removeStorageAccessForAllFramesOnPage() to
NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics since
it now clears out two types of page-specific data.

(WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):

This function receives a cross-site navigation and checks if the originating
site is a prevalent resource. If so, it marks the page or stricter cookie
rules.

(WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):

Test infrastructure. This sets a state that overrides the regular per-page
clear of data. The reason is that the double clear was racy and caused test
failures.

(WebCore::NetworkStorageSession::clientSideCookieCap const):

New function that returns the current cookie lifetime cap.

(WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.

Renamed to NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics().

  • platform/network/NetworkStorageSession.h:
  • platform/network/cocoa/NetworkStorageSessionCocoa.mm:

(WebCore::NetworkStorageSession::setCookiesFromDOM const):

Now calls NetworkStorageSession::clientSideCookieCap() to set the cap.

Source/WebKit:

Trackers abuse link query parameters to transport user identifiers cross-site.
This patch detects such navigations and applies further restrictions to
client-site cookies on the destination page.

  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
(WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): Deleted.

Renamed NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics().

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/NetworkConnectionToWebProcess.messages.in:
  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):

Reporting IPC message when a link decorated cross-site navigation happens.

(WebKit::NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting):

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcess.messages.in:
  • UIProcess/API/C/WKWebsiteDataStoreRef.cpp:

(WKWebsiteDataStoreStatisticsResetToConsistentState):

Added clearing of the new state between test runs.

  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting):

Test infrastructure.

  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::isNonUniqueNavigationWithLinkDecoration):

Convenience function.

(WebKit::WebPageProxy::didCommitLoadForFrame):

This function now reports to the network process when a link decorated
cross-site navigation happens.

  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):

Test infrastructure.

  • UIProcess/WebsiteData/WebsiteDataStore.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::close):

Name change of function called.

LayoutTests:

  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html: Added.
  • http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html:

Now clears cookies after the test.

Location:
trunk
Files:
10 added
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242284 r242288  
     12019-03-01  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
     4        https://bugs.webkit.org/show_bug.cgi?id=195196
     5        <rdar://problem/48006419>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site-expected.txt: Added.
     10        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html: Added.
     11        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource-expected.txt: Added.
     12        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html: Added.
     13        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource-expected.txt: Added.
     14        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html: Added.
     15        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource-expected.txt: Added.
     16        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html: Added.
     17        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource-expected.txt: Added.
     18        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html: Added.
     19        * http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html:
     20            Now clears cookies after the test.
     21
    1222019-03-01  Rob Buis  <rbuis@igalia.com>
    223
  • trunk/LayoutTests/http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js.html

    r237304 r242288  
    6363            }
    6464        }
     65
     66        resetCookiesForCurrentOrigin();
     67
    6568        if (passedTests === 4) {
    6669            testPassed("The two short-lived cookies don't expire after more than " + overTwoDaysInSeconds + " seconds.");
  • trunk/Source/WebCore/ChangeLog

    r242284 r242288  
     12019-03-01  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
     4        https://bugs.webkit.org/show_bug.cgi?id=195196
     5        <rdar://problem/48006419>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Tests: http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-decoration-same-site.html
     10               http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-fragment-from-prevalent-resource.html
     11               http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-and-fragment-from-prevalent-resource.html
     12               http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-with-link-query-from-prevalent-resource.html
     13               http/tests/resourceLoadStatistics/capped-lifetime-for-cookie-set-in-js-without-link-decoration-from-prevalent-resource.html
     14
     15        Trackers abuse link query parameters to transport user identifiers cross-site.
     16        This patch detects such navigations and applies further restrictions to
     17        client-site cookies on the destination page.
     18
     19        * platform/network/NetworkStorageSession.cpp:
     20        (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
     21            Now sets the regular 7-day cap and a reduced 1-day cap.
     22        (WebCore::NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics):
     23            Renamed NetworkStorageSession::removeStorageAccessForAllFramesOnPage() to
     24            NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics since
     25            it now clears out two types of page-specific data.
     26        (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration):
     27            This function receives a cross-site navigation and checks if the originating
     28            site is a prevalent resource. If so, it marks the page or stricter cookie
     29            rules.
     30        (WebCore::NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting):
     31            Test infrastructure. This sets a state that overrides the regular per-page
     32            clear of data. The reason is that the double clear was racy and caused test
     33            failures.
     34        (WebCore::NetworkStorageSession::clientSideCookieCap const):
     35            New function that returns the current cookie lifetime cap.
     36        (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
     37            Renamed to NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics().
     38        * platform/network/NetworkStorageSession.h:
     39        * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
     40        (WebCore::NetworkStorageSession::setCookiesFromDOM const):
     41            Now calls NetworkStorageSession::clientSideCookieCap() to set the cap.
     42
    1432019-03-01  Rob Buis  <rbuis@igalia.com>
    244
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp

    r242056 r242288  
    101101{
    102102    m_ageCapForClientSideCookies = seconds;
     103    m_ageCapForClientSideCookiesShort = seconds ? Seconds { seconds->seconds() / 7. } : seconds;
    103104}
    104105
     
    191192}
    192193
    193 void NetworkStorageSession::removeStorageAccessForAllFramesOnPage(uint64_t pageID)
     194void NetworkStorageSession::clearPageSpecificDataForResourceLoadStatistics(uint64_t pageID)
    194195{
    195196    m_pagesGrantedStorageAccess.remove(pageID);
    196197    m_framesGrantedStorageAccess.remove(pageID);
     198    if (!m_navigationWithLinkDecorationTestMode)
     199        m_navigatedToWithLinkDecorationByPrevalentResource.remove(pageID);
    197200}
    198201
     
    212215    m_cacheMaxAgeCapForPrevalentResources = WTF::nullopt;
    213216}
     217
     218void NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration(const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID)
     219{
     220    if (shouldBlockThirdPartyCookies(fromDomain))
     221        m_navigatedToWithLinkDecorationByPrevalentResource.add(pageID, toDomain);
     222}
     223
     224void NetworkStorageSession::resetCrossSiteLoadsWithLinkDecorationForTesting()
     225{
     226    m_navigatedToWithLinkDecorationByPrevalentResource.clear();
     227    m_navigationWithLinkDecorationTestMode = true;
     228}
     229
     230Optional<Seconds> NetworkStorageSession::clientSideCookieCap(const RegistrableDomain& firstParty, Optional<uint64_t> pageID) const
     231{
     232    if (!m_ageCapForClientSideCookies || !pageID || m_navigatedToWithLinkDecorationByPrevalentResource.isEmpty())
     233        return m_ageCapForClientSideCookies;
     234
     235    auto domainIterator = m_navigatedToWithLinkDecorationByPrevalentResource.find(*pageID);
     236    if (domainIterator == m_navigatedToWithLinkDecorationByPrevalentResource.end())
     237        return m_ageCapForClientSideCookies;
     238
     239    if (domainIterator->value == firstParty)
     240        return m_ageCapForClientSideCookiesShort;
     241
     242    return m_ageCapForClientSideCookies;
     243}
    214244#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
    215245
  • trunk/Source/WebCore/platform/network/NetworkStorageSession.h

    r242056 r242288  
    150150    WEBCORE_EXPORT void grantStorageAccess(const RegistrableDomain& resourceDomain, const RegistrableDomain& firstPartyDomain, Optional<uint64_t> frameID, uint64_t pageID);
    151151    WEBCORE_EXPORT void removeStorageAccessForFrame(uint64_t frameID, uint64_t pageID);
    152     WEBCORE_EXPORT void removeStorageAccessForAllFramesOnPage(uint64_t pageID);
     152    WEBCORE_EXPORT void clearPageSpecificDataForResourceLoadStatistics(uint64_t pageID);
    153153    WEBCORE_EXPORT void removeAllStorageAccess();
    154154    WEBCORE_EXPORT void setCacheMaxAgeCapForPrevalentResources(Seconds);
    155155    WEBCORE_EXPORT void resetCacheMaxAgeCapForPrevalentResources();
    156156    WEBCORE_EXPORT Optional<Seconds> maxAgeCacheCap(const ResourceRequest&);
     157    WEBCORE_EXPORT void committedCrossSiteLoadWithLinkDecoration(const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID);
     158    WEBCORE_EXPORT void resetCrossSiteLoadsWithLinkDecorationForTesting();
    157159#endif
    158160
     
    179181#if ENABLE(RESOURCE_LOAD_STATISTICS)
    180182    bool shouldBlockThirdPartyCookies(const RegistrableDomain&) const;
     183    Optional<Seconds> clientSideCookieCap(const RegistrableDomain& firstParty, Optional<uint64_t> pageID) const;
    181184    HashSet<RegistrableDomain> m_registrableDomainsToBlockCookieFor;
    182185    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;
     
    184187    Optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { };
    185188    Optional<Seconds> m_ageCapForClientSideCookies { };
     189    Optional<Seconds> m_ageCapForClientSideCookiesShort { };
     190    HashMap<uint64_t, RegistrableDomain, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_navigatedToWithLinkDecorationByPrevalentResource;
     191    bool m_navigationWithLinkDecorationTestMode = false;
    186192#endif
    187193
  • trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm

    r240243 r242288  
    404404
    405405#if ENABLE(RESOURCE_LOAD_STATISTICS)
    406     RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, m_ageCapForClientSideCookies);
     406    RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, clientSideCookieCap(RegistrableDomain { firstParty }, pageID));
    407407#else
    408408    RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, WTF::nullopt);
  • trunk/Source/WebKit/ChangeLog

    r242287 r242288  
     12019-03-01  John Wilander  <wilander@apple.com>
     2
     3        Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
     4        https://bugs.webkit.org/show_bug.cgi?id=195196
     5        <rdar://problem/48006419>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Trackers abuse link query parameters to transport user identifiers cross-site.
     10        This patch detects such navigations and applies further restrictions to
     11        client-site cookies on the destination page.
     12
     13        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     14        (WebKit::NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics):
     15        (WebKit::NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage): Deleted.
     16            Renamed NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics().
     17        * NetworkProcess/NetworkConnectionToWebProcess.h:
     18        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
     19        * NetworkProcess/NetworkProcess.cpp:
     20        (WebKit::NetworkProcess::committedCrossSiteLoadWithLinkDecoration):
     21            Reporting IPC message when a link decorated cross-site navigation happens.
     22        (WebKit::NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting):
     23        * NetworkProcess/NetworkProcess.h:
     24        * NetworkProcess/NetworkProcess.messages.in:
     25        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
     26        (WKWebsiteDataStoreStatisticsResetToConsistentState):
     27            Added clearing of the new state between test runs.
     28        * UIProcess/Network/NetworkProcessProxy.cpp:
     29        (WebKit::NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting):
     30            Test infrastructure.
     31        * UIProcess/Network/NetworkProcessProxy.h:
     32        * UIProcess/WebPageProxy.cpp:
     33        (WebKit::isNonUniqueNavigationWithLinkDecoration):
     34            Convenience function.
     35        (WebKit::WebPageProxy::didCommitLoadForFrame):
     36            This function now reports to the network process when a link decorated
     37            cross-site navigation happens.
     38        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     39        (WebKit::WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting):
     40            Test infrastructure.
     41        * UIProcess/WebsiteData/WebsiteDataStore.h:
     42        * WebProcess/WebPage/WebPage.cpp:
     43        (WebKit::WebPage::close):
     44            Name change of function called.
     45
    1462019-03-01  Tim Horton  <timothy_horton@apple.com>
    247
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r242155 r242288  
    580580}
    581581
    582 void NetworkConnectionToWebProcess::removeStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID)
     582void NetworkConnectionToWebProcess::clearPageSpecificDataForResourceLoadStatistics(PAL::SessionID sessionID, uint64_t pageID)
    583583{
    584584    if (auto* storageSession = networkProcess().storageSession(sessionID))
    585         storageSession->removeStorageAccessForAllFramesOnPage(pageID);
     585        storageSession->clearPageSpecificDataForResourceLoadStatistics(pageID);
    586586}
    587587
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h

    r242056 r242288  
    201201#if ENABLE(RESOURCE_LOAD_STATISTICS)
    202202    void removeStorageAccessForFrame(PAL::SessionID, uint64_t frameID, uint64_t pageID);
    203     void removeStorageAccessForAllFramesOnPage(PAL::SessionID, uint64_t pageID);
     203    void clearPageSpecificDataForResourceLoadStatistics(PAL::SessionID, uint64_t pageID);
    204204
    205205    void logUserInteraction(PAL::SessionID, const RegistrableDomain&);
  • trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.messages.in

    r242056 r242288  
    5858#if ENABLE(RESOURCE_LOAD_STATISTICS)
    5959    RemoveStorageAccessForFrame(PAL::SessionID sessionID, uint64_t frameID, uint64_t pageID);
    60     RemoveStorageAccessForAllFramesOnPage(PAL::SessionID sessionID, uint64_t pageID);
     60    ClearPageSpecificDataForResourceLoadStatistics(PAL::SessionID sessionID, uint64_t pageID);
    6161    LogUserInteraction(PAL::SessionID sessionID, WebCore::RegistrableDomain domain)
    6262    LogWebSocketLoading(PAL::SessionID sessionID, WebCore::RegistrableDomain targetDomain, WebCore::RegistrableDomain topFrameDomain, WallTime lastSeen)
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r242230 r242288  
    11801180    completionHandler();
    11811181}
     1182
     1183void NetworkProcess::committedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID)
     1184{
     1185    if (auto* networkStorageSession = storageSession(sessionID))
     1186        networkStorageSession->committedCrossSiteLoadWithLinkDecoration(fromDomain, toDomain, pageID);
     1187    else
     1188        ASSERT_NOT_REACHED();
     1189}
     1190
     1191void NetworkProcess::resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
     1192{
     1193    if (auto* networkStorageSession = storageSession(sessionID))
     1194        networkStorageSession->resetCrossSiteLoadsWithLinkDecorationForTesting();
     1195    else
     1196        ASSERT_NOT_REACHED();
     1197    completionHandler();
     1198}
    11821199#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
    11831200
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r242230 r242288  
    253253    void setTopFrameUniqueRedirectFrom(PAL::SessionID, const TopFrameDomain&, const RedirectedFromDomain&, CompletionHandler<void()>&&);
    254254    void registrableDomainsWithWebsiteData(PAL::SessionID, OptionSet<WebsiteDataType>, bool shouldNotifyPage, CompletionHandler<void(HashSet<RegistrableDomain>&&)>&&);
     255    void committedCrossSiteLoadWithLinkDecoration(PAL::SessionID, const RegistrableDomain& fromDomain, const RegistrableDomain& toDomain, uint64_t pageID);
     256    void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
    255257#endif
    256258
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r242155 r242288  
    133133    SetTopFrameUniqueRedirectFrom(PAL::SessionID sessionID, WebCore::RegistrableDomain topFrameDomain, WebCore::RegistrableDomain redirectedFromDomain) -> () Async
    134134    ResetCacheMaxAgeCapForPrevalentResources(PAL::SessionID sessionID) -> () Async
     135    CommittedCrossSiteLoadWithLinkDecoration(PAL::SessionID sessionID, WebCore::RegistrableDomain fromDomain, WebCore::RegistrableDomain toDomain, uint64_t pageID)
     136    ResetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID) -> () Async
    135137#endif
    136138
  • trunk/Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp

    r242155 r242288  
    430430    store.clearResourceLoadStatisticsInWebProcesses([callbackAggregator = callbackAggregator.copyRef()] { });
    431431    store.resetCacheMaxAgeCapForPrevalentResources([callbackAggregator = callbackAggregator.copyRef()] { });
     432    store.resetCrossSiteLoadsWithLinkDecorationForTesting([callbackAggregator = callbackAggregator.copyRef()] { });
    432433    store.resetParametersToDefaultValues([callbackAggregator = callbackAggregator.copyRef()] { });
    433434    store.scheduleClearInMemoryAndPersistent(ShouldGrandfatherStatistics::No, [callbackAggregator = callbackAggregator.copyRef()] { });
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r242155 r242288  
    932932    WebProcessProxy::notifyPageStatisticsTelemetryFinished(API::Dictionary::create(messageBody).ptr());
    933933}
     934
     935void NetworkProcessProxy::resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
     936{
     937    if (!canSendMessage()) {
     938        completionHandler();
     939        return;
     940    }
     941   
     942    sendWithAsyncReply(Messages::NetworkProcess::ResetCrossSiteLoadsWithLinkDecorationForTesting(sessionID), WTFMove(completionHandler));
     943}
    934944#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
    935945
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r242155 r242288  
    145145    void setShouldClassifyResourcesBeforeDataRecordsRemoval(PAL::SessionID, bool, CompletionHandler<void()>&&);
    146146    void resetCacheMaxAgeCapForPrevalentResources(PAL::SessionID, CompletionHandler<void()>&&);
     147    void resetCrossSiteLoadsWithLinkDecorationForTesting(PAL::SessionID, CompletionHandler<void()>&&);
    147148#endif
    148149
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r242277 r242288  
    40494049}
    40504050
     4051#if ENABLE(RESOURCE_LOAD_STATISTICS)
     4052static bool isNonUniqueNavigationWithLinkDecoration(const SecurityOriginData requesterOrigin, const URL& currentURL)
     4053{
     4054    return !requesterOrigin.securityOrigin()->isUnique() && (!currentURL.query().isEmpty() || !currentURL.fragmentIdentifier().isEmpty());
     4055}
     4056#endif
     4057
    40514058void WebPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, const UserData& userData)
    40524059{
     
    40624069    // FIXME: We should message check that navigationID is not zero here, but it's currently zero for some navigations through the page cache.
    40634070    RefPtr<API::Navigation> navigation;
    4064     if (frame->isMainFrame() && navigationID)
     4071    if (frame->isMainFrame() && navigationID) {
    40654072        navigation = navigationState().navigation(navigationID);
     4073#if ENABLE(RESOURCE_LOAD_STATISTICS)
     4074        auto requesterOrigin = navigation->lastNavigationAction().requesterOrigin;
     4075        auto currentURL = navigation->currentRequest().url();
     4076        if (isNonUniqueNavigationWithLinkDecoration(requesterOrigin, currentURL)) {
     4077            RegistrableDomain currentDomain { currentURL };
     4078            URL requesterURL { URL(), requesterOrigin.toString() };
     4079            if (!currentDomain.matches(requesterURL))
     4080                m_process->processPool().sendToNetworkingProcess(Messages::NetworkProcess::CommittedCrossSiteLoadWithLinkDecoration(m_websiteDataStore->sessionID(), RegistrableDomain { requesterURL }, currentDomain, m_pageID));
     4081        }
     4082#endif
     4083    }
    40664084
    40674085    m_hasCommittedAnyProvisionalLoads = true;
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r242182 r242288  
    17541754    }
    17551755}
     1756
     1757void WebsiteDataStore::resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&& completionHandler)
     1758{
     1759    auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
     1760   
     1761    for (auto& processPool : processPools()) {
     1762        if (auto* networkProcess = processPool->networkProcess())
     1763            networkProcess->resetCrossSiteLoadsWithLinkDecorationForTesting(m_sessionID, [callbackAggregator = callbackAggregator.copyRef()] { });
     1764    }
     1765}
    17561766#endif // ENABLE(RESOURCE_LOAD_STATISTICS)
    17571767
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r242155 r242288  
    168168    void grantStorageAccess(String&& subFrameHost, String&& topFrameHost, uint64_t frameID, uint64_t pageID, bool userWasPrompted, CompletionHandler<void(bool)>&&);
    169169    void setSubframeUnderTopFrameDomain(const URL& subframe, const URL& topFrame);
     170    void resetCrossSiteLoadsWithLinkDecorationForTesting(CompletionHandler<void()>&&);
    170171#endif
    171172    void setCacheMaxAgeCapForPrevalentResources(Seconds, CompletionHandler<void()>&&);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242205 r242288  
    12371237
    12381238#if ENABLE(RESOURCE_LOAD_STATISTICS)
    1239     WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::RemoveStorageAccessForAllFramesOnPage(sessionID(), m_pageID), 0);
     1239    WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::ClearPageSpecificDataForResourceLoadStatistics(sessionID(), m_pageID), 0);
    12401240#endif
    12411241
Note: See TracChangeset for help on using the changeset viewer.