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

Changeset 285565 in webkit


Ignore:
Timestamp:
Nov 9, 2021, 10:52:44 PM (5 years ago)
Author:
Chris Dumez
Message:

[macOS] Enable NSURLSession partitioning based on first-party domain at CFNetwork level
https://bugs.webkit.org/show_bug.cgi?id=230750
<rdar://problem/83159358>

Reviewed by Alex Christensen.

Source/WebKit:

  • NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:

(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
(overrideAttributionContext): Deleted.
Stop disabling CFNetwork NSURLSession partitioning based on first-party domain on
macOS.

  • NetworkProcess/cocoa/NetworkSessionCocoa.h:
  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(WebKit::NetworkSessionCocoa::sessionWrapperForTask):
(WebKit::NetworkSessionCocoa::hasIsolatedSession const):
(WebKit::NetworkSessionCocoa::clearIsolatedSessions):
(WebKit::NetworkSessionCocoa::invalidateAndCancelSessionSet):
Disable ITP session partitioning of certain prevalent domains on platforms where
CFNetwork already does full partitioning of all domains (now that it is enabled
on macOS 12+ and iOS15+).

Source/WTF:

Add HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN) build time flag that is true
on newer Apple OSes where CFNetwork does NSURLSession partitioning based on first-party domain for
us.

  • wtf/PlatformHave.h:

LayoutTests:

Skip a few ITP session partitioning tests on newer OSes now that session partitioning
happens for all first-party domains at CFNetwork level on these OSes.

  • platform/ios-wk2/TestExpectations:
  • platform/mac-wk2/TestExpectations:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r285564 r285565  
     12021-11-09  Chris Dumez  <cdumez@apple.com>
     2
     3        [macOS] Enable NSURLSession partitioning based on first-party domain at CFNetwork level
     4        https://bugs.webkit.org/show_bug.cgi?id=230750
     5        <rdar://problem/83159358>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Skip a few ITP session partitioning tests on newer OSes now that session partitioning
     10        happens for all first-party domains at CFNetwork level on these OSes.
     11
     12        * platform/ios-wk2/TestExpectations:
     13        * platform/mac-wk2/TestExpectations:
     14
    1152021-11-09  Ben Nham  <nham@apple.com>
    216
  • trunk/LayoutTests/platform/ios-wk2/TestExpectations

    r285497 r285565  
    21672167editing/selection/ios/hide-selection-in-tiny-contenteditable.html [ Pass Failure ]
    21682168
     2169# On iOS15+, CFNetwork does full NSURLSession partitioning based on first-party domains and ITP session partitioning is thus disabled.
     2170http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.py [ Skip ]
     2171http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.py [ Skip ]
     2172
    21692173# These tests fail/timeout on iPhone 12 simulator
    21702174fast/events/ios/viewport-no-width-value-allows-double-tap.html [ Skip ]
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r285307 r285565  
    326326http/wpt/mediarecorder/set-srcObject-MediaStream-Blob.html [ Pass Failure Timeout ]
    327327[ BigSur+ ] http/wpt/mediarecorder/video-rotation.html [ Pass Failure Timeout ]
     328
     329# On Monterey+, CFNetwork does full NSURLSession partitioning based on first-party domains and ITP session partitioning is thus disabled.
     330[ Monterey+ ] http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.py [ Skip ]
     331[ Monterey+ ] http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.py [ Skip ]
    328332
    329333# rdar://76909385
  • trunk/Source/WTF/ChangeLog

    r285549 r285565  
     12021-11-09  Chris Dumez  <cdumez@apple.com>
     2
     3        [macOS] Enable NSURLSession partitioning based on first-party domain at CFNetwork level
     4        https://bugs.webkit.org/show_bug.cgi?id=230750
     5        <rdar://problem/83159358>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN) build time flag that is true
     10        on newer Apple OSes where CFNetwork does NSURLSession partitioning based on first-party domain for
     11        us.
     12
     13        * wtf/PlatformHave.h:
     14
    1152021-11-09  Megan Gardner  <megan_gardner@apple.com>
    216
  • trunk/Source/WTF/wtf/PlatformHave.h

    r285521 r285565  
    959959#define HAVE_CFNETWORK_NSURLSESSION_ATTRIBUTED_BUNDLE_IDENTIFIER 1
    960960#define HAVE_CFNETWORK_NSURLSESSION_HSTS_WITH_UNTRUSTED_ROOT 1
     961#define HAVE_CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN 1
    961962#define HAVE_AUDIO_OBJECT_PROPERTY_ELEMENT_MAIN 1
    962963#define HAVE_IMAGE_RESTRICTED_DECODING 1
  • trunk/Source/WebKit/ChangeLog

    r285563 r285565  
     12021-11-09  Chris Dumez  <cdumez@apple.com>
     2
     3        [macOS] Enable NSURLSession partitioning based on first-party domain at CFNetwork level
     4        https://bugs.webkit.org/show_bug.cgi?id=230750
     5        <rdar://problem/83159358>
     6
     7        Reviewed by Alex Christensen.
     8
     9        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
     10        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
     11        (overrideAttributionContext): Deleted.
     12        Stop disabling CFNetwork NSURLSession partitioning based on first-party domain on
     13        macOS.
     14
     15        * NetworkProcess/cocoa/NetworkSessionCocoa.h:
     16        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     17        (WebKit::NetworkSessionCocoa::sessionWrapperForTask):
     18        (WebKit::NetworkSessionCocoa::hasIsolatedSession const):
     19        (WebKit::NetworkSessionCocoa::clearIsolatedSessions):
     20        (WebKit::NetworkSessionCocoa::invalidateAndCancelSessionSet):
     21        Disable ITP session partitioning of certain prevalent domains on platforms where
     22        CFNetwork already does full partitioning of all domains (now that it is enabled
     23        on macOS 12+ and iOS15+).
     24
    1252021-11-09  Per Arne Vollan <pvollan@apple.com>
    226
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm

    r284819 r285565  
    5858#import <WebKitAdditions/NetworkDataTaskCocoaAdditions.h>
    5959#else
    60 static void overrideAttributionContext(NSMutableURLRequest *) { }
    6160static void processPCMRequest(WebCore::PrivateClickMeasurement::PcmDataCarried, NSMutableURLRequest *) { }
    6261#endif
     
    344343    mutableRequest.get().attribution = request.isAppInitiated() ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser;
    345344#endif
    346 
    347     overrideAttributionContext(mutableRequest.get());
    348345
    349346    nsRequest = mutableRequest;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r285404 r285565  
    8080    }
    8181
    82     SessionWrapper& isolatedSession(WebCore::StoredCredentialsPolicy, const WebCore::RegistrableDomain&, NavigatingToAppBoundDomain, NetworkSessionCocoa&);
    8382    SessionWrapper& initializeEphemeralStatelessSessionIfNeeded(NavigatingToAppBoundDomain, NetworkSessionCocoa&);
    8483
     84#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
     85    SessionWrapper& isolatedSession(WebCore::StoredCredentialsPolicy, const WebCore::RegistrableDomain&, NavigatingToAppBoundDomain, NetworkSessionCocoa&);
    8586    HashMap<WebCore::RegistrableDomain, std::unique_ptr<IsolatedSession>> isolatedSessions;
     87#endif
     88
    8689    std::unique_ptr<IsolatedSession> appBoundSession;
    8790
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r285404 r285565  
    14201420    if (isParentProcessAFullWebBrowser(networkProcess()))
    14211421        shouldBeConsideredAppBound = NavigatingToAppBoundDomain::No;
    1422 #if ENABLE(INTELLIGENT_TRACKING_PREVENTION)
     1422    // This ITP partitioning is unnecessary on newer platforms since CFNetwork already has full partioning based on first-party domains.
     1423#if ENABLE(INTELLIGENT_TRACKING_PREVENTION) && !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
    14231424    if (auto* storageSession = networkStorageSession()) {
    14241425        auto firstParty = WebCore::RegistrableDomain(request.firstPartyForCookies());
     
    14271428    } else
    14281429        ASSERT_NOT_REACHED();
     1430#else
     1431    UNUSED_PARAM(request);
    14291432#endif
    14301433
     
    14911494#endif
    14921495
     1496#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
    14931497SessionWrapper& NetworkSessionCocoa::isolatedSession(WebPageProxyIdentifier webPageProxyID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, const WebCore::RegistrableDomain& firstPartyDomain, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain)
    14941498{
    14951499    return sessionSetForPage(webPageProxyID).isolatedSession(storedCredentialsPolicy, firstPartyDomain, isNavigatingToAppBoundDomain, *this);
    14961500}
    1497 
     1501#endif
     1502
     1503#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
    14981504SessionWrapper& SessionSet::isolatedSession(WebCore::StoredCredentialsPolicy storedCredentialsPolicy, const WebCore::RegistrableDomain& firstPartyDomain, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain, NetworkSessionCocoa& session)
    14991505{
     
    15381544    return sessionWrapper;
    15391545}
     1546#endif
     1547
    15401548
    15411549bool NetworkSessionCocoa::hasIsolatedSession(const WebCore::RegistrableDomain& domain) const
    15421550{
     1551#if HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
     1552    UNUSED_PARAM(domain);
     1553    return true;
     1554#else
    15431555    if (m_defaultSessionSet->isolatedSessions.contains(domain))
    15441556        return true;
     
    15491561   
    15501562    return false;
     1563#endif
    15511564}
    15521565
    15531566void NetworkSessionCocoa::clearIsolatedSessions()
    15541567{
     1568#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
    15551569    m_defaultSessionSet->isolatedSessions.clear();
    15561570    for (auto& sessionSet : m_perPageSessionSets.values())
    15571571        sessionSet->isolatedSessions.clear();
     1572#endif
    15581573}
    15591574
     
    15671582    [sessionSet.ephemeralStatelessSession.delegate sessionInvalidated];
    15681583
     1584#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
    15691585    for (auto& session : sessionSet.isolatedSessions.values()) {
    15701586        [session->sessionWithCredentialStorage.session invalidateAndCancel];
     
    15741590    }
    15751591    sessionSet.isolatedSessions.clear();
     1592#endif
    15761593
    15771594    if (sessionSet.appBoundSession) {
Note: See TracChangeset for help on using the changeset viewer.