Title: [291598] trunk/Source/WebKit
- Revision
- 291598
- Author
- achristen...@apple.com
- Date
- 2022-03-21 20:28:05 -0700 (Mon, 21 Mar 2022)
Log Message
Adjust when _setPrivacyProxyFailClosedForUnreachableNonMainHosts is called
https://bugs.webkit.org/show_bug.cgi?id=237735
Reviewed by Geoff Garen.
* NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
(WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
(WebKit::NetworkSessionCocoa::createWebSocketTask):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (291597 => 291598)
--- trunk/Source/WebKit/ChangeLog 2022-03-22 03:22:44 UTC (rev 291597)
+++ trunk/Source/WebKit/ChangeLog 2022-03-22 03:28:05 UTC (rev 291598)
@@ -1,3 +1,16 @@
+2022-03-21 Alex Christensen <achristen...@webkit.org>
+
+ Adjust when _setPrivacyProxyFailClosedForUnreachableNonMainHosts is called
+ https://bugs.webkit.org/show_bug.cgi?id=237735
+
+ Reviewed by Geoff Garen.
+
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+ (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
+ (WebKit::NetworkSessionCocoa::createWebSocketTask):
+
2022-03-21 Aditya Keerthi <akeer...@apple.com>
Unreviewed, address post-landing feedback on r291445
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (291597 => 291598)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2022-03-22 03:22:44 UTC (rev 291597)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2022-03-22 03:28:05 UTC (rev 291598)
@@ -340,6 +340,14 @@
RetainPtr<NSURLRequest> nsRequest = request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::UpdateHTTPBody);
RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
+ 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;
#endif
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (291597 => 291598)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2022-03-22 03:22:44 UTC (rev 291597)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2022-03-22 03:28:05 UTC (rev 291598)
@@ -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
@@ -1717,6 +1717,17 @@
appPrivacyReportTestingData().didLoadAppInitiatedRequest(nsRequest.get().attribution == NSURLRequestAttributionDeveloper);
#endif
+ // FIXME: This function can make up to 3 copies of a request.
+ // 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 || request.url().host() == clientOrigin.topOrigin.host) {
+ RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
+ if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
+ [mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
+ nsRequest = WTFMove(mutableRequest);
+ }
+
auto& sessionSet = sessionSetForPage(webPageProxyID);
RetainPtr<NSURLSessionWebSocketTask> task = [sessionSet.sessionWithCredentialStorage.session webSocketTaskWithRequest:nsRequest.get()];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes