Skip to content

Commit 87c02de

Browse files
committed
Remove HAVE(NW_PROXY_CONFIG)
https://bugs.webkit.org/show_bug.cgi?id=328110 rdar://190455220 Reviewed by Alex Christensen. It's true on all Cocoa ports now. * Source/WTF/wtf/PlatformHave.h: * Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h: * Source/WebKit/NetworkProcess/NetworkProcess.h: * Source/WebKit/NetworkProcess/NetworkProcess.messages.in: * Source/WebKit/NetworkProcess/NetworkSession.h: * Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h: * Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.serialization.in: * Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm: (WebKit::NetworkProcess::setProxyConfigData): * Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h: * Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm: (-[WKNetworkSessionDelegate URLSession:didBecomeInvalidWithError:]): (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): (WebKit::SessionWrapper::initialize): (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): (WebKit::NetworkSessionCocoa::invalidateAndCancel): (WebKit::NetworkSessionCocoa::removeWebSocketTask): (WebKit::NetworkSessionCocoa::applyProxyConfigurationToSessionConfiguration): * Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm: * Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp: (WebKit::WebsiteDataStore::parameters): * Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h: Canonical link: https://commits.webkit.org/324182@main
1 parent 788cb78 commit 87c02de

13 files changed

Lines changed: 12 additions & 55 deletions

‎Source/WTF/wtf/PlatformHave.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,12 +1186,6 @@
11861186
#define HAVE_BCS_LIVE_CAMERA_ONLY_ACTION_SPI 1
11871187
#endif
11881188

1189-
#if PLATFORM(COCOA)
1190-
#if __has_include(<Network/proxy_config.h>)
1191-
#define HAVE_NW_PROXY_CONFIG 1
1192-
#endif
1193-
#endif
1194-
11951189
#if (PLATFORM(COCOA) && !PLATFORM(WATCHOS))
11961190
#define HAVE_CFNETWORK_HOSTOVERRIDE 1
11971191
#endif

‎Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ struct nw_path_evaluator;
123123
typedef struct nw_path_evaluator *nw_path_evaluator_t;
124124
#endif // OS_OBJECT_USE_OBJC
125125

126-
#if HAVE(NW_PROXY_CONFIG) || HAVE(SYSTEM_SUPPORT_FOR_ADVANCED_PRIVACY_PROTECTIONS)
127126
typedef void (^nw_context_tracker_lookup_callback_t)(nw_endpoint_t endpoint, const char **tracker_name, const char **tracker_owner, bool *can_block);
128127

129128
#ifdef __cplusplus
@@ -136,7 +135,6 @@ void nw_context_set_tracker_lookup_callback(nw_context_t, nw_context_tracker_loo
136135
#ifdef __cplusplus
137136
}
138137
#endif
139-
#endif // HAVE(NW_PROXY_CONFIG) || HAVE(SYSTEM_SUPPORT_FOR_ADVANCED_PRIVACY_PROTECTIONS)
140138

141139
#ifdef __cplusplus
142140
extern "C" {

‎Source/WebKit/NetworkProcess/NetworkProcess.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ class NetworkProcess final : public AuxiliaryProcess, private DownloadManager::C
601601
void removeWebPageNetworkParameters(PAL::SessionID, WebPageProxyIdentifier);
602602
void countNonDefaultSessionSets(PAL::SessionID, CompletionHandler<void(uint64_t)>&&);
603603

604-
#if HAVE(NW_PROXY_CONFIG)
604+
#if PLATFORM(COCOA)
605605
void clearProxyConfigData(PAL::SessionID);
606606
void setProxyConfigData(PAL::SessionID, Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>>&& proxyConfigurations);
607607
#endif

‎Source/WebKit/NetworkProcess/NetworkProcess.messages.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ messages -> NetworkProcess : AuxiliaryProcess WantsAsyncDispatchMessage {
284284
SetEmulatedConditions(PAL::SessionID sessionID, std::optional<uint64_t> bandwidthBytesPerSecond, Seconds latency)
285285
#endif
286286

287-
#if HAVE(NW_PROXY_CONFIG)
287+
#if PLATFORM(COCOA)
288288
ClearProxyConfigData(PAL::SessionID sessionID)
289289
SetProxyConfigData(PAL::SessionID sessionID, Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>> proxyConfigurations)
290290
#endif

‎Source/WebKit/NetworkProcess/NetworkSession.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class NetworkSession : public WebCore::SWServerDelegate, public CanMakeCheckedPt
326326
void setEmulatedConditions(std::optional<uint64_t> bandwidthBytesPerSecond, Seconds latency);
327327
#endif
328328

329-
#if HAVE(NW_PROXY_CONFIG)
329+
#if PLATFORM(COCOA)
330330
virtual void clearProxyConfigData() { }
331331
virtual void setProxyConfigData(const Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>>&) { };
332332
#endif

‎Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct NetworkSessionCreationParameters {
137137
#if ENABLE(DECLARATIVE_WEB_PUSH)
138138
bool isDeclarativeWebPushEnabled { false };
139139
#endif
140-
#if HAVE(NW_PROXY_CONFIG)
140+
#if PLATFORM(COCOA)
141141
std::optional<Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>>> proxyConfigData;
142142
#endif
143143
ResourceLoadStatisticsParameters resourceLoadStatisticsParameters;

‎Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.serialization.in‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ enum class WebKit::AllowsCellularAccess : bool;
110110
#if ENABLE(DECLARATIVE_WEB_PUSH)
111111
bool isDeclarativeWebPushEnabled;
112112
#endif
113-
#if HAVE(NW_PROXY_CONFIG)
113+
#if PLATFORM(COCOA)
114114
std::optional<Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>>> proxyConfigData;
115115
#endif
116116
WebKit::ResourceLoadStatisticsParameters resourceLoadStatisticsParameters;

‎Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ void saveCookies(NSHTTPCookieStorage *cookieStorage, CompletionHandler<void()>&&
296296
}
297297
#endif // PLATFORM(IOS_FAMILY)
298298

299-
#if HAVE(NW_PROXY_CONFIG)
300299
void NetworkProcess::clearProxyConfigData(PAL::SessionID sessionID)
301300
{
302301
CheckedPtr session = networkSession(sessionID);
@@ -314,6 +313,5 @@ void saveCookies(NSHTTPCookieStorage *cookieStorage, CompletionHandler<void()>&&
314313

315314
session->setProxyConfigData(WTF::move(proxyConfigurations));
316315
}
317-
#endif // HAVE(NW_PROXY_CONFIG)
318316

319317
} // namespace WebKit

‎Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,14 @@ class NetworkSessionCocoa final : public NetworkSession {
166166
void removeDataTask(DataTaskIdentifier);
167167
void removeBlobDataTask(DataTaskIdentifier);
168168

169-
#if HAVE(NW_PROXY_CONFIG)
170169
const Vector<RetainPtr<nw_proxy_config_t>>& proxyConfigs() const LIFETIME_BOUND { return m_nwProxyConfigs; }
171170

172171
void clearProxyConfigData() final;
173172
void setProxyConfigData(const Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>>&) final;
174173

175174
void applyProxyConfigurationToSessionConfiguration(NSURLSessionConfiguration *);
176175
void replacedSessionDidBecomeInvalid(NSURLSession *);
177-
#endif
176+
178177
bool isLegacyTLSAllowed() const { return m_isLegacyTLSAllowed; }
179178

180179
private:
@@ -208,10 +207,8 @@ class NetworkSessionCocoa final : public NetworkSession {
208207
size_t countNonDefaultSessionSets() const final;
209208

210209
void forEachSessionWrapper(NOESCAPE const Function<void(UniqueRef<SessionWrapper>&)>&);
211-
#if HAVE(NW_PROXY_CONFIG)
212210
void replaceSessionsWithUpdatedProxyConfigurations();
213211
void removeFinishedReplacedSessionWrappers();
214-
#endif
215212

216213
bool isNetworkSessionCocoa() const final { return true; }
217214

@@ -229,11 +226,9 @@ class NetworkSessionCocoa final : public NetworkSession {
229226
String m_sourceApplicationBundleIdentifier;
230227
String m_sourceApplicationSecondaryIdentifier;
231228
const RetainPtr<CFDictionaryRef> m_proxyConfiguration;
232-
#if HAVE(NW_PROXY_CONFIG)
233229
Vector<std::pair<Vector<uint8_t>, std::optional<WTF::UUID>>> m_proxyConfigData;
234230
Vector<RetainPtr<nw_proxy_config_t>> m_nwProxyConfigs;
235231
Vector<UniqueRef<SessionWrapper>> m_replacedSessionWrappers;
236-
#endif
237232
const RetainPtr<DMFWebsitePolicyMonitor> m_deviceManagementPolicyMonitor;
238233
bool m_deviceManagementRestrictionsEnabled { false };
239234
bool m_allLoadsBlockedByDeviceManagementRestrictionsForTesting { false };

‎Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm‎

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#import "WebPrivacyHelpers.h"
4848
#import "WebSocketTask.h"
4949
#import <Foundation/NSURLSession.h>
50+
#import <Network/NSURLSession+Network.h>
5051
#import <WebCore/AdvancedPrivacyProtections.h>
5152
#import <WebCore/Credential.h>
5253
#import <WebCore/FormDataStreamCocoa.h>
@@ -104,10 +105,6 @@
104105
void WebKit::NetworkSessionCocoa::removeNetworkWebsiteData(std::optional<WallTime>, std::optional<HashSet<WebCore::RegistrableDomain>>&&, CompletionHandler<void()>&& completionHandler) { completionHandler(); }
105106
#endif
106107

107-
#if HAVE(NW_PROXY_CONFIG) && __has_include(<Network/NSURLSession+Network.h>)
108-
#include <Network/NSURLSession+Network.h>
109-
#endif
110-
111108
#import "DeviceManagementSoftLink.h"
112109

113110
using WebKit::IsolatedSession;
@@ -315,7 +312,6 @@ - (void)sessionInvalidated
315312

316313
- (void)URLSession:(NSURLSession *)session didBecomeInvalidWithError:(NSError *)error
317314
{
318-
#if HAVE(NW_PROXY_CONFIG)
319315
// Other sessions lose their wrappers before they become invalid, but a session that a proxy
320316
// change replaced keeps its wrapper until it finishes its tasks. The wrapper owns the session
321317
// and this delegate, and can let go of both here.
@@ -324,10 +320,7 @@ - (void)URLSession:(NSURLSession *)session didBecomeInvalidWithError:(NSError *)
324320
RetainPtr protectedSession = session;
325321
if (CheckedPtr networkSession = _session)
326322
networkSession->replacedSessionDidBecomeInvalid(protectedSession.get());
327-
return;
328323
}
329-
#endif
330-
ASSERT(!_sessionWrapper);
331324
}
332325

333326
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend
@@ -599,9 +592,7 @@ - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didRece
599592
// Proxy authentication is handled by CFNetwork internally. We can get here if the user cancels
600593
// CFNetwork authentication dialog, and we shouldn't ask the client to display another one in that case.
601594
if (challenge.protectionSpace.isProxy
602-
#if HAVE(NW_PROXY_CONFIG)
603595
&& sessionCocoa->proxyConfigs().isEmpty()
604-
#endif
605596
&& !sessionCocoa->preventsSystemHTTPProxyAuthentication())
606597
return completionHandler(NSURLSessionAuthChallengeUseCredential, nil);
607598

@@ -1122,9 +1113,7 @@ - (void)URLSession:(NSURLSession *)session webSocketTask:(NSURLSessionWebSocketT
11221113
if (!configuration._sourceApplicationSecondaryIdentifier && isFullBrowser)
11231114
configuration._sourceApplicationSecondaryIdentifier = @"com.apple.WebKit.InAppBrowser";
11241115

1125-
#if HAVE(NW_PROXY_CONFIG)
11261116
networkSession.applyProxyConfigurationToSessionConfiguration(configuration);
1127-
#endif
11281117

11291118
delegate = adoptNS([[WKNetworkSessionDelegate alloc] initWithNetworkSession:networkSession wrapper:*this withCredentials:storedCredentialsPolicy == WebCore::StoredCredentialsPolicy::Use]);
11301119
session = [NSURLSession sessionWithConfiguration:configuration delegate:delegate.get() delegateQueue:[NSOperationQueue mainQueue]];
@@ -1252,11 +1241,9 @@ - (void)URLSession:(NSURLSession *)session webSocketTask:(NSURLSessionWebSocketT
12521241
configuration.get().TLSMinimumSupportedProtocolVersion = tls_protocol_version_TLSv12;
12531242
#endif
12541243

1255-
#if HAVE(NW_PROXY_CONFIG)
12561244
// Before the sessions exist, so that they get created with the proxies, rather than replaced.
12571245
if (parameters.proxyConfigData)
12581246
setProxyConfigData(*parameters.proxyConfigData);
1259-
#endif
12601247

12611248
initializeNSURLSessionsInSet(m_defaultSessionSet.get(), configuration.get());
12621249

@@ -1517,13 +1504,11 @@ - (void)URLSession:(NSURLSession *)session webSocketTask:(NSURLSessionWebSocketT
15171504
for (auto& sessionSet : m_perPageSessionSets.values())
15181505
invalidateAndCancelSessionSet(sessionSet.get());
15191506

1520-
#if HAVE(NW_PROXY_CONFIG)
15211507
for (auto& sessionWrapper : m_replacedSessionWrappers) {
15221508
[sessionWrapper->session invalidateAndCancel];
15231509
[sessionWrapper->delegate sessionInvalidated];
15241510
}
15251511
m_replacedSessionWrappers.clear();
1526-
#endif
15271512
}
15281513

15291514
HashSet<WebCore::SecurityOriginData> NetworkSessionCocoa::originsWithCredentials()
@@ -1741,10 +1726,8 @@ - (void)URLSession:(NSURLSession *)session webSocketTask:(NSURLSessionWebSocketT
17411726
RELEASE_LOG(NetworkSession, "NetworkSessionCocoa::removeWebSocketTask, web socket count is %u", webSocketDataTaskMap.size());
17421727
}
17431728

1744-
#if HAVE(NW_PROXY_CONFIG)
17451729
// The wrapper of a session that a proxy change replaced may have been waiting for this task.
17461730
removeFinishedReplacedSessionWrappers();
1747-
#endif
17481731
}
17491732

17501733
void NetworkSessionCocoa::addWebPageNetworkParameters(WebPageProxyIdentifier pageID, WebPageNetworkParameters&& parameters)
@@ -2005,7 +1988,6 @@ void didCompleteWithError(const WebCore::ResourceError& error, const WebCore::Ne
20051988
}
20061989
}
20071990

2008-
#if HAVE(NW_PROXY_CONFIG)
20091991
void NetworkSessionCocoa::clearProxyConfigData()
20101992
{
20111993
setProxyConfigData({ });
@@ -2092,7 +2074,6 @@ void didCompleteWithError(const WebCore::ResourceError& error, const WebCore::Ne
20922074
} else
20932075
configuration.proxyConfigurations = @[ ];
20942076
}
2095-
#endif // HAVE(NW_PROXY_CONFIG)
20962077

20972078
#if USE(APPLE_INTERNAL_SDK)
20982079

0 commit comments

Comments
 (0)