Title: [285693] branches/safari-612.3.6.1-branch
Revision
285693
Author
[email protected]
Date
2021-11-11 17:10:03 -0800 (Thu, 11 Nov 2021)

Log Message

Cherry-pick r285565. rdar://problem/83159358

    [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:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285565 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-612.3.6.1-branch/LayoutTests/ChangeLog (285692 => 285693)


--- branches/safari-612.3.6.1-branch/LayoutTests/ChangeLog	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/LayoutTests/ChangeLog	2021-11-12 01:10:03 UTC (rev 285693)
@@ -1,5 +1,65 @@
 2021-11-11  Alan Coon  <[email protected]>
 
+        Cherry-pick r285565. rdar://problem/83159358
+
+    [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:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-09  Chris Dumez  <[email protected]>
+
+            [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.
+
+            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:
+
+2021-11-11  Alan Coon  <[email protected]>
+
         Cherry-pick r284434. rdar://problem/77969801
 
     WebM with invalid size should fail to load with error

Modified: branches/safari-612.3.6.1-branch/LayoutTests/platform/ios-wk2/TestExpectations (285692 => 285693)


--- branches/safari-612.3.6.1-branch/LayoutTests/platform/ios-wk2/TestExpectations	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/LayoutTests/platform/ios-wk2/TestExpectations	2021-11-12 01:10:03 UTC (rev 285693)
@@ -1999,3 +1999,7 @@
 editing/selection/ios/do-not-hide-selection-in-visible-container.html [ Failure ]
 editing/selection/ios/do-not-hide-selection-in-visible-field.html [ Failure ]
 editing/selection/ios/scrolling-to-focused-element-inside-iframe.html [ Failure ]
+
+# On iOS15+, CFNetwork does full NSURLSession partitioning based on first-party domains and ITP session partitioning is thus disabled.
+http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.py [ Skip ]
+http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.py [ Skip ]

Modified: branches/safari-612.3.6.1-branch/LayoutTests/platform/mac-wk2/TestExpectations (285692 => 285693)


--- branches/safari-612.3.6.1-branch/LayoutTests/platform/mac-wk2/TestExpectations	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/LayoutTests/platform/mac-wk2/TestExpectations	2021-11-12 01:10:03 UTC (rev 285693)
@@ -309,6 +309,10 @@
 http/wpt/mediarecorder/set-srcObject-MediaStream-Blob.html [ Pass Failure Timeout ]
 [ Monterey+ ] http/wpt/mediarecorder/video-rotation.html [ Pass Failure Timeout ]
 
+# On Monterey+, CFNetwork does full NSURLSession partitioning based on first-party domains and ITP session partitioning is thus disabled.
+[ Monterey+ ] http/tests/resourceLoadStatistics/do-not-switch-session-on-navigation-to-prevalent-without-interaction.py [ Skip ]
+[ Monterey+ ] http/tests/resourceLoadStatistics/switch-session-on-navigation-to-prevalent-with-interaction.py [ Skip ]
+
 # rdar://76909385
 [ Monterey+ ] http/tests/websocket/tests/hybi/interleaved-fragments.html [ Pass Failure Timeout ]
 [ Monterey+ ] http/tests/websocket/tests/hybi/send-object-tostring-check.html [ Pass Failure Timeout ]

Modified: branches/safari-612.3.6.1-branch/Source/WTF/ChangeLog (285692 => 285693)


--- branches/safari-612.3.6.1-branch/Source/WTF/ChangeLog	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/Source/WTF/ChangeLog	2021-11-12 01:10:03 UTC (rev 285693)
@@ -1,3 +1,63 @@
+2021-11-11  Alan Coon  <[email protected]>
+
+        Cherry-pick r285565. rdar://problem/83159358
+
+    [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:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-09  Chris Dumez  <[email protected]>
+
+            [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.
+
+            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:
+
 2021-11-08  Kocsen Chung  <[email protected]>
 
         Cherry-pick r285036. rdar://problem/85173478

Modified: branches/safari-612.3.6.1-branch/Source/WTF/wtf/PlatformHave.h (285692 => 285693)


--- branches/safari-612.3.6.1-branch/Source/WTF/wtf/PlatformHave.h	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/Source/WTF/wtf/PlatformHave.h	2021-11-12 01:10:03 UTC (rev 285693)
@@ -1027,6 +1027,7 @@
     || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 80000) \
     || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 150000)
 #define HAVE_CFNETWORK_NSURLSESSION_ATTRIBUTED_BUNDLE_IDENTIFIER 1
+#define HAVE_CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN 1
 #define HAVE_AUDIO_OBJECT_PROPERTY_ELEMENT_MAIN 1
 #define HAVE_IMAGE_RESTRICTED_DECODING 1
 #endif

Modified: branches/safari-612.3.6.1-branch/Source/WebKit/ChangeLog (285692 => 285693)


--- branches/safari-612.3.6.1-branch/Source/WebKit/ChangeLog	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/Source/WebKit/ChangeLog	2021-11-12 01:10:03 UTC (rev 285693)
@@ -1,5 +1,75 @@
 2021-11-11  Alan Coon  <[email protected]>
 
+        Cherry-pick r285565. rdar://problem/83159358
+
+    [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:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-11-09  Chris Dumez  <[email protected]>
+
+            [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.
+
+            * 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+).
+
+2021-11-11  Alan Coon  <[email protected]>
+
         Cherry-pick r285550. rdar://problem/85075538
 
     REGRESSION (Safari 15): AudioContext.currentTime speeds up (and audio won't play) when Bluetooth speaker connected

Modified: branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (285692 => 285693)


--- branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2021-11-12 01:10:03 UTC (rev 285693)
@@ -345,8 +345,6 @@
     mutableRequest.get().attribution = request.isAppInitiated() ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser;
 #endif
 
-    overrideAttributionContext(mutableRequest.get());
-
     if (parameters.pcmDataCarried)
         processPCMRequest(*parameters.pcmDataCarried, mutableRequest.get());
 

Modified: branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (285692 => 285693)


--- branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2021-11-12 01:10:03 UTC (rev 285693)
@@ -79,10 +79,13 @@
         return adoptRef(*new SessionSet);
     }
 
-    SessionWrapper& isolatedSession(WebCore::StoredCredentialsPolicy, const WebCore::RegistrableDomain, NavigatingToAppBoundDomain, NetworkSessionCocoa&);
     SessionWrapper& initializeEphemeralStatelessSessionIfNeeded(NavigatingToAppBoundDomain, NetworkSessionCocoa&);
 
+#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
+    SessionWrapper& isolatedSession(WebCore::StoredCredentialsPolicy, const WebCore::RegistrableDomain&, NavigatingToAppBoundDomain, NetworkSessionCocoa&);
     HashMap<WebCore::RegistrableDomain, std::unique_ptr<IsolatedSession>> isolatedSessions;
+#endif
+
     std::unique_ptr<IsolatedSession> appBoundSession;
 
     SessionWrapper sessionWithCredentialStorage;

Modified: branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (285692 => 285693)


--- branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-11-12 01:09:59 UTC (rev 285692)
+++ branches/safari-612.3.6.1-branch/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-11-12 01:10:03 UTC (rev 285693)
@@ -1438,7 +1438,8 @@
     auto shouldBeConsideredAppBound = isNavigatingToAppBoundDomain ? *isNavigatingToAppBoundDomain : NavigatingToAppBoundDomain::Yes;
     if (isParentProcessAFullWebBrowser(networkProcess()))
         shouldBeConsideredAppBound = NavigatingToAppBoundDomain::No;
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
+    // This ITP partitioning is unnecessary on newer platforms since CFNetwork already has full partioning based on first-party domains.
+#if ENABLE(RESOURCE_LOAD_STATISTICS) && !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
     if (auto* storageSession = networkStorageSession()) {
         auto firstParty = WebCore::RegistrableDomain(request.firstPartyForCookies());
         if (storageSession->shouldBlockThirdPartyCookiesButKeepFirstPartyCookiesFor(firstParty))
@@ -1445,6 +1446,8 @@
             return sessionSetForPage(webPageProxyID).isolatedSession(storedCredentialsPolicy, firstParty, shouldBeConsideredAppBound, *this);
     } else
         ASSERT_NOT_REACHED();
+#else
+    UNUSED_PARAM(request);
 #endif
 
 #if ENABLE(APP_BOUND_DOMAINS)
@@ -1509,11 +1512,14 @@
 }
 #endif
 
+#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
 SessionWrapper& NetworkSessionCocoa::isolatedSession(WebPageProxyIdentifier webPageProxyID, WebCore::StoredCredentialsPolicy storedCredentialsPolicy, const WebCore::RegistrableDomain firstPartyDomain, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain)
 {
     return sessionSetForPage(webPageProxyID).isolatedSession(storedCredentialsPolicy, firstPartyDomain, isNavigatingToAppBoundDomain, *this);
 }
+#endif
 
+#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
 SessionWrapper& SessionSet::isolatedSession(WebCore::StoredCredentialsPolicy storedCredentialsPolicy, const WebCore::RegistrableDomain firstPartyDomain, NavigatingToAppBoundDomain isNavigatingToAppBoundDomain, NetworkSessionCocoa& session)
 {
     auto& entry = isolatedSessions.ensure(firstPartyDomain, [this, &session, isNavigatingToAppBoundDomain] {
@@ -1556,9 +1562,15 @@
 
     return sessionWrapper;
 }
+#endif
 
+
 bool NetworkSessionCocoa::hasIsolatedSession(const WebCore::RegistrableDomain domain) const
 {
+#if HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
+    UNUSED_PARAM(domain);
+    return true;
+#else
     if (m_defaultSessionSet->isolatedSessions.contains(domain))
         return true;
     for (auto& sessionSet : m_perPageSessionSets.values()) {
@@ -1567,13 +1579,16 @@
     }
     
     return false;
+#endif
 }
 
 void NetworkSessionCocoa::clearIsolatedSessions()
 {
+#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
     m_defaultSessionSet->isolatedSessions.clear();
     for (auto& sessionSet : m_perPageSessionSets.values())
         sessionSet->isolatedSessions.clear();
+#endif
 }
 
 void NetworkSessionCocoa::invalidateAndCancelSessionSet(SessionSet& sessionSet)
@@ -1585,6 +1600,7 @@
     [sessionSet.sessionWithoutCredentialStorage.delegate sessionInvalidated];
     [sessionSet.ephemeralStatelessSession.delegate sessionInvalidated];
 
+#if !HAVE(CFNETWORK_SESSION_PARTITIONING_BASED_ON_FIRST_PARTY_DOMAIN)
     for (auto& session : sessionSet.isolatedSessions.values()) {
         [session->sessionWithCredentialStorage.session invalidateAndCancel];
         [session->sessionWithCredentialStorage.delegate sessionInvalidated];
@@ -1592,6 +1608,7 @@
         [session->sessionWithoutCredentialStorage.delegate sessionInvalidated];
     }
     sessionSet.isolatedSessions.clear();
+#endif
 
     if (sessionSet.appBoundSession) {
         [sessionSet.appBoundSession->sessionWithCredentialStorage.session invalidateAndCancel];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to