Forward additional CFNetwork ATS information to child processes
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Mar 2015 19:04:28 +0000 (19:04 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Mar 2015 19:04:28 +0000 (19:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=143136

Reviewed by Anders Carlsson.

Source/WebCore:

Declare SPI.

* platform/spi/cf/CFNetworkSPI.h:

Source/WebKit2:

Add additional process creation parameter information, and pass it
to the child processes that actually use CFNetwork.

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Shared/Network/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):
* Shared/Network/NetworkProcessCreationParameters.h:
* Shared/Plugins/PluginProcessCreationParameters.cpp:
(WebKit::PluginProcessCreationParameters::encode):
(WebKit::PluginProcessCreationParameters::decode):
* Shared/Plugins/PluginProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
(WebKit::PluginProcessProxy::platformInitializePluginProcess):
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182073 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/spi/cf/CFNetworkSPI.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp
Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h
Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.cpp
Source/WebKit2/Shared/Plugins/PluginProcessCreationParameters.h
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit2/UIProcess/Plugins/mac/PluginProcessProxyMac.mm
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm

index 8228801..dd67c80 100644 (file)
@@ -1,3 +1,14 @@
+2015-03-27  Oliver Hunt  <oliver@apple.com>
+
+        Forward additional CFNetwork ATS information to child processes
+        https://bugs.webkit.org/show_bug.cgi?id=143136
+
+        Reviewed by Anders Carlsson.
+
+        Declare SPI.
+
+        * platform/spi/cf/CFNetworkSPI.h:
+
 2015-03-27  Chris Dumez  <cdumez@apple.com>
 
         [WK2][NetworkCache] We only cache responses with status codes that are cacheable by default
index f2d2274..d4c7f90 100644 (file)
@@ -57,6 +57,7 @@ typedef const struct _CFCachedURLResponse* CFCachedURLResponseRef;
 typedef const struct _CFURLCache* CFURLCacheRef;
 typedef const struct _CFURLRequest *CFURLRequestRef;
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+typedef const struct __CFData *CFDataRef;
 
 #ifdef __BLOCKS__
 typedef void (^CFCachedURLResponseCallBackBlock)(CFCachedURLResponseRef);
@@ -110,4 +111,9 @@ enum : NSUInteger {
 @end
 #endif
 
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+EXTERN_C CFDataRef _CFNetworkCopyATSContext(void);
+EXTERN_C Boolean _CFNetworkSetATSContext(CFDataRef);
+#endif
+
 #endif // CFNetworkSPI_h
index ac86d05..9e3c9d7 100644 (file)
@@ -1,3 +1,35 @@
+2015-03-27  Oliver Hunt  <oliver@apple.com>
+
+        Forward additional CFNetwork ATS information to child processes
+        https://bugs.webkit.org/show_bug.cgi?id=143136
+
+        Reviewed by Anders Carlsson.
+
+        Add additional process creation parameter information, and pass it
+        to the child processes that actually use CFNetwork.
+
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
+        * Shared/Network/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * Shared/Network/NetworkProcessCreationParameters.h:
+        * Shared/Plugins/PluginProcessCreationParameters.cpp:
+        (WebKit::PluginProcessCreationParameters::encode):
+        (WebKit::PluginProcessCreationParameters::decode):
+        * Shared/Plugins/PluginProcessCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        * UIProcess/Plugins/mac/PluginProcessProxyMac.mm:
+        (WebKit::PluginProcessProxy::platformInitializePluginProcess):
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
 2015-03-27  Chris Dumez  <cdumez@apple.com>
 
         [WK2][NetworkCache] We only cache responses with status codes that are cacheable by default
index 74cd0a9..8974bda 100644 (file)
@@ -88,6 +88,9 @@ void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessC
         return;
 
     _CFURLCacheSetMinSizeForVMCachedResource(cache.get(), NetworkResourceLoader::fileBackedResourceMinimumSize());
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    _CFNetworkSetATSContext(parameters.networkATSContext.get());
+#endif
 }
 
 static uint64_t memorySize()
index cd37391..f02afd5 100644 (file)
 
 #include "ArgumentCoders.h"
 
+#if PLATFORM(COCOA)
+#include "ArgumentCodersCF.h"
+#endif
+
 namespace WebKit {
 
 NetworkProcessCreationParameters::NetworkProcessCreationParameters()
@@ -63,6 +67,9 @@ void NetworkProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) con
     encoder << nsURLCacheDiskCapacity;
     encoder << httpProxy;
     encoder << httpsProxy;
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    IPC::encode(encoder, networkATSContext.get());
+#endif
 #endif
 #if USE(SOUP)
     encoder << cookiePersistentStoragePath;
@@ -120,6 +127,10 @@ bool NetworkProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, Net
         return false;
     if (!decoder.decode(result.httpsProxy))
         return false;
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    if (!IPC::decode(decoder, result.networkATSContext))
+        return false;
+#endif
 #endif
 
 #if USE(SOUP)
index e9ae87a..efed470 100644 (file)
@@ -84,6 +84,9 @@ struct NetworkProcessCreationParameters {
 
     String httpProxy;
     String httpsProxy;
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    RetainPtr<CFDataRef> networkATSContext;
+#endif
 #endif
 
 #if USE(SOUP)
index b9c49f0..401d819 100644 (file)
@@ -27,7 +27,9 @@
 #include "PluginProcessCreationParameters.h"
 
 #if ENABLE(NETSCAPE_PLUGIN_API)
-
+#if PLATFORM(COCOA)
+#include "ArgumentCodersCF.h"
+#endif
 #include "WebCoreArgumentCoders.h"
 
 namespace WebKit {
@@ -45,6 +47,9 @@ void PluginProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) cons
     encoder << terminationTimeout;
 #if PLATFORM(COCOA)
     encoder << acceleratedCompositingPort;
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    IPC::encode(encoder, networkATSContext.get());
+#endif
 #endif
 }
 
@@ -61,6 +66,10 @@ bool PluginProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, Plug
 #if PLATFORM(COCOA)
     if (!decoder.decode(result.acceleratedCompositingPort))
         return false;
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    if (!IPC::decode(decoder, result.networkATSContext))
+        return false;
+#endif
 #endif
 
     return true;
index 3d19a48..74f1a47 100644 (file)
@@ -55,6 +55,9 @@ struct PluginProcessCreationParameters {
 
 #if PLATFORM(COCOA)
     WebCore::MachSendRight acceleratedCompositingPort;
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    RetainPtr<CFDataRef> networkATSContext;
+#endif
 #endif
 };
 
index 91a3361..36c2aaa 100644 (file)
@@ -27,6 +27,9 @@
 #include "WebProcessCreationParameters.h"
 
 #include "APIData.h"
+#if PLATFORM(COCOA)
+#include "ArgumentCodersCF.h"
+#endif
 #include "WebCoreArgumentCoders.h"
 
 namespace WebKit {
@@ -148,6 +151,10 @@ void WebProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) const
 #if ENABLE(NETSCAPE_PLUGIN_API)
     encoder << pluginLoadClientPolicies;
 #endif
+
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    IPC::encode(encoder, networkATSContext.get());
+#endif
 }
 
 bool WebProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebProcessCreationParameters& parameters)
@@ -311,6 +318,11 @@ bool WebProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebProc
         return false;
 #endif
 
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    if (!IPC::decode(decoder, parameters.networkATSContext))
+        return false;
+#endif
+
     return true;
 }
 
index c99c3f2..4f4309e 100644 (file)
@@ -171,6 +171,10 @@ struct WebProcessCreationParameters {
 #if ENABLE(NETSCAPE_PLUGIN_API)
     HashMap<String, HashMap<String, HashMap<String, uint8_t>>> pluginLoadClientPolicies;
 #endif
+
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    RetainPtr<CFDataRef> networkATSContext;
+#endif
 };
 
 } // namespace WebKit
index f00a5ff..194273a 100644 (file)
@@ -234,6 +234,9 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
             [(NSData *)data release];
         }, data.leakRef());
     }
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
+#endif
 }
 
 #if ENABLE(NETWORK_PROCESS)
@@ -251,6 +254,9 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
 
     parameters.httpProxy = [[NSUserDefaults standardUserDefaults] stringForKey:WebKit2HTTPProxyDefaultsKey];
     parameters.httpsProxy = [[NSUserDefaults standardUserDefaults] stringForKey:WebKit2HTTPSProxyDefaultsKey];
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
+#endif
 
 #if ENABLE(NETWORK_CACHE)
     parameters.shouldEnableNetworkCache = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitNetworkCacheEnabledDefaultsKey];
index d7a95ba..94316cf 100644 (file)
@@ -35,6 +35,7 @@
 #import "SandboxUtilities.h"
 #import "WebKitSystemInterface.h"
 #import <QuartzCore/CARemoteLayerServer.h>
+#import <WebCore/CFNetworkSPI.h>
 #import <WebCore/FileSystem.h>
 #import <WebCore/URL.h>
 #import <crt_externs.h>
@@ -166,6 +167,9 @@ void PluginProcessProxy::platformInitializePluginProcess(PluginProcessCreationPa
 #if HAVE(HOSTED_CORE_ANIMATION)
     parameters.acceleratedCompositingPort = MachSendRight::create([CARemoteLayerServer sharedServer].serverPort);
 #endif
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
+#endif
 }
 
 bool PluginProcessProxy::getPluginProcessSerialNumber(ProcessSerialNumber& pluginProcessSerialNumber)
index 2d6ba14..da2497b 100644 (file)
@@ -207,6 +207,9 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& par
     Method methodToPatch = class_getInstanceMethod([NSApplication class], @selector(accessibilityFocusedUIElement));
     method_setImplementation(methodToPatch, (IMP)NSApplicationAccessibilityFocusedUIElement);
 #endif
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+    _CFNetworkSetATSContext(parameters.networkATSContext.get());
+#endif
 }
 
 void WebProcess::initializeProcessName(const ChildProcessInitializationParameters& parameters)