Fix entitlements and sandboxing for iphoneminimalsimulator
[WebKit-https.git] / Source / WebKit / NetworkProcess / mac / NetworkProcessMac.mm
index f2aeeddc44200b67ad49d00c5a449a9a144a870e..54ab302f7eff777efc5ee93a8dc52e5c44784adf 100644 (file)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "NetworkProcess.h"
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || ENABLE(MINIMAL_SIMULATOR)
 
 #import "NetworkCache.h"
 #import "NetworkProcessCreationParameters.h"
 #import "SandboxInitializationParameters.h"
 #import "SecItemShim.h"
 #import "StringUtilities.h"
-#import <WebCore/CFNetworkSPI.h>
 #import <WebCore/CertificateInfo.h>
 #import <WebCore/FileSystem.h>
 #import <WebCore/LocalizedStrings.h>
-#import <WebKitSystemInterface.h>
 #import <notify.h>
+#import <pal/spi/cf/CFNetworkSPI.h>
+#import <pal/spi/cocoa/LaunchServicesSPI.h>
 #import <sysexits.h>
 #import <wtf/MemoryPressureHandler.h>
 #import <wtf/text/WTFString.h>
@@ -58,8 +58,10 @@ void NetworkProcess::initializeProcess(const ChildProcessInitializationParameter
 
 void NetworkProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)
 {
+#if !ENABLE(MINIMAL_SIMULATOR)
     NSString *applicationName = [NSString stringWithFormat:WEB_UI_STRING("%@ Networking", "visible name of the network process. The argument is the application name."), (NSString *)parameters.uiProcessName];
-    WKSetVisibleApplicationName((CFStringRef)applicationName);
+    _LSSetApplicationInformationItem(kLSDefaultSessionID, _LSGetCurrentApplicationASN(), _kLSDisplayNameKey, (CFStringRef)applicationName, nullptr);
+#endif
 }
 
 static void overrideSystemProxies(const String& httpProxy, const String& httpsProxy)
@@ -82,11 +84,13 @@ static void overrideSystemProxies(const String& httpProxy, const String& httpsPr
     if (!httpsProxy.isNull()) {
         URL httpsProxyURL(URL(), httpsProxy);
         if (httpsProxyURL.isValid()) {
+#if !ENABLE(MINIMAL_SIMULATOR)
             [proxySettings setObject:nsStringFromWebCoreString(httpsProxyURL.host()) forKey:(NSString *)kCFNetworkProxiesHTTPSProxy];
             if (httpsProxyURL.port()) {
                 NSNumber *port = [NSNumber numberWithInt:httpsProxyURL.port().value()];
                 [proxySettings setObject:port forKey:(NSString *)kCFNetworkProxiesHTTPSPort];
             }
+#endif
         } else
             NSLog(@"Malformed HTTPS Proxy URL '%s'.  Expected 'https://<hostname>[:<port>]'\n", httpsProxy.utf8().data());
     }
@@ -127,7 +131,7 @@ void NetworkProcess::clearCacheForAllOrigins(uint32_t cachesToClear)
     if (resourceCachesToClear == InMemoryResourceCachesOnly)
         return;
 
-    clearDiskCache(std::chrono::system_clock::time_point::min(), [] { });
+    clearDiskCache(-WallTime::infinity(), [] { });
 }
 
 void NetworkProcess::platformTerminate()