Changeset 291598 in webkit


Ignore:
Timestamp:
Mar 21, 2022, 8:28:05 PM (3 years ago)
Author:
achristensen@apple.com
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):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r291591 r291598  
     12022-03-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Adjust when _setPrivacyProxyFailClosedForUnreachableNonMainHosts is called
     4        https://bugs.webkit.org/show_bug.cgi?id=237735
     5
     6        Reviewed by Geoff Garen.
     7
     8        * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
     9        (WebKit::NetworkDataTaskCocoa::NetworkDataTaskCocoa):
     10        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     11        (-[WKNetworkSessionDelegate URLSession:dataTask:didReceiveResponse:completionHandler:]):
     12        (WebKit::NetworkSessionCocoa::createWebSocketTask):
     13
    1142022-03-21  Aditya Keerthi  <akeerthi@apple.com>
    215
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm

    r291234 r291598  
    340340    RetainPtr<NSURLRequest> nsRequest = request.nsURLRequest(WebCore::HTTPBodyUpdatePolicy::UpdateHTTPBody);
    341341    RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
     342
     343    if (parameters.isMainFrameNavigation
     344        || parameters.hadMainFrameMainResourcePrivateRelayed // This means it did not fail. FIXME: adjust names to reflect this.
     345        || !parameters.topOrigin
     346        || request.url().host() == parameters.topOrigin->host()) {
     347        if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
     348            [mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
     349    }
    342350
    343351#if ENABLE(APP_PRIVACY_REPORT)
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r291234 r291598  
    932932        NSURLSessionTaskTransactionMetrics *metrics = taskMetrics.transactionMetrics.lastObject;
    933933#if HAVE(NETWORK_CONNECTION_PRIVACY_STANCE)
    934         auto privateRelayed = metrics._privacyStance == nw_connection_privacy_stance_direct ? PrivateRelayed::No : PrivateRelayed::Yes;
     934        auto privateRelayed = metrics._privacyStance == nw_connection_privacy_stance_failed ? PrivateRelayed::No : PrivateRelayed::Yes;
    935935#else
    936936        auto privateRelayed = PrivateRelayed::No;
     
    17181718#endif
    17191719
     1720    // FIXME: This function can make up to 3 copies of a request.
     1721    // Reduce that to one if the protocol is null, the request isn't app initiated,
     1722    // or the main frame main resource was private relayed, then set all properties
     1723    // on the one copy.
     1724    if (hadMainFrameMainResourcePrivateRelayed || request.url().host() == clientOrigin.topOrigin.host) {
     1725        RetainPtr<NSMutableURLRequest> mutableRequest = adoptNS([nsRequest.get() mutableCopy]);
     1726        if ([mutableRequest respondsToSelector:@selector(_setPrivacyProxyFailClosedForUnreachableNonMainHosts:)])
     1727            [mutableRequest _setPrivacyProxyFailClosedForUnreachableNonMainHosts:YES];
     1728        nsRequest = WTFMove(mutableRequest);
     1729    }
     1730
    17201731    auto& sessionSet = sessionSetForPage(webPageProxyID);
    17211732    RetainPtr<NSURLSessionWebSocketTask> task = [sessionSet.sessionWithCredentialStorage.session webSocketTaskWithRequest:nsRequest.get()];
Note: See TracChangeset for help on using the changeset viewer.