[iOS] Support using Foundation networking code
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Sep 2014 00:14:06 +0000 (00:14 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Sep 2014 00:14:06 +0000 (00:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136467

Reviewed by Pratik Solanki.

Source/WebCore:

We should support building iOS WebKit with the Foundation networking code
(i.e. !USE(CFNETWORK)).

Additionally, disable USE(CFNETWORK) and use the Foundation networking code
by default when building iOS WebKit without the Apple Internal SDK.

* Configurations/WebCore.xcconfig: Remove file WebCoreURLResponse.mm from the list of excluded files
so that we compile an implementation for function WebCore::synthesizeRedirectResponseIfNecessary when
building without USE(CFNETWORK).
* WebCore.exp.in: Add symbols for WebCore::synthesizeRedirectResponseIfNecessary() and WebCore::ResourceHandleClient::willCacheResponseAsync().
* WebCore.xcodeproj/project.pbxproj: Add new files CFNetworkConnectionCacheSPI.h and CFURLRequestSPI.h.
Also move group platform/spi such that it appears in alphabetical order in the platform group.
* platform/cf/URLCF.cpp: Remove unnecessary header <CoreFoundation/CFPriv.h>.
* platform/network/ResourceHandle.h: Declare iOS-specific variant of ResourceHandle::createNSURLConnection().
* platform/network/ResourceHandleClient.h: Always include header <wtf/RetainPtr.h> when building for iOS.
(WebCore::ResourceHandleClient::connectionProperties): Add PLATFORM(IOS)-guard around declaration.
* platform/network/cf/ResourceRequestCFNet.cpp: Substitute header CFNetworkConnectionCacheSPI.h for
<CFNetwork/CFNetworkConnectionCachePriv.h>.
* platform/network/mac/CredentialStorageMac.mm:
(WebCore::CredentialStorage::saveToPersistentStorage): Use Credential::nsCredential() and ProtectionSpace::nsSpace()
instead of WebCore::mac(const {Credential, ProtectionSpace}&) as the latter were removed in <http://trac.webkit.org/changeset/171801>
and <http://trac.webkit.org/changeset/171540>, respectively.
* platform/network/mac/ResourceErrorMac.mm: Add USE(CFNETWORK)-guard around <CFNetwork/CFSocketStreamPriv.h>.
* platform/network/mac/ResourceHandleMac.mm: Substitute header CFURLRequestSPI.h for <CFNetwork/CFURLRequest.h>.
(WebCore::ResourceHandle::start): Modified to use ResourceHandle::makeDelegate() instead of d->m_proxy, which
was removed in <http://trac.webkit.org/changeset/147476>.
(WebCore::ResourceHandle::platformLoadResourceSynchronously): Ditto.
* platform/network/mac/WebCoreURLResponse.mm:
(WebCore::synthesizeRedirectResponseIfNecessary): Add !USE(CFNETWORK)- and PLATFORM(IOS)- guards.
* platform/spi/cf/CFNetworkConnectionCacheSPI.h: Added.
* platform/spi/cf/CFURLRequestSPI.h: Added.

Source/WTF:

Disable USE(CFNETWORK) and use the Foundation networking code by default when building
iOS WebKit without the Apple Internal SDK.

* wtf/Platform.h:

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

16 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/cf/URLCF.cpp
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/mac/CredentialStorageMac.mm
Source/WebCore/platform/network/mac/ResourceErrorMac.mm
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
Source/WebCore/platform/spi/cf/CFNetworkConnectionCacheSPI.h [new file with mode: 0644]
Source/WebCore/platform/spi/cf/CFURLRequestSPI.h [new file with mode: 0644]

index eaf7f0f..b4d4ac2 100644 (file)
@@ -1,3 +1,15 @@
+2014-09-02  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Support using Foundation networking code
+        https://bugs.webkit.org/show_bug.cgi?id=136467
+
+        Reviewed by Pratik Solanki.
+
+        Disable USE(CFNETWORK) and use the Foundation networking code by default when building
+        iOS WebKit without the Apple Internal SDK.
+
+        * wtf/Platform.h:
+
 2014-08-26  Maciej Stachowiak  <mjs@apple.com>
 
         Use RetainPtr::autorelease in some places where it seems appropriate
index 3539982..5ce44b0 100644 (file)
 #define WTF_PLATFORM_COCOA 1
 #endif
 
+#if PLATFORM(COCOA)
+#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
+#define WTF_USE_APPLE_INTERNAL_SDK 1
+#endif
+#endif
+
 /* Graphics engines */
 
 /* USE(CG) and PLATFORM(CI) */
 
 #define DONT_FINALIZE_ON_MAIN_THREAD 1
 #define HAVE_READLINE 1
+#if USE(APPLE_INTERNAL_SDK)
 #define WTF_USE_CFNETWORK 1
+#endif
 #define WTF_USE_UIKIT_EDITING 1
 #define WTF_USE_WEB_THREAD 1
 #define WTF_USE_QUICK_LOOK 1
 #define WTF_USE_ASYNC_NSTEXTINPUTCLIENT 1
 #endif
 
-#if PLATFORM(COCOA)
-#if defined __has_include && __has_include(<CoreFoundation/CFPriv.h>)
-#define WTF_USE_APPLE_INTERNAL_SDK 1
-#endif
-#endif
-
 #if (OS(DARWIN) && USE(CG)) || USE(FREETYPE) || (PLATFORM(WIN) && (USE(CG) || USE(CAIRO)))
 #undef ENABLE_OPENTYPE_MATH
 #define ENABLE_OPENTYPE_MATH 1
index 9dea3eb..6674580 100644 (file)
@@ -1,3 +1,42 @@
+2014-09-02  Daniel Bates  <dabates@apple.com>
+
+        [iOS] Support using Foundation networking code
+        https://bugs.webkit.org/show_bug.cgi?id=136467
+
+        Reviewed by Pratik Solanki.
+
+        We should support building iOS WebKit with the Foundation networking code
+        (i.e. !USE(CFNETWORK)).
+
+        Additionally, disable USE(CFNETWORK) and use the Foundation networking code
+        by default when building iOS WebKit without the Apple Internal SDK.
+
+        * Configurations/WebCore.xcconfig: Remove file WebCoreURLResponse.mm from the list of excluded files
+        so that we compile an implementation for function WebCore::synthesizeRedirectResponseIfNecessary when
+        building without USE(CFNETWORK).
+        * WebCore.exp.in: Add symbols for WebCore::synthesizeRedirectResponseIfNecessary() and WebCore::ResourceHandleClient::willCacheResponseAsync().
+        * WebCore.xcodeproj/project.pbxproj: Add new files CFNetworkConnectionCacheSPI.h and CFURLRequestSPI.h.
+        Also move group platform/spi such that it appears in alphabetical order in the platform group.
+        * platform/cf/URLCF.cpp: Remove unnecessary header <CoreFoundation/CFPriv.h>.
+        * platform/network/ResourceHandle.h: Declare iOS-specific variant of ResourceHandle::createNSURLConnection().
+        * platform/network/ResourceHandleClient.h: Always include header <wtf/RetainPtr.h> when building for iOS.
+        (WebCore::ResourceHandleClient::connectionProperties): Add PLATFORM(IOS)-guard around declaration.
+        * platform/network/cf/ResourceRequestCFNet.cpp: Substitute header CFNetworkConnectionCacheSPI.h for
+        <CFNetwork/CFNetworkConnectionCachePriv.h>.
+        * platform/network/mac/CredentialStorageMac.mm:
+        (WebCore::CredentialStorage::saveToPersistentStorage): Use Credential::nsCredential() and ProtectionSpace::nsSpace()
+        instead of WebCore::mac(const {Credential, ProtectionSpace}&) as the latter were removed in <http://trac.webkit.org/changeset/171801>
+        and <http://trac.webkit.org/changeset/171540>, respectively.
+        * platform/network/mac/ResourceErrorMac.mm: Add USE(CFNETWORK)-guard around <CFNetwork/CFSocketStreamPriv.h>.
+        * platform/network/mac/ResourceHandleMac.mm: Substitute header CFURLRequestSPI.h for <CFNetwork/CFURLRequest.h>.
+        (WebCore::ResourceHandle::start): Modified to use ResourceHandle::makeDelegate() instead of d->m_proxy, which 
+        was removed in <http://trac.webkit.org/changeset/147476>.
+        (WebCore::ResourceHandle::platformLoadResourceSynchronously): Ditto.
+        * platform/network/mac/WebCoreURLResponse.mm:
+        (WebCore::synthesizeRedirectResponseIfNecessary): Add !USE(CFNETWORK)- and PLATFORM(IOS)- guards.
+        * platform/spi/cf/CFNetworkConnectionCacheSPI.h: Added.
+        * platform/spi/cf/CFURLRequestSPI.h: Added.
+
 2014-09-02  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Use references in public EventSender functions
index 4945598..36ddf40 100644 (file)
@@ -122,6 +122,6 @@ EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS = $(EXCLUDED_SOURCE_FILE_NAMES_FOR
 EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS_IF_ENABLED_ = JSGesture* DOMGesture*;
 
 EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME));
-EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ColorMac.mm Cursor.cpp CursorMac.mm DataTransferMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm UserAgentMac.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreURLResponse.mm WebCoreView.m WebFontCache.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WidgetMac.mm DisplayRefreshMonitorMac.cpp $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS);
+EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ColorMac.mm Cursor.cpp CursorMac.mm DataTransferMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm UserAgentMac.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreView.m WebFontCache.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WidgetMac.mm DisplayRefreshMonitorMac.cpp $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS);
 EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos);
 EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.h *IOS.cpp *IOS.mm KillRingNone.cpp WAKAppKitStubs.h WAKClipView.h WAKResponder.h WAKScrollView.h WAKView.h WAKViewPrivate.h WAKWindow.h WKContentObservation.h WKGraphics.h WKTypes.h WKUtilities.h WKView.h WKViewPrivate.h WebCoreThread.h WebCoreThreadMessage.h WebCoreThreadRun.h WebCoreThreadSystemInterface.h $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS);
index 4d10485..6d7a2d5 100644 (file)
@@ -1069,6 +1069,9 @@ __ZN7WebCore33stripLeadingAndTrailingHTMLSpacesERKN3WTF6StringE
 __ZN7WebCore36standardUserAgentWithApplicationNameERKN3WTF6StringES3_
 __ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope11moveWidgetsEv
 __ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE
+#if !USE(CFNETWORK)
+__ZN7WebCore37synthesizeRedirectResponseIfNecessaryEP15NSURLConnectionP12NSURLRequestP13NSURLResponse
+#endif
 __ZN7WebCore3URL10invalidateEv
 __ZN7WebCore3URL11setProtocolERKN3WTF6StringE
 __ZN7WebCore3URL7setPathERKN3WTF6StringE
@@ -2638,7 +2641,6 @@ __ZN7WebCore19ResourceRequestBase22setDefaultAllowCookiesEb
 __ZN7WebCore19applicationIsWebAppEv
 __ZN7WebCore19asciiLineBreakTableE
 __ZN7WebCore20PlatformEventFactory27createPlatformKeyboardEventEP8WebEvent
-__ZN7WebCore20ResourceHandleClient22willCacheResponseAsyncEPNS_14ResourceHandleEPK20_CFCachedURLResponse
 __ZN7WebCore20applicationIsOkCupidEv
 __ZN7WebCore20endOfEditableContentERKNS_15VisiblePositionE
 __ZN7WebCore20lastOffsetForEditingEPKNS_4NodeE
@@ -2827,6 +2829,10 @@ _wkIsGB18030ComplianceRequired
 _wkSetLayerContentsScale
 #endif
 
+#if PLATFORM(IOS) && USE(CFNETWORK)
+__ZN7WebCore20ResourceHandleClient22willCacheResponseAsyncEPNS_14ResourceHandleEPK20_CFCachedURLResponse
+#endif
+
 #if PLATFORM(IOS) && defined(__LP64__) && __LP64__
 __ZN7WebCore28createCGColorWithDeviceWhiteEdd
 #endif
index 773f3f3..6ac0b49 100644 (file)
                CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */; };
                CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */ = {isa = PBXBuildFile; fileRef = CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE7B2DB21586ABAD0098B3FA /* TextAlternativeWithRange.mm */; };
+               CE8245F019B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE8245EF19B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               CE8245F219B671D500AC0122 /* CFURLRequestSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE8245F119B671D500AC0122 /* CFURLRequestSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE95208A1811B475007A5392 /* WebSafeIncrementalSweeperIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C4CB1D161A131200D214DA /* WebSafeIncrementalSweeperIOS.h */; };
                CECADFC6153778FF00E37068 /* DictationAlternative.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CECADFC2153778FF00E37068 /* DictationAlternative.cpp */; };
                CECADFC7153778FF00E37068 /* DictationAlternative.h in Headers */ = {isa = PBXBuildFile; fileRef = CECADFC3153778FF00E37068 /* DictationAlternative.h */; settings = {ATTRIBUTES = (Private, ); }; };
                CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AlternativeTextUIController.mm; path = mac/AlternativeTextUIController.mm; sourceTree = "<group>"; };
                CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TextAlternativeWithRange.h; path = mac/TextAlternativeWithRange.h; sourceTree = "<group>"; };
                CE7B2DB21586ABAD0098B3FA /* TextAlternativeWithRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TextAlternativeWithRange.mm; path = mac/TextAlternativeWithRange.mm; sourceTree = "<group>"; };
+               CE8245EF19B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFNetworkConnectionCacheSPI.h; sourceTree = "<group>"; };
+               CE8245F119B671D500AC0122 /* CFURLRequestSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFURLRequestSPI.h; sourceTree = "<group>"; };
                CECADFC2153778FF00E37068 /* DictationAlternative.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictationAlternative.cpp; sourceTree = "<group>"; };
                CECADFC3153778FF00E37068 /* DictationAlternative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictationAlternative.h; sourceTree = "<group>"; };
                CECADFC4153778FF00E37068 /* DictationCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictationCommand.cpp; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                65086DA719AC1719009AF46B /* CFLocaleSPI.h */,
+                               CE8245EF19B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h */,
+                               CE8245F119B671D500AC0122 /* CFURLRequestSPI.h */,
                        );
                        path = cf;
                        sourceTree = "<group>";
                                59C77F101054591C00506104 /* mock */,
                                656B84D70AEA1CE900A095B4 /* network */,
                                516030090CC4245400C8AC25 /* posix */,
-                               1A2E6E560CC551E0004A2062 /* sql */,
                                653EF83619A043AE0052202C /* spi */,
+                               1A2E6E560CC551E0004A2062 /* sql */,
                                B2C3D9EC0D006C1D00EF6F26 /* text */,
                                49AE2D94134EE5F90072920A /* CalculationValue.cpp */,
                                49AE2D95134EE5F90072920A /* CalculationValue.h */,
                                6550B69E099DF0270090D781 /* CDATASection.h in Headers */,
                                CDDD571518B57A8200A94FCB /* CDMSession.h in Headers */,
                                5FA904CA178E61F5004C8A2D /* CertificateInfo.h in Headers */,
+                               CE8245F019B671BA00AC0122 /* CFNetworkConnectionCacheSPI.h in Headers */,
                                E1A8E56717552B2A007488E7 /* CFURLExtras.h in Headers */,
+                               CE8245F219B671D500AC0122 /* CFURLRequestSPI.h in Headers */,
                                FE36FD1516C7826500F887C1 /* ChangeVersionData.h in Headers */,
                                97BC69DD1505F076001B74AC /* ChangeVersionWrapper.h in Headers */,
                                FD315FFF12B0267600C1A359 /* ChannelMergerNode.h in Headers */,
index 5b04af5..a1faea5 100644 (file)
@@ -32,7 +32,6 @@
 
 #if PLATFORM(IOS)
 #include "RuntimeApplicationChecksIOS.h"
-#include <CoreFoundation/CFPriv.h>
 #endif
 
 namespace WebCore {
index 0eede85..7c4de7a 100644 (file)
@@ -290,10 +290,14 @@ private:
     void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior, CFDictionaryRef clientProperties);
 #endif
 
-#if PLATFORM(COCOA) && !USE(CFNETWORK)
+#if PLATFORM(MAC) && !USE(CFNETWORK)
     void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior);
 #endif
 
+#if PLATFORM(IOS) && !USE(CFNETWORK)
+    void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior, NSDictionary *connectionProperties);
+#endif
+
 #if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
 static void getConnectionTimingData(NSDictionary *timingData, ResourceLoadTiming&);
 #endif
index f1a9f71..1360968 100644 (file)
@@ -32,6 +32,9 @@
 #if USE(CFNETWORK)
 #include <CFNetwork/CFURLCachePriv.h>
 #include <CFNetwork/CFURLResponsePriv.h>
+#endif
+
+#if PLATFORM(IOS) || USE(CFNETWORK)
 #include <wtf/RetainPtr.h>
 #endif
 
@@ -115,9 +118,12 @@ namespace WebCore {
 #endif
         virtual void receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) { }
 
+#if PLATFORM(IOS)
+        virtual RetainPtr<CFDictionaryRef> connectionProperties(ResourceHandle*) { return nullptr; }
+#endif
+
 #if USE(CFNETWORK)
         virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef response) { return response; }
-        virtual RetainPtr<CFDictionaryRef> connectionProperties(ResourceHandle*) { return nullptr; }
 #if PLATFORM(WIN)
         virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) { return true; }
 #endif // PLATFORM(WIN)
index 79315c7..f2d1700 100644 (file)
 #include "FormDataStreamCFNet.h"
 #include <CFNetwork/CFURLRequestPriv.h>
 #include <wtf/text/CString.h>
-#if PLATFORM(IOS)
-#include <CFNetwork/CFNetworkConnectionCachePriv.h>
 #endif
+
+#if PLATFORM(IOS)
+#include "CFNetworkConnectionCacheSPI.h"
 #endif
 
 #if PLATFORM(COCOA)
index 39e7b4d..9ebc854 100644 (file)
@@ -45,9 +45,9 @@ void CredentialStorage::saveToPersistentStorage(const ProtectionSpace& protectio
 {
     if (credential.persistence() == CredentialPersistenceNone) {
         Credential sessionCredential(credential, CredentialPersistenceForSession);
-        [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:mac(sessionCredential) forProtectionSpace:mac(protectionSpace)];
+        [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:sessionCredential.nsCredential() forProtectionSpace:protectionSpace.nsSpace()];
     } else
-        [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:mac(credential) forProtectionSpace:mac(protectionSpace)];
+        [[NSURLCredentialStorage sharedCredentialStorage] setDefaultCredential:credential.nsCredential() forProtectionSpace:protectionSpace.nsSpace()];
 }
 #endif
 
index bd28c8a..9b65de8 100644 (file)
@@ -31,9 +31,8 @@
 #import <CoreFoundation/CFError.h>
 #import <Foundation/Foundation.h>
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) && USE(CFNETWORK)
 #import <CFNetwork/CFSocketStreamPriv.h>
-#import <Foundation/NSURLError.h>
 #endif
 
 @interface NSError (WebExtras)
index 5a769dc..545bb1e 100644 (file)
@@ -75,8 +75,7 @@ CFDictionaryRef _CFURLConnectionCopyTimingData(CFURLConnectionRef);
 #endif
 
 #if PLATFORM(IOS)
-#import <CFNetwork/CFURLRequest.h>
-
+#import "CFURLRequestSPI.h"
 #import "RuntimeApplicationChecksIOS.h"
 #import "WebCoreThreadRun.h"
 
@@ -106,6 +105,7 @@ static void applyBasicAuthorizationHeader(ResourceRequest& request, const Creden
     request.setHTTPHeaderField(HTTPHeaderName::Authorization, authenticationHeader);
 }
 
+#if !PLATFORM(IOS)
 static NSOperationQueue *operationQueueForAsyncClients()
 {
     static NSOperationQueue *queue;
@@ -116,6 +116,7 @@ static NSOperationQueue *operationQueueForAsyncClients()
     }
     return queue;
 }
+#endif
 
 ResourceHandleInternal::~ResourceHandleInternal()
 {
@@ -252,11 +253,11 @@ bool ResourceHandle::start()
         SchedulingBehavior::Asynchronous);
 #else
     createNSURLConnection(
-        d->m_proxy.get(),
+        ResourceHandle::makeDelegate(shouldUseCredentialStorage),
         shouldUseCredentialStorage,
         d->m_shouldContentSniff || d->m_context->localFileContentSniffingEnabled(),
         SchedulingBehavior::Asynchronous,
-        (NSDictionary *)client()->connectionProperties(this));
+        (NSDictionary *)client()->connectionProperties(this).get());
 #endif
 
 #if PLATFORM(IOS)
@@ -409,8 +410,8 @@ void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* contex
         return;
     }
 
-#if !PLATFORM(IOS)
     bool shouldUseCredentialStorage = storedCredentials == AllowStoredCredentials;
+#if !PLATFORM(IOS)
     handle->createNSURLConnection(
         handle->makeDelegate(shouldUseCredentialStorage),
         shouldUseCredentialStorage,
@@ -418,11 +419,11 @@ void ResourceHandle::platformLoadResourceSynchronously(NetworkingContext* contex
         SchedulingBehavior::Synchronous);
 #else
     handle->createNSURLConnection(
-        handle->delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
-        storedCredentials == AllowStoredCredentials,
+        handle->makeDelegate(shouldUseCredentialStorage), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
+        shouldUseCredentialStorage,
         handle->shouldContentSniff() || (context && context->localFileContentSniffingEnabled()),
         SchedulingBehavior::Synchronous,
-        (NSDictionary *)handle->client()->connectionProperties(handle.get()));
+        (NSDictionary *)handle->client()->connectionProperties(handle.get()).get());
 #endif
 
     [handle->connection() scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:(NSString *)synchronousLoadRunLoopMode()];
index 9157853..971beb5 100644 (file)
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 
+#if PLATFORM(MAC)
 // <rdar://problem/7007389> CoreTypes UTI map is missing 100+ file extensions that GateKeeper knew about
 // When we disabled content sniffing for file URLs we caused problems with these 100+ extensions that CoreTypes
 // doesn't know about.
@@ -322,10 +323,12 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
     if (result != originalResult)
         wkSetCFURLResponseMIMEType(cfResponse, result.get());
 }
+#endif
 
+#if !USE(CFNETWORK)
 NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLConnection *connection, NSURLRequest *newRequest, NSURLResponse *redirectResponse)
 {
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     if (redirectResponse)
         return redirectResponse;
 
@@ -342,5 +345,6 @@ NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLConnection *connection
     return redirectResponse;
 #endif
 }
+#endif
 
 }
diff --git a/Source/WebCore/platform/spi/cf/CFNetworkConnectionCacheSPI.h b/Source/WebCore/platform/spi/cf/CFNetworkConnectionCacheSPI.h
new file mode 100644 (file)
index 0000000..ce29135
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef CFNetworkConnectionCacheSPI_h
+#define CFNetworkConnectionCacheSPI_h
+
+#if USE(APPLE_INTERNAL_SDK)
+#include <CFNetwork/CFNetworkConnectionCachePriv.h>
+#else
+enum HTTPConnectionCacheLimitKeys {
+    kHTTPNumFastLanes = 4,
+};
+#endif
+
+extern "C" void _CFNetworkHTTPConnectionCacheSetLimit(HTTPConnectionCacheLimitKeys, int);
+
+#endif
diff --git a/Source/WebCore/platform/spi/cf/CFURLRequestSPI.h b/Source/WebCore/platform/spi/cf/CFURLRequestSPI.h
new file mode 100644 (file)
index 0000000..027ee6a
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2014 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef CFURLRequestSPI_h
+#define CFURLRequestSPI_h
+
+#if USE(APPLE_INTERNAL_SDK)
+#include <CFNetwork/CFURLRequest.h>
+#else
+#include <CoreFoundation/CFBase.h>
+typedef const struct _CFURLRequest *CFURLRequestRef;
+#endif
+
+extern "C" void CFURLRequestSetShouldStartSynchronously(CFURLRequestRef, Boolean);
+
+#endif