Title: [291206] trunk/Source/WebKit
Revision
291206
Author
commit-qu...@webkit.org
Date
2022-03-11 21:01:28 -0800 (Fri, 11 Mar 2022)

Log Message

Adjust when _setPrivacyProxyFailClosedForUnreachableNonMainHosts is called
https://bugs.webkit.org/show_bug.cgi?id=237735
<rdar://89972004>

Patch by Alex Christensen <achristen...@webkit.org> on 2022-03-11
Reviewed by Geoff Garen.

It was originally being called differently between main resources and subresources on the same domain,
causing them to use connections with different properties, so we couldn't share connections any more.
This will make it so that more connections are shared, which should fix the performance regression from
no longer sharing connections to the same domain.

* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291205 => 291206)


--- trunk/Source/WebKit/ChangeLog	2022-03-12 04:07:43 UTC (rev 291205)
+++ trunk/Source/WebKit/ChangeLog	2022-03-12 05:01:28 UTC (rev 291206)
@@ -1,3 +1,21 @@
+2022-03-11  Alex Christensen  <achristen...@webkit.org>
+
+        Adjust when _setPrivacyProxyFailClosedForUnreachableNonMainHosts is called
+        https://bugs.webkit.org/show_bug.cgi?id=237735
+        <rdar://89972004>
+
+        Reviewed by Geoff Garen.
+
+        It was originally being called differently between main resources and subresources on the same domain,
+        causing them to use connections with different properties, so we couldn't share connections any more.
+        This will make it so that more connections are shared, which should fix the performance regression from
+        no longer sharing connections to the same domain.
+
+        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
+
 2022-03-11  Simon Fraser  <simon.fra...@apple.com>
 
         Unreviewed logging removal.

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (291205 => 291206)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2022-03-12 04:07:43 UTC (rev 291205)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm	2022-03-12 05:01:28 UTC (rev 291206)
@@ -340,10 +340,13 @@
     RetainPtr<NSURLRequest> nsRequest = request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::UpdateHTTPBody);
     RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
 
-    if (!parameters.isMainFrameNavigation
-        && parameters.hadMainFrameMainResourcePrivateRelayed
-        && [mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
-        [mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
+    if (parameters.isMainFrameNavigation
+        || parameters.hadMainFrameMainResourcePrivateRelayed // This means it did not fail. FIXME: adjust names to reflect this.
+        || !parameters.topOrigin
+        || request.url().host() == parameters.topOrigin->host()) {
+        if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
+            [mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
+    }
 
 #if ENABLE(APP_PRIVACY_REPORT)
     mutableRequest.get().attribution = request.isAppInitiated() ? NSURLRequestAttributionDeveloper : NSURLRequestAttributionUser;

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (291205 => 291206)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2022-03-12 04:07:43 UTC (rev 291205)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2022-03-12 05:01:28 UTC (rev 291206)
@@ -931,7 +931,7 @@
 
         NSURLSessionTaskTransactionMetrics *metrics = taskMetrics.transactionMetrics.lastObject;
 #if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
-        auto privateRelayed = metrics._privacyStance == nw_connection_privacy_stance_direct ? PrivateRelayed::No : PrivateRelayed::Yes;
+        auto privateRelayed = metrics._privacyStance == nw_connection_privacy_stance_failed ? PrivateRelayed::No : PrivateRelayed::Yes;
 #else
         auto privateRelayed = PrivateRelayed::No;
 #endif
@@ -1721,7 +1721,7 @@
     // Reduce that to one if the protocol is null, the request isn't app initiated,
     // or the main frame main resource was private relayed, then set all properties
     // on the one copy.
-    if (hadMainFrameMainResourcePrivateRelayed) {
+    if (hadMainFrameMainResourcePrivateRelayed || request.url().host() == clientOrigin.topOrigin.host) {
         RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
         if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
             [mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to