Revert r207151
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Oct 2016 06:05:26 +0000 (06:05 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Oct 2016 06:05:26 +0000 (06:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163675

Reviewed by Brent Fulgham.

.:

* Source/cmake/OptionsAppleWin.cmake:

Source/WebCore:

This code is still useful for comparison with Windows.  I'll remove it again soon.

No new tests.  No change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* WebCorePrefix.h:
* loader/DocumentLoader.h:
* loader/EmptyClients.h:
* loader/FrameLoaderClient.h:
* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
* loader/ResourceLoader.h:
* loader/SubresourceLoader.h:
* loader/cf/ResourceLoaderCFNet.cpp:
* loader/cocoa/SubresourceLoaderCocoa.mm:
(WebCore::SubresourceLoader::willCacheResponse):
* loader/mac/DocumentLoaderMac.cpp:
* loader/mac/ResourceLoaderMac.mm:
(WebCore::ResourceLoader::willCacheResponse):
* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize):
(WebCore::Page::addSchedulePair):
(WebCore::Page::removeSchedulePair):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::WebCoreNSURLAuthenticationChallengeClient::create):
(WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient):
(WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
* platform/mac/WebCoreSystemInterface.h:
* platform/network/NetworkStorageSession.h:
* platform/network/ProtectionSpace.h:
* platform/network/ProtectionSpaceBase.cpp:
* platform/network/ResourceHandle.cpp:
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleClient.cpp:
* platform/network/ResourceHandleClient.h:
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/ResourceRequestBase.cpp:
* platform/network/cf/AuthenticationCF.cpp:
(WebCore::AuthenticationChallenge::AuthenticationChallenge):
(WebCore::AuthenticationChallenge::setAuthenticationClient): Deleted.
(WebCore::AuthenticationChallenge::authenticationClient): Deleted.
(WebCore::AuthenticationChallenge::platformCompare): Deleted.
(WebCore::createCF): Deleted.
(WebCore::core): Deleted.
* platform/network/cf/AuthenticationCF.h:
* platform/network/cf/AuthenticationChallenge.h:
* platform/network/cf/CookieJarCFNet.cpp:
* platform/network/cf/CredentialStorageCFNet.cpp:
(WebCore::CredentialStorage::getFromPersistentStorage):
(WebCore::CredentialStorage::saveToPersistentStorage):
* platform/network/cf/LoaderRunLoopCF.cpp:
* platform/network/cf/LoaderRunLoopCF.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp:
(WebCore::NetworkStorageSession::cookieStorage):
* platform/network/cf/ProtectionSpaceCFNet.cpp:
* platform/network/cf/ProtectionSpaceCFNet.h:
* platform/network/cf/ResourceError.h:
* platform/network/cf/ResourceErrorCF.cpp:
* platform/network/cf/ResourceHandleCFNet.cpp:
(WebCore::shouldSniffConnectionProperty):
(WebCore::ResourceHandle::createCFURLConnection):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
(WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
(WebCore::ResourceHandle::receivedCredential):
(WebCore::ResourceHandle::schedule):
(WebCore::ResourceHandle::unschedule):
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
* platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
(WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
* platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::encodingRequiresPlatformData):
* platform/network/cf/ResourceRequestCFNet.cpp:
(WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction):
(WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
(WebCore::ResourceRequest::doUpdatePlatformRequest):
(WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
(WebCore::ResourceRequest::doUpdateResourceRequest):
(WebCore::ResourceRequest::setStorageSession):
* platform/network/cf/ResourceRequestCFNet.h:
* platform/network/cf/ResourceResponse.h:
* platform/network/cf/ResourceResponseCFNet.cpp:
(WebCore::ResourceResponse::cfURLResponse):
* platform/network/cf/SynchronousLoaderClientCFNet.cpp:
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse):
(WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
* platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
* platform/network/cocoa/CredentialCocoa.h:
* platform/network/cocoa/CredentialCocoa.mm:
(WebCore::Credential::Credential):
(WebCore::Credential::cfCredential):
* platform/network/cocoa/ProtectionSpaceCocoa.h:
* platform/network/cocoa/ProtectionSpaceCocoa.mm:
(WebCore::ProtectionSpace::ProtectionSpace):
(WebCore::ProtectionSpace::cfSpace):
* platform/network/cocoa/ResourceRequestCocoa.mm:
(WebCore::ResourceRequest::nsURLRequest):
* platform/network/cocoa/ResourceResponseCocoa.mm:
(WebCore::ResourceResponse::platformCertificateInfo):
(WebCore::ResourceResponse::nsURLResponse):
(WebCore::ResourceResponse::ResourceResponse):
* platform/network/ios/QuickLook.h:
* platform/network/ios/QuickLook.mm:
(-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]):
(-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]):
(-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]):
(-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]):
(-[WebQuickLookHandleAsDelegate connection:didFailWithError:]):
(-[WebQuickLookHandleAsDelegate detachHandle]):
(WebCore::QuickLookHandle::create):
(WebCore::QuickLookHandle::cfResponse):
* platform/network/mac/AuthenticationMac.mm:
(-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]):
(-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]):
(WebCore::core):
(WebCore::mac):
* platform/network/mac/CookieJarMac.mm:
(WebCore::setCookiesFromDOM):
(WebCore::addCookie):
(WebCore::cookieStorage):
* platform/network/mac/CredentialStorageMac.mm:
* platform/network/mac/FormDataStreamMac.h:
* platform/network/mac/FormDataStreamMac.mm:
* platform/network/mac/ResourceErrorMac.mm:
(NSErrorFromCFError):
(WebCore::ResourceError::ResourceError):
(WebCore::ResourceError::nsError):
(WebCore::ResourceError::operator NSError *):
* platform/network/mac/ResourceHandleMac.mm:
(WebCore::ResourceHandle::getConnectionTimingData):
* platform/network/mac/ResourceRequestMac.mm: Added.
(WebCore::ResourceRequest::ResourceRequest):
(WebCore::ResourceRequest::updateNSURLRequest):
* platform/network/mac/SynchronousLoaderClient.mm:
* platform/network/mac/WebCoreResourceHandleAsDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
* platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
* platform/network/mac/WebCoreURLResponse.mm:
* platform/win/TemporaryLinkStubs.cpp:
* testing/js/WebCoreTestSupportPrefix.h:

Source/WebKit:

* WebCoreSupport/WebResourceLoadScheduler.cpp:
(WebResourceLoadScheduler::scheduleLoad):

Source/WebKit/mac:

* Misc/WebDownload.mm:
(-[WebDownload _initWithLoadingCFURLConnection:request:response:delegate:proxy:]):
* Misc/WebDownloadInternal.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::convertMainResourceLoadToDownload):
* WebView/WebPreferences.mm:
(+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]):
* WebView/WebView.mm:
(-[WebView scheduleInRunLoop:forMode:]):
(-[WebView unscheduleFromRunLoop:forMode:]):

Source/WebKit/win:

* DefaultDownloadDelegate.h:
* WebCoreSupport/WebFrameLoaderClient.cpp:
(WebFrameLoaderClient::savePlatformDataToCachedFrame):
* WebCoreSupport/WebFrameNetworkingContext.cpp:
(WebFrameNetworkingContext::ensurePrivateBrowsingSession):
* WebCoreSupport/WebFrameNetworkingContext.h:
* WebCoreSupport/WebPlatformStrategies.cpp:
* WebDownload.h:
* WebError.cpp:
(WebError::localizedDescription):
(WebError::sslPeerCertificate):
* WebError.h:
* WebMutableURLRequest.cpp:
(WebMutableURLRequest::mutableCopy):
* WebURLAuthenticationChallenge.cpp:
(WebURLAuthenticationChallenge::initWithProtectionSpace):
(WebURLAuthenticationChallenge::initWithAuthenticationChallenge):
* WebURLResponse.cpp:
(WebURLResponse::sslPeerCertificate):
* WebURLResponse.h:
* WebView.cpp:
(WebView::setCacheModel):
(WebView::canHandleRequest):
(WebView::notifyPreferencesChanged):
(updateSharedSettingsFromPreferencesIfNeeded):

Source/WebKit2:

* NetworkProcess/Downloads/Download.h:
* NetworkProcess/Downloads/mac/DownloadMac.mm:
* NetworkProcess/NetworkLoad.h:
* NetworkProcess/mac/NetworkLoadMac.mm:
(WebKit::NetworkLoad::willCacheResponseAsync):
* Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
(WebKit::AuthenticationManager::receivedCredential):
(WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
(WebKit::AuthenticationManager::receivedCancellation):
(WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
(WebKit::AuthenticationManager::receivedChallengeRejection):
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* Shared/mac/WebCoreArgumentCodersMac.mm:
(IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
(IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
* WebKit2.xcodeproj/project.pbxproj:

Source/WTF:

* wtf/Platform.h:
* wtf/SchedulePair.h:
* wtf/SchedulePairMac.mm:

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

82 files changed:
ChangeLog
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WTF/wtf/SchedulePair.h
Source/WTF/wtf/SchedulePairMac.mm
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/WebCorePrefix.h
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/EmptyClients.h
Source/WebCore/loader/FrameLoaderClient.h
Source/WebCore/loader/ResourceLoader.cpp
Source/WebCore/loader/ResourceLoader.h
Source/WebCore/loader/SubresourceLoader.h
Source/WebCore/loader/cf/ResourceLoaderCFNet.cpp
Source/WebCore/loader/cocoa/SubresourceLoaderCocoa.mm
Source/WebCore/loader/mac/DocumentLoaderMac.cpp
Source/WebCore/loader/mac/ResourceLoaderMac.mm
Source/WebCore/page/mac/PageMac.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/mac/WebCoreSystemInterface.h
Source/WebCore/platform/network/ProtectionSpaceBase.cpp
Source/WebCore/platform/network/ResourceHandle.h
Source/WebCore/platform/network/ResourceHandleClient.h
Source/WebCore/platform/network/ResourceHandleInternal.h
Source/WebCore/platform/network/ResourceRequestBase.cpp
Source/WebCore/platform/network/cf/AuthenticationCF.cpp
Source/WebCore/platform/network/cf/AuthenticationCF.h
Source/WebCore/platform/network/cf/CredentialStorageCFNet.cpp
Source/WebCore/platform/network/cf/ResourceError.h
Source/WebCore/platform/network/cf/ResourceErrorCF.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp
Source/WebCore/platform/network/cf/ResourceRequest.h
Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp
Source/WebCore/platform/network/cf/ResourceResponse.h
Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp
Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp
Source/WebCore/platform/network/cocoa/CredentialCocoa.h
Source/WebCore/platform/network/cocoa/CredentialCocoa.mm
Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.h
Source/WebCore/platform/network/cocoa/ProtectionSpaceCocoa.mm
Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm
Source/WebCore/platform/network/cocoa/ResourceResponseCocoa.mm
Source/WebCore/platform/network/ios/QuickLook.h
Source/WebCore/platform/network/ios/QuickLook.mm
Source/WebCore/platform/network/ios/ResourceHandleIOS.mm [new file with mode: 0644]
Source/WebCore/platform/network/ios/ResourceRequestIOS.mm [new file with mode: 0644]
Source/WebCore/platform/network/mac/AuthenticationMac.mm
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebCore/platform/network/mac/CredentialStorageMac.mm
Source/WebCore/platform/network/mac/FormDataStreamMac.h
Source/WebCore/platform/network/mac/FormDataStreamMac.mm
Source/WebCore/platform/network/mac/ResourceErrorMac.mm
Source/WebCore/platform/network/mac/ResourceHandleMac.mm
Source/WebCore/platform/network/mac/ResourceRequestMac.mm [new file with mode: 0644]
Source/WebCore/platform/network/mac/SynchronousLoaderClient.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.h
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsDelegate.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
Source/WebCore/platform/network/mac/WebCoreURLResponse.mm
Source/WebKit/ChangeLog
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/Misc/WebDownload.mm
Source/WebKit/mac/Misc/WebDownloadInternal.h
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/Downloads/Download.h
Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm
Source/WebKit2/NetworkProcess/NetworkLoad.h
Source/WebKit2/NetworkProcess/mac/NetworkLoadMac.mm
Source/WebKit2/Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/Shared/mac/WebCoreArgumentCodersMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj

index 9c6efa4..a958f92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        * Source/cmake/OptionsAppleWin.cmake:
+
 2016-10-18  Dean Jackson  <dino@apple.com>
 
         Remove CSS_SHAPES feature definition. This should always be on.
index 272a86e..494e9f2 100644 (file)
@@ -1,3 +1,14 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        * wtf/Platform.h:
+        * wtf/SchedulePair.h:
+        * wtf/SchedulePairMac.mm:
+
 2016-10-19  Filip Pizlo  <fpizlo@apple.com>
 
         REGRESSION (r207480): 3 Dromaeo tests failing
index 790e837..2491640 100644 (file)
 
 #if PLATFORM(IOS)
 
+#if USE(APPLE_INTERNAL_SDK) && __IPHONE_OS_VERSION_MIN_REQUIRED < 100000
+#define USE_CFURLCONNECTION 1
+#endif
+
 #define HAVE_NETWORK_EXTENSION 1
 #define HAVE_READLINE 1
 #define USE_UIKIT_EDITING 1
index 8be9cf4..cca9711 100644 (file)
@@ -35,7 +35,7 @@
 #include <wtf/text/StringHash.h>
 #include <wtf/text/WTFString.h>
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
 OBJC_CLASS NSRunLoop;
 #endif
 
@@ -45,7 +45,7 @@ class SchedulePair : public ThreadSafeRefCounted<SchedulePair> {
 public:
     static Ref<SchedulePair> create(CFRunLoopRef runLoop, CFStringRef mode) { return adoptRef(*new SchedulePair(runLoop, mode)); }
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     static Ref<SchedulePair> create(NSRunLoop* runLoop, CFStringRef mode) { return adoptRef(*new SchedulePair(runLoop, mode)); }
     NSRunLoop* nsRunLoop() const { return m_nsRunLoop.get(); }
 #endif
@@ -63,7 +63,7 @@ private:
             m_mode = adoptCF(CFStringCreateCopy(0, mode));
     }
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     WTF_EXPORT_PRIVATE SchedulePair(NSRunLoop*, CFStringRef);
     RetainPtr<NSRunLoop*> m_nsRunLoop;
 #endif
index f7f48ed..24d5577 100644 (file)
@@ -29,6 +29,8 @@
 #include "config.h"
 #include "SchedulePair.h"
 
+#if !USE(CFURLCONNECTION)
+
 namespace WTF {
 
 SchedulePair::SchedulePair(NSRunLoop* runLoop, CFStringRef mode)
@@ -40,3 +42,5 @@ SchedulePair::SchedulePair(NSRunLoop* runLoop, CFStringRef mode)
 }
 
 } // namespace
+
+#endif
index e5b7254..e5a1da3 100644 (file)
@@ -1,3 +1,161 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        This code is still useful for comparison with Windows.  I'll remove it again soon.
+
+        No new tests.  No change in behavior.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * WebCorePrefix.h:
+        * loader/DocumentLoader.h:
+        * loader/EmptyClients.h:
+        * loader/FrameLoaderClient.h:
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
+        * loader/ResourceLoader.h:
+        * loader/SubresourceLoader.h:
+        * loader/cf/ResourceLoaderCFNet.cpp:
+        * loader/cocoa/SubresourceLoaderCocoa.mm:
+        (WebCore::SubresourceLoader::willCacheResponse):
+        * loader/mac/DocumentLoaderMac.cpp:
+        * loader/mac/ResourceLoaderMac.mm:
+        (WebCore::ResourceLoader::willCacheResponse):
+        * page/mac/PageMac.mm:
+        (WebCore::Page::platformInitialize):
+        (WebCore::Page::addSchedulePair):
+        (WebCore::Page::removeSchedulePair):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::WebCoreNSURLAuthenticationChallengeClient::create):
+        (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient):
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/network/NetworkStorageSession.h:
+        * platform/network/ProtectionSpace.h:
+        * platform/network/ProtectionSpaceBase.cpp:
+        * platform/network/ResourceHandle.cpp:
+        * platform/network/ResourceHandle.h:
+        * platform/network/ResourceHandleClient.cpp:
+        * platform/network/ResourceHandleClient.h:
+        * platform/network/ResourceHandleInternal.h:
+        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+        * platform/network/ResourceRequestBase.cpp:
+        * platform/network/cf/AuthenticationCF.cpp:
+        (WebCore::AuthenticationChallenge::AuthenticationChallenge):
+        (WebCore::AuthenticationChallenge::setAuthenticationClient): Deleted.
+        (WebCore::AuthenticationChallenge::authenticationClient): Deleted.
+        (WebCore::AuthenticationChallenge::platformCompare): Deleted.
+        (WebCore::createCF): Deleted.
+        (WebCore::core): Deleted.
+        * platform/network/cf/AuthenticationCF.h:
+        * platform/network/cf/AuthenticationChallenge.h:
+        * platform/network/cf/CookieJarCFNet.cpp:
+        * platform/network/cf/CredentialStorageCFNet.cpp:
+        (WebCore::CredentialStorage::getFromPersistentStorage):
+        (WebCore::CredentialStorage::saveToPersistentStorage):
+        * platform/network/cf/LoaderRunLoopCF.cpp:
+        * platform/network/cf/LoaderRunLoopCF.h:
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+        (WebCore::NetworkStorageSession::cookieStorage):
+        * platform/network/cf/ProtectionSpaceCFNet.cpp:
+        * platform/network/cf/ProtectionSpaceCFNet.h:
+        * platform/network/cf/ResourceError.h:
+        * platform/network/cf/ResourceErrorCF.cpp:
+        * platform/network/cf/ResourceHandleCFNet.cpp:
+        (WebCore::shouldSniffConnectionProperty):
+        (WebCore::ResourceHandle::createCFURLConnection):
+        (WebCore::ResourceHandle::start):
+        (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
+        (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
+        (WebCore::ResourceHandle::receivedCredential):
+        (WebCore::ResourceHandle::schedule):
+        (WebCore::ResourceHandle::unschedule):
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
+        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
+        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
+        (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
+        * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
+        * platform/network/cf/ResourceRequest.h:
+        (WebCore::ResourceRequest::encodingRequiresPlatformData):
+        * platform/network/cf/ResourceRequestCFNet.cpp:
+        (WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction):
+        (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
+        (WebCore::ResourceRequest::doUpdatePlatformRequest):
+        (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
+        (WebCore::ResourceRequest::doUpdateResourceRequest):
+        (WebCore::ResourceRequest::setStorageSession):
+        * platform/network/cf/ResourceRequestCFNet.h:
+        * platform/network/cf/ResourceResponse.h:
+        * platform/network/cf/ResourceResponseCFNet.cpp:
+        (WebCore::ResourceResponse::cfURLResponse):
+        * platform/network/cf/SynchronousLoaderClientCFNet.cpp:
+        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse):
+        (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
+        * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
+        * platform/network/cocoa/CredentialCocoa.h:
+        * platform/network/cocoa/CredentialCocoa.mm:
+        (WebCore::Credential::Credential):
+        (WebCore::Credential::cfCredential):
+        * platform/network/cocoa/ProtectionSpaceCocoa.h:
+        * platform/network/cocoa/ProtectionSpaceCocoa.mm:
+        (WebCore::ProtectionSpace::ProtectionSpace):
+        (WebCore::ProtectionSpace::cfSpace):
+        * platform/network/cocoa/ResourceRequestCocoa.mm:
+        (WebCore::ResourceRequest::nsURLRequest):
+        * platform/network/cocoa/ResourceResponseCocoa.mm:
+        (WebCore::ResourceResponse::platformCertificateInfo):
+        (WebCore::ResourceResponse::nsURLResponse):
+        (WebCore::ResourceResponse::ResourceResponse):
+        * platform/network/ios/QuickLook.h:
+        * platform/network/ios/QuickLook.mm:
+        (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]):
+        (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]):
+        (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]):
+        (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]):
+        (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]):
+        (-[WebQuickLookHandleAsDelegate detachHandle]):
+        (WebCore::QuickLookHandle::create):
+        (WebCore::QuickLookHandle::cfResponse):
+        * platform/network/mac/AuthenticationMac.mm:
+        (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]):
+        (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]):
+        (WebCore::core):
+        (WebCore::mac):
+        * platform/network/mac/CookieJarMac.mm:
+        (WebCore::setCookiesFromDOM):
+        (WebCore::addCookie):
+        (WebCore::cookieStorage):
+        * platform/network/mac/CredentialStorageMac.mm:
+        * platform/network/mac/FormDataStreamMac.h:
+        * platform/network/mac/FormDataStreamMac.mm:
+        * platform/network/mac/ResourceErrorMac.mm:
+        (NSErrorFromCFError):
+        (WebCore::ResourceError::ResourceError):
+        (WebCore::ResourceError::nsError):
+        (WebCore::ResourceError::operator NSError *):
+        * platform/network/mac/ResourceHandleMac.mm:
+        (WebCore::ResourceHandle::getConnectionTimingData):
+        * platform/network/mac/ResourceRequestMac.mm: Added.
+        (WebCore::ResourceRequest::ResourceRequest):
+        (WebCore::ResourceRequest::updateNSURLRequest):
+        * platform/network/mac/SynchronousLoaderClient.mm:
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.h:
+        * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
+        * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
+        * platform/network/mac/WebCoreURLResponse.mm:
+        * platform/win/TemporaryLinkStubs.cpp:
+        * testing/js/WebCoreTestSupportPrefix.h:
+
 2016-10-19  Jer Noble  <jer.noble@apple.com>
 
         REGRESSION (r206025): All YouTube videos play with black bars on all four sides
index ab49bb5..33b19ff 100644 (file)
                514C764F0CE9234E007EF3CD /* FormDataStreamMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */; };
                514C76500CE9234E007EF3CD /* ResourceErrorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */; };
                514C76510CE9234E007EF3CD /* ResourceHandleMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */; };
+               514C76530CE9234E007EF3CD /* ResourceRequestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */; };
                514C766D0CE923A1007EF3CD /* CredentialBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76580CE923A1007EF3CD /* CredentialBase.cpp */; };
                514C766E0CE923A1007EF3CD /* Credential.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76590CE923A1007EF3CD /* Credential.h */; settings = {ATTRIBUTES = (Private, ); }; };
                514C766F0CE923A1007EF3CD /* FormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C765A0CE923A1007EF3CD /* FormData.cpp */; };
                7D4C96DD1AD4483500365A50 /* JSFetchHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */; };
                7D741BDA177226AA00859170 /* CSSValueKeywords.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 6565814809D13043000E61D7 /* CSSValueKeywords.h */; };
                7E37EF2E1339208800B29250 /* SubresourceLoaderCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */; };
+               7E428CE513E3407F003B661C /* ResourceHandleIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */; };
                7E46F6FA1627A2CA00062223 /* JSOESElementIndexUint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */; };
                7E46F6FB1627A2CA00062223 /* JSOESElementIndexUint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E46F6F91627A2C900062223 /* JSOESElementIndexUint.h */; };
                7E474E1E12494DC900235364 /* SQLiteDatabaseTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7E66E23416D6EB6C00F7E7FF /* WebGLCompressedTextureATC.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E66E23216D6EB6C00F7E7FF /* WebGLCompressedTextureATC.h */; };
                7E66E23417E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E66E23217E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.h */; };
                7E7DE1FD195CEF260035363B /* ResourceRequestCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */; };
+               7E7DE202195CEFCD0035363B /* ResourceRequestIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */; };
                7E8FADC4199A95B100714968 /* SubresourceLoaderCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7E8FADC3199A95B100714968 /* SubresourceLoaderCocoa.mm */; };
                7E99AF510B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */; };
                7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6846912D26E3800E79415 /* LoaderRunLoopCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845612D26E3800E79415 /* LoaderRunLoopCF.h */; };
                7EE6846A12D26E3800E79415 /* ResourceError.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845712D26E3800E79415 /* ResourceError.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6846B12D26E3800E79415 /* ResourceErrorCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845812D26E3800E79415 /* ResourceErrorCF.cpp */; };
+               7EE6846C12D26E3800E79415 /* ResourceHandleCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845912D26E3800E79415 /* ResourceHandleCFNet.cpp */; };
                7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845A12D26E3800E79415 /* ResourceRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7EE6846E12D26E3800E79415 /* ResourceRequestCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7EE6845B12D26E3800E79415 /* ResourceRequestCFNet.cpp */; };
                7EE6846F12D26E3800E79415 /* ResourceRequestCFNet.h in Headers */ = {isa = PBXBuildFile; fileRef = 7EE6845C12D26E3800E79415 /* ResourceRequestCFNet.h */; settings = {ATTRIBUTES = (Private, ); }; };
                514C76450CE9234E007EF3CD /* FormDataStreamMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FormDataStreamMac.mm; sourceTree = "<group>"; };
                514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceErrorMac.mm; sourceTree = "<group>"; };
                514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleMac.mm; sourceTree = "<group>"; };
+               514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestMac.mm; sourceTree = "<group>"; };
                514C76580CE923A1007EF3CD /* CredentialBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CredentialBase.cpp; sourceTree = "<group>"; };
                514C76590CE923A1007EF3CD /* Credential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Credential.h; sourceTree = "<group>"; };
                514C765A0CE923A1007EF3CD /* FormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormData.cpp; sourceTree = "<group>"; };
                7D4C96D81AD4483500365A50 /* JSFetchHeaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFetchHeaders.cpp; sourceTree = "<group>"; };
                7D4C96D91AD4483500365A50 /* JSFetchHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFetchHeaders.h; sourceTree = "<group>"; };
                7E37EF2D1339208800B29250 /* SubresourceLoaderCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoaderCF.cpp; sourceTree = "<group>"; };
+               7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceHandleIOS.mm; sourceTree = "<group>"; };
                7E46F6F81627A2C900062223 /* JSOESElementIndexUint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESElementIndexUint.cpp; sourceTree = "<group>"; };
                7E46F6F91627A2C900062223 /* JSOESElementIndexUint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESElementIndexUint.h; sourceTree = "<group>"; };
                7E474E1B12494DC900235364 /* SQLiteDatabaseTrackerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteDatabaseTrackerClient.h; sourceTree = "<group>"; };
                7E66E23216D6EB6C00F7E7FF /* WebGLCompressedTextureATC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLCompressedTextureATC.h; sourceTree = "<group>"; };
                7E66E23217E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLCompressedTexturePVRTC.h; sourceTree = "<group>"; };
                7E7DE1FC195CEF260035363B /* ResourceRequestCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestCocoa.mm; sourceTree = "<group>"; };
+               7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceRequestIOS.mm; sourceTree = "<group>"; };
                7E8FADC3199A95B100714968 /* SubresourceLoaderCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SubresourceLoaderCocoa.mm; sourceTree = "<group>"; };
                7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowFocusAllowedIndicator.cpp; sourceTree = "<group>"; };
                7E99AF540B13846468FB01A5 /* WindowFocusAllowedIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowFocusAllowedIndicator.h; sourceTree = "<group>"; };
                7EE6845612D26E3800E79415 /* LoaderRunLoopCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoaderRunLoopCF.h; sourceTree = "<group>"; };
                7EE6845712D26E3800E79415 /* ResourceError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceError.h; sourceTree = "<group>"; };
                7EE6845812D26E3800E79415 /* ResourceErrorCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceErrorCF.cpp; sourceTree = "<group>"; };
+               7EE6845912D26E3800E79415 /* ResourceHandleCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceHandleCFNet.cpp; sourceTree = "<group>"; };
                7EE6845A12D26E3800E79415 /* ResourceRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceRequest.h; sourceTree = "<group>"; };
                7EE6845B12D26E3800E79415 /* ResourceRequestCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceRequestCFNet.cpp; sourceTree = "<group>"; };
                7EE6845C12D26E3800E79415 /* ResourceRequestCFNet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceRequestCFNet.h; sourceTree = "<group>"; };
                                442AF7A7102CDDEA008FD4D3 /* QuickLook.h */,
                                442AF7A8102CDDEA008FD4D3 /* QuickLook.mm */,
                                A10DBF4618F92317000D70C6 /* QuickLookHandleClient.h */,
+                               7E428CE413E3407F003B661C /* ResourceHandleIOS.mm */,
+                               7E7DE201195CEFCD0035363B /* ResourceRequestIOS.mm */,
                                44A20DB80F84166C00B3E1FE /* WebCoreURLResponseIOS.h */,
                                444D4E210F708B2E003158E0 /* WebCoreURLResponseIOS.mm */,
                        );
                                1A7FA6470DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp */,
                                514C76460CE9234E007EF3CD /* ResourceErrorMac.mm */,
                                514C76470CE9234E007EF3CD /* ResourceHandleMac.mm */,
+                               514C76490CE9234E007EF3CD /* ResourceRequestMac.mm */,
                                E180811416FCF9CB00B80D07 /* SynchronousLoaderClient.mm */,
                                1FAFBF1615A5FA5200083A20 /* UTIUtilities.h */,
                                1FAFBF1715A5FA5200083A20 /* UTIUtilities.mm */,
                                1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */,
                                7EE6845712D26E3800E79415 /* ResourceError.h */,
                                7EE6845812D26E3800E79415 /* ResourceErrorCF.cpp */,
+                               7EE6845912D26E3800E79415 /* ResourceHandleCFNet.cpp */,
                                26FAE4C81852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp */,
                                26FAE4C91852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.h */,
                                26C15CF41857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp */,
                                7EE6846B12D26E3800E79415 /* ResourceErrorCF.cpp in Sources */,
                                514C76500CE9234E007EF3CD /* ResourceErrorMac.mm in Sources */,
                                514C76780CE923A1007EF3CD /* ResourceHandle.cpp in Sources */,
+                               7EE6846C12D26E3800E79415 /* ResourceHandleCFNet.cpp in Sources */,
                                26FAE4CC1852E3A5004C8C46 /* ResourceHandleCFURLConnectionDelegate.cpp in Sources */,
                                26C15CF61857E15D00F15C03 /* ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp in Sources */,
                                E1BA003116FB92AC00BA7A35 /* ResourceHandleClient.cpp in Sources */,
+                               7E428CE513E3407F003B661C /* ResourceHandleIOS.mm in Sources */,
                                514C76510CE9234E007EF3CD /* ResourceHandleMac.mm in Sources */,
                                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
                                7EE6847512D26E7000E79415 /* ResourceLoaderCFNet.cpp in Sources */,
                                514C767C0CE923A1007EF3CD /* ResourceRequestBase.cpp in Sources */,
                                7EE6846E12D26E3800E79415 /* ResourceRequestCFNet.cpp in Sources */,
                                7E7DE1FD195CEF260035363B /* ResourceRequestCocoa.mm in Sources */,
+                               7E7DE202195CEFCD0035363B /* ResourceRequestIOS.mm in Sources */,
+                               514C76530CE9234E007EF3CD /* ResourceRequestMac.mm in Sources */,
                                514C767E0CE923A1007EF3CD /* ResourceResponseBase.cpp in Sources */,
                                7EE6847112D26E3800E79415 /* ResourceResponseCFNet.cpp in Sources */,
                                A1F78D0C1C25424C00245446 /* ResourceResponseCocoa.mm in Sources */,
index 68d7d87..a427e04 100644 (file)
 #endif
 
 #include <windows.h>
-
-#elif !PLATFORM(IOS)
-
+#else
+#if !PLATFORM(IOS)
 #include <CoreServices/CoreServices.h>
-
-#endif
-
+#endif // !PLATFORM(IOS)
+#endif // OS(WINDOWS)
 
 #endif
 
index 88adebb..e98629e 100644 (file)
@@ -55,7 +55,7 @@
 #include "QuickLook.h"
 #endif
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
 #include <wtf/SchedulePair.h>
 #endif
 
@@ -145,7 +145,7 @@ namespace WebCore {
         WEBCORE_EXPORT void setTitle(const StringWithDirection&);
         const String& overrideEncoding() const { return m_overrideEncoding; }
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
         void schedule(SchedulePair&);
         void unschedule(SchedulePair&);
 #endif
index 93697d8..660b12f 100644 (file)
@@ -403,7 +403,7 @@ public:
     RemoteAXObjectRef accessibilityRemoteObject() override { return nullptr; }
     NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long, NSCachedURLResponse* response) const override { return response; }
 #endif
-#if USE(CFURLCONNECTION)
+#if PLATFORM(WIN) && USE(CFURLCONNECTION)
     // FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>.
     bool shouldCacheResponse(DocumentLoader*, unsigned long, const ResourceResponse&, const unsigned char*, unsigned long long) override { return true; }
 #endif
index 0b36b46..1ccb235 100644 (file)
@@ -297,7 +297,7 @@ namespace WebCore {
         virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse*) const = 0;
         virtual NSDictionary *dataDetectionContext() { return nullptr; }
 #endif
-#if USE(CFURLCONNECTION)
+#if PLATFORM(WIN) && USE(CFURLCONNECTION)
         // FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>.
         virtual bool shouldCacheResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, const unsigned char* data, unsigned long long length) = 0;
 #endif
index e2466ca..6620a56 100644 (file)
@@ -741,7 +741,7 @@ void ResourceLoader::receivedCancellation(const AuthenticationChallenge&)
     cancel();
 }
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
 
 void ResourceLoader::schedule(SchedulePair& pair)
 {
index 5591bdd..b94538a 100644 (file)
@@ -143,7 +143,7 @@ public:
 
     const LoadTiming& loadTiming() { return m_loadTiming; }
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     void schedule(WTF::SchedulePair&);
     void unschedule(WTF::SchedulePair&);
 #endif
@@ -163,9 +163,12 @@ protected:
 
     const ResourceLoaderOptions& options() { return m_options; }
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     NSCachedURLResponse* willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
 #endif
+#if PLATFORM(COCOA) && USE(CFURLCONNECTION)
+    CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
+#endif
 
     virtual void willSendRequestInternal(ResourceRequest&, const ResourceResponse& redirectResponse);
 
@@ -205,7 +208,7 @@ private:
 #if PLATFORM(IOS)
     RetainPtr<CFDictionaryRef> connectionProperties(ResourceHandle*) override;
 #endif
-#if USE(CFURLCONNECTION)
+#if PLATFORM(WIN) && USE(CFURLCONNECTION)
     // FIXME: Windows should use willCacheResponse - <https://bugs.webkit.org/show_bug.cgi?id=57257>.
     bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
 #endif
index 0ad4669..b3323f1 100644 (file)
@@ -74,9 +74,12 @@ private:
     void willCancel(const ResourceError&) override;
     void didCancel(const ResourceError&) override;
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse*) override;
 #endif
+#if PLATFORM(COCOA) && USE(CFURLCONNECTION)
+    CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef) override;
+#endif
 
 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
     bool supportsDataArray() override { return true; }
index 38edfa5..ddc26a3 100644 (file)
@@ -33,6 +33,8 @@
 
 namespace WebCore {
 
+#if PLATFORM(WIN)
+
 bool ResourceLoader::shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef cachedResponse)
 {
     if (m_options.sendLoadCallbacks == DoNotSendCallbacks)
@@ -43,6 +45,8 @@ bool ResourceLoader::shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef
     return frameLoader()->client().shouldCacheResponse(documentLoader(), identifier(), response, CFDataGetBytePtr(data), CFDataGetLength(data));
 }
 
+#endif
+
 } // namespace WebCore
 
 #endif // USE(CFURLCONNECTION)
index f8af303..8e003f5 100644 (file)
 
 namespace WebCore {
 
+#if USE(CFURLCONNECTION)
+
+CFCachedURLResponseRef SubresourceLoader::willCacheResponse(ResourceHandle* handle, CFCachedURLResponseRef cachedResponse)
+{
+    DiskCacheMonitor::monitorFileBackingStoreCreation(request(), m_resource->sessionID(), cachedResponse);
+    if (!m_resource->shouldCacheResponse(CFCachedURLResponseGetWrappedResponse(cachedResponse)))
+        return nullptr;
+    return ResourceLoader::willCacheResponse(handle, cachedResponse);
+}
+
+#else
+
 NSCachedURLResponse* SubresourceLoader::willCacheResponse(ResourceHandle* handle, NSCachedURLResponse* response)
 {
     DiskCacheMonitor::monitorFileBackingStoreCreation(request(), m_resource->sessionID(), [response _CFCachedURLResponse]);
@@ -43,4 +55,6 @@ NSCachedURLResponse* SubresourceLoader::willCacheResponse(ResourceHandle* handle
     return ResourceLoader::willCacheResponse(handle, response);
 }
 
+#endif
+
 }
index 1b09a7a..6943a2c 100644 (file)
@@ -33,6 +33,8 @@
 
 namespace WebCore {
 
+#if !USE(CFURLCONNECTION)
+
 static void scheduleAll(const ResourceLoaderMap& loaders, SchedulePair& pair)
 {
     Vector<RefPtr<ResourceLoader>> loadersCopy;
@@ -67,4 +69,6 @@ void DocumentLoader::unschedule(SchedulePair& pair)
     unscheduleAll(m_multipartSubresourceLoaders, pair);
 }
 
+#endif
+
 } // namespace WebCore
index f2ab61e..99ead7b 100644 (file)
 
 namespace WebCore {
 
+#if USE(CFURLCONNECTION)
+
+CFCachedURLResponseRef ResourceLoader::willCacheResponse(ResourceHandle*, CFCachedURLResponseRef cachedResponse)
+{
+    if (m_options.sendLoadCallbacks == DoNotSendCallbacks)
+        return nullptr;
+
+    RetainPtr<NSCachedURLResponse> nsCachedResponse = adoptNS([[NSCachedURLResponse alloc] _initWithCFCachedURLResponse:cachedResponse]);
+    return [frameLoader()->client().willCacheResponse(documentLoader(), identifier(), nsCachedResponse.get()) _CFCachedURLResponse];
+}
+
+#else
+
 NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCachedURLResponse* response)
 {
     if (m_options.sendLoadCallbacks == DoNotSendCallbacks)
@@ -43,6 +56,8 @@ NSCachedURLResponse* ResourceLoader::willCacheResponse(ResourceHandle*, NSCached
     return frameLoader()->client().willCacheResponse(documentLoader(), identifier(), response);
 }
 
+#endif
+
 #if USE(NETWORK_CFDATA_ARRAY_CALLBACK)
 
 void ResourceLoader::didReceiveDataArray(CFArrayRef dataArray)
index 87b8b14..8d95c85 100644 (file)
@@ -45,7 +45,11 @@ namespace WebCore {
 void Page::platformInitialize()
 {
 #if PLATFORM(IOS)
+#if USE(CFURLCONNECTION)
+    addSchedulePair(SchedulePair::create(WebThreadRunLoop(), kCFRunLoopCommonModes));
+#else
     addSchedulePair(SchedulePair::create(WebThreadNSRunLoop(), kCFRunLoopCommonModes));
+#endif // USE(CFURLCONNECTION)
 #else
     addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes));
 #endif
@@ -65,12 +69,14 @@ void Page::addSchedulePair(Ref<SchedulePair>&& pair)
         m_scheduledRunLoopPairs = std::make_unique<SchedulePairHashSet>();
     m_scheduledRunLoopPairs->add(pair.ptr());
 
+#if !USE(CFURLCONNECTION)
     for (Frame* frame = &m_mainFrame.get(); frame; frame = frame->tree().traverseNext()) {
         if (DocumentLoader* documentLoader = frame->loader().documentLoader())
             documentLoader->schedule(pair);
         if (DocumentLoader* documentLoader = frame->loader().provisionalDocumentLoader())
             documentLoader->schedule(pair);
     }
+#endif
 
     // FIXME: make SharedTimerMac use these SchedulePairs.
 }
@@ -83,12 +89,14 @@ void Page::removeSchedulePair(Ref<SchedulePair>&& pair)
 
     m_scheduledRunLoopPairs->remove(pair.ptr());
 
+#if !USE(CFURLCONNECTION)
     for (Frame* frame = &m_mainFrame.get(); frame; frame = frame->tree().traverseNext()) {
         if (DocumentLoader* documentLoader = frame->loader().documentLoader())
             documentLoader->unschedule(pair);
         if (DocumentLoader* documentLoader = frame->loader().provisionalDocumentLoader())
             documentLoader->unschedule(pair);
     }
+#endif
 }
 
 } // namespace
index e2fdc94..8cf3816 100644 (file)
 #import <VideoToolbox/VideoToolbox.h>
 #endif
 
+#if USE(CFURLCONNECTION)
+#include "CFNSURLConnectionSPI.h"
+#endif
+
 #import "CoreVideoSoftLink.h"
 
 namespace std {
@@ -368,6 +372,58 @@ static dispatch_queue_t globalPullDelegateQueue()
 }
 #endif
 
+#if USE(CFURLCONNECTION)
+class WebCoreNSURLAuthenticationChallengeClient : public RefCounted<WebCoreNSURLAuthenticationChallengeClient>, public AuthenticationClient {
+public:
+    static RefPtr<WebCoreNSURLAuthenticationChallengeClient> create(NSURLAuthenticationChallenge *challenge)
+    {
+        return adoptRef(new WebCoreNSURLAuthenticationChallengeClient(challenge));
+    }
+
+    using RefCounted<WebCoreNSURLAuthenticationChallengeClient>::ref;
+    using RefCounted<WebCoreNSURLAuthenticationChallengeClient>::deref;
+
+private:
+    WebCoreNSURLAuthenticationChallengeClient(NSURLAuthenticationChallenge *challenge)
+        : m_challenge(challenge)
+    {
+        ASSERT(m_challenge);
+    }
+
+    void refAuthenticationClient() override { ref(); }
+    void derefAuthenticationClient() override { deref(); }
+
+    void receivedCredential(const AuthenticationChallenge&, const Credential& credential) override
+    {
+        [[m_challenge sender] useCredential:credential.nsCredential() forAuthenticationChallenge:m_challenge.get()];
+    }
+
+    void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&) override
+    {
+        [[m_challenge sender] continueWithoutCredentialForAuthenticationChallenge:m_challenge.get()];
+    }
+
+    void receivedCancellation(const AuthenticationChallenge&) override
+    {
+        [[m_challenge sender] cancelAuthenticationChallenge:m_challenge.get()];
+    }
+
+    void receivedRequestToPerformDefaultHandling(const AuthenticationChallenge&) override
+    {
+        if ([[m_challenge sender] respondsToSelector:@selector(performDefaultHandlingForAuthenticationChallenge:)])
+            [[m_challenge sender] performDefaultHandlingForAuthenticationChallenge:m_challenge.get()];
+    }
+
+    void receivedChallengeRejection(const AuthenticationChallenge&) override
+    {
+        if ([[m_challenge sender] respondsToSelector:@selector(rejectProtectionSpaceAndContinueWithChallenge:)])
+            [[m_challenge sender] rejectProtectionSpaceAndContinueWithChallenge:m_challenge.get()];
+    }
+
+    RetainPtr<NSURLAuthenticationChallenge> m_challenge;
+};
+#endif
+
 void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistrar registrar)
 {
     if (!isAvailable())
@@ -1741,7 +1797,15 @@ bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource(AVAssetR
 
 bool MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge(NSURLAuthenticationChallenge* nsChallenge)
 {
-    return player()->shouldWaitForResponseToAuthenticationChallenge(AuthenticationChallenge(nsChallenge));
+#if USE(CFURLCONNECTION)
+    RefPtr<WebCoreNSURLAuthenticationChallengeClient> client = WebCoreNSURLAuthenticationChallengeClient::create(nsChallenge);
+    RetainPtr<CFURLAuthChallengeRef> cfChallenge = adoptCF([nsChallenge _createCFAuthChallenge]);
+    AuthenticationChallenge challenge(cfChallenge.get(), client.get());
+#else
+    AuthenticationChallenge challenge(nsChallenge);
+#endif
+
+    return player()->shouldWaitForResponseToAuthenticationChallenge(challenge);
 }
 
 void MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest(AVAssetResourceLoadingRequest* avRequest)
index 5254fd3..3d0ad30 100644 (file)
@@ -77,6 +77,14 @@ typedef struct _NSRect NSRect;
 #include <CoreGraphics/CoreGraphics.h>
 #endif
 
+#if USE(CFURLCONNECTION)
+typedef struct OpaqueCFHTTPCookieStorage*  CFHTTPCookieStorageRef;
+typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
+typedef struct _CFURLCredential* WKCFURLCredentialRef;
+typedef struct _CFURLRequest* CFMutableURLRequestRef;
+typedef const struct _CFURLRequest* CFURLRequestRef;
+#endif
+
 OBJC_CLASS AVAsset;
 OBJC_CLASS AVPlayer;
 OBJC_CLASS CALayer;
index e436efd..dfc74e5 100644 (file)
 
 #include "ProtectionSpace.h"
 
+#if USE(CFURLCONNECTION) && !PLATFORM(COCOA)
+#include "AuthenticationCF.h"
+#include <CFNetwork/CFURLProtectionSpacePriv.h>
+#endif
+
 namespace WebCore {
 
 // Need to enforce empty, non-null strings due to the pickiness of the String == String operator
index f357b24..3d942d1 100644 (file)
@@ -119,7 +119,7 @@ public:
     bool canAuthenticateAgainstProtectionSpace(const ProtectionSpace&);
 #endif
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     WEBCORE_EXPORT NSURLConnection *connection() const;
     id makeDelegate(bool);
     id delegate();
@@ -127,8 +127,12 @@ public:
 #endif
         
 #if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
+#if USE(CFURLCONNECTION)
+    static void getConnectionTimingData(CFURLConnectionRef, NetworkLoadTiming&);
+#else
     static void getConnectionTimingData(NSURLConnection *, NetworkLoadTiming&);
 #endif
+#endif
         
 #if PLATFORM(COCOA)
     void schedule(WTF::SchedulePair&);
@@ -201,7 +205,7 @@ public:
 #if USE(CFURLCONNECTION)
     WEBCORE_EXPORT void continueWillCacheResponse(CFCachedURLResponseRef);
 #endif
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
     WEBCORE_EXPORT void continueWillCacheResponse(NSCachedURLResponse *);
 #endif
 
@@ -221,6 +225,10 @@ public:
     WEBCORE_EXPORT static CFStringRef synchronousLoadRunLoopMode();
 #endif
 
+#if PLATFORM(IOS) && USE(CFURLCONNECTION)
+    static CFMutableDictionaryRef createSSLPropertiesFromNSURLRequest(const ResourceRequest&);
+#endif
+
     typedef Ref<ResourceHandle> (*BuiltinConstructor)(const ResourceRequest& request, ResourceHandleClient* client);
     static void registerBuiltinConstructor(const AtomicString& protocol, BuiltinConstructor);
 
@@ -257,11 +265,11 @@ private:
     void createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior, CFDictionaryRef clientProperties);
 #endif
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) && !USE(CFURLCONNECTION)
     void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior);
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS) && !USE(CFURLCONNECTION)
     void createNSURLConnection(id delegate, bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior, NSDictionary *connectionProperties);
 #endif
 
index 1a3a4d5..a515ba3 100644 (file)
@@ -124,7 +124,10 @@ namespace WebCore {
 
 #if USE(CFURLCONNECTION)
         virtual CFCachedURLResponseRef willCacheResponse(ResourceHandle*, CFCachedURLResponseRef response) { return response; }
+#if PLATFORM(WIN)
         virtual bool shouldCacheResponse(ResourceHandle*, CFCachedURLResponseRef) { return true; }
+#endif // PLATFORM(WIN)
+
 #elif PLATFORM(COCOA)
         virtual NSCachedURLResponse *willCacheResponse(ResourceHandle*, NSCachedURLResponse *response) { return response; }
 #endif
index 2d8a810..dc166d3 100644 (file)
@@ -136,7 +136,7 @@ namespace WebCore {
         ResourceRequest m_currentRequest;
         RefPtr<ResourceHandleCFURLConnectionDelegate> m_connectionDelegate;
 #endif
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) && !USE(CFURLCONNECTION)
         RetainPtr<NSURLConnection> m_connection;
         RetainPtr<id> m_delegate;
 #endif
index 80914f1..298504d 100644 (file)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-#if !USE(SOUP) && !PLATFORM(COCOA)
+#if !USE(SOUP) && (!PLATFORM(COCOA) || USE(CFURLCONNECTION))
 double ResourceRequestBase::s_defaultTimeoutInterval = INT_MAX;
 #else
 // Will use NSURLRequest default timeout unless set to a non-zero value with setDefaultTimeoutInterval().
index d7cb475..99af951 100644 (file)
 
 namespace WebCore {
 
-AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace,
-                                                 const Credential& proposedCredential,
-                                                 unsigned previousFailureCount,
-                                                 const ResourceResponse& response,
-                                                 const ResourceError& error)
-    : AuthenticationChallengeBase(protectionSpace,
-                                  proposedCredential,
-                                  previousFailureCount,
-                                  response,
-                                  error)
+AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error)
+    : AuthenticationChallengeBase(protectionSpace, proposedCredential, previousFailureCount, response, error)
 {
 }
 
 AuthenticationChallenge::AuthenticationChallenge(CFURLAuthChallengeRef cfChallenge, AuthenticationClient* authenticationClient)
-    : AuthenticationChallengeBase(core(CFURLAuthChallengeGetProtectionSpace(cfChallenge)), core(CFURLAuthChallengeGetProposedCredential(cfChallenge)), CFURLAuthChallengeGetPreviousFailureCount(cfChallenge), (CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(cfChallenge), CFURLAuthChallengeGetError(cfChallenge))
+#if PLATFORM(COCOA)
+    : AuthenticationChallengeBase(ProtectionSpace(CFURLAuthChallengeGetProtectionSpace(cfChallenge)), Credential(CFURLAuthChallengeGetProposedCredential(cfChallenge)),
+#else
+    : AuthenticationChallengeBase(core(CFURLAuthChallengeGetProtectionSpace(cfChallenge)), core(CFURLAuthChallengeGetProposedCredential(cfChallenge)),
+#endif
+        CFURLAuthChallengeGetPreviousFailureCount(cfChallenge), (CFURLResponseRef)CFURLAuthChallengeGetFailureResponse(cfChallenge), CFURLAuthChallengeGetError(cfChallenge))
     , m_authenticationClient(authenticationClient)
     , m_cfChallenge(cfChallenge)
 {
@@ -83,10 +80,17 @@ CFURLAuthChallengeRef createCF(const AuthenticationChallenge& coreChallenge)
 {
     // FIXME: Why not cache CFURLAuthChallengeRef in m_cfChallenge? Foundation counterpart does that.
 
+#if PLATFORM(COCOA)
+    CFURLAuthChallengeRef result = CFURLAuthChallengeCreate(0, coreChallenge.protectionSpace().cfSpace(), coreChallenge.proposedCredential().cfCredential(),
+#else
     RetainPtr<CFURLCredentialRef> credential = adoptCF(createCF(coreChallenge.proposedCredential()));
     RetainPtr<CFURLProtectionSpaceRef> protectionSpace = adoptCF(createCF(coreChallenge.protectionSpace()));
-
-    return CFURLAuthChallengeCreate(nullptr, protectionSpace.get(), credential.get(), coreChallenge.previousFailureCount(), coreChallenge.failureResponse().cfURLResponse(), coreChallenge.error());
+    CFURLAuthChallengeRef result = CFURLAuthChallengeCreate(0, protectionSpace.get(), credential.get(),
+#endif
+                                        coreChallenge.previousFailureCount(),
+                                        coreChallenge.failureResponse().cfURLResponse(),
+                                        coreChallenge.error());
+    return result;
 }
 
 CFURLCredentialRef createCF(const Credential& coreCredential)
@@ -271,6 +275,6 @@ ProtectionSpace core(CFURLProtectionSpaceRef cfSpace)
                            scheme);
 }
 
-};
+}
 
 #endif // USE(CFURLCONNECTION)
index 89a9352..9f0b929 100644 (file)
@@ -39,10 +39,18 @@ class Credential;
 class ProtectionSpace;
 
 CFURLAuthChallengeRef createCF(const AuthenticationChallenge&);
+#if PLATFORM(WIN)
 CFURLCredentialRef createCF(const Credential&);
 CFURLProtectionSpaceRef createCF(const ProtectionSpace&);
+#endif
+
+#if PLATFORM(COCOA)
+AuthenticationChallenge core(CFURLAuthChallengeRef);
+#endif
+#if PLATFORM(WIN)
 Credential core(CFURLCredentialRef);
 ProtectionSpace core(CFURLProtectionSpaceRef);
+#endif
 }
 
 #endif // USE(CFURLCONNECTION)
index 7cf48fd..40ed85e 100644 (file)
 #include "CFNetworkSPI.h"
 #include "Credential.h"
 #include "ProtectionSpace.h"
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <wtf/RetainPtr.h>
 
+#if PLATFORM(COCOA)
+#include "WebCoreSystemInterface.h"
+#elif PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
+#if PLATFORM(IOS)
+#include <CFNetwork/CFURLCredentialStorage.h>
+#endif
+
 namespace WebCore {
     
 static inline CFURLCredentialRef copyCredentialFromProtectionSpace(CFURLProtectionSpaceRef protectionSpace)
@@ -45,10 +54,28 @@ static inline CFURLCredentialRef copyCredentialFromProtectionSpace(CFURLProtecti
 
 Credential CredentialStorage::getFromPersistentStorage(const ProtectionSpace& protectionSpace)
 {
+#if PLATFORM(COCOA)
+    auto credentialCF = adoptCF(copyCredentialFromProtectionSpace(protectionSpace.cfSpace()));
+    return Credential(credentialCF.get());
+#else
     auto protectionSpaceCF = adoptCF(createCF(protectionSpace));
     auto credentialCF = adoptCF(copyCredentialFromProtectionSpace(protectionSpaceCF.get()));
     return core(credentialCF.get());
+#endif
+}
+
+#if PLATFORM(IOS)
+void CredentialStorage::saveToPersistentStorage(const ProtectionSpace& protectionSpace, const Credential& credential)
+{
+    RetainPtr<CFURLCredentialStorageRef> storageCF = adoptCF(CFURLCredentialStorageCreate(0));
+
+    if (credential.persistence() == CredentialPersistenceNone) {
+        Credential sessionCredential(credential, CredentialPersistenceForSession);
+        CFURLCredentialStorageSetDefaultCredentialForProtectionSpace(storageCF.get(), sessionCredential.cfCredential(), protectionSpace.cfSpace());
+    } else
+        CFURLCredentialStorageSetDefaultCredentialForProtectionSpace(storageCF.get(), credential.cfCredential(), protectionSpace.cfSpace());
 }
+#endif
 
 } // namespace WebCore
 
index 8d2f6a4..e877cb0 100644 (file)
 #include "ResourceErrorBase.h"
 
 #include <wtf/RetainPtr.h>
-
-#if PLATFORM(WIN)
 #if USE(CFURLCONNECTION)
 #include <CoreFoundation/CFStream.h>
 #endif
+#if PLATFORM(WIN)
 #include <windows.h>
 #include <wincrypt.h> // windows.h must be included before wincrypt.h.
 #endif
@@ -63,9 +62,11 @@ public:
     WEBCORE_EXPORT operator CFErrorRef() const;
 
 #if USE(CFURLCONNECTION)
+#if PLATFORM(WIN)
     ResourceError(const String& domain, int errorCode, const URL& failingURL, const String& localizedDescription, CFDataRef certificate);
     PCCERT_CONTEXT certificate() const;
     void setCertificate(CFDataRef);
+#endif
     ResourceError(CFStreamError error);
     CFStreamError cfStreamError() const;
     operator CFStreamError() const;
@@ -89,11 +90,12 @@ private:
     bool m_dataIsUpToDate;
 #if USE(CFURLCONNECTION)
     mutable RetainPtr<CFErrorRef> m_platformError;
-#elif PLATFORM(COCOA)
+#if PLATFORM(COCOA)
     mutable RetainPtr<NSError> m_platformNSError;
 #endif
 #if PLATFORM(WIN)
     RetainPtr<CFDataRef> m_certificate;
+#endif
 #else
     mutable RetainPtr<NSError> m_platformError;
 #endif
index 33c360c..7cbfd06 100644 (file)
 #include "URL.h"
 #include <CoreFoundation/CFError.h>
 #include <CFNetwork/CFNetworkErrors.h>
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <wtf/RetainPtr.h>
 
+#if PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
+
 namespace WebCore {
 
 ResourceError::ResourceError(CFErrorRef cfError)
index ea8b442..bcdab22 100644 (file)
@@ -46,8 +46,6 @@
 #include "SynchronousLoaderClient.h"
 #include "SynchronousResourceHandleCFURLConnectionDelegate.h"
 #include <CFNetwork/CFNetwork.h>
-#include <WebKitSystemInterface/WebKitSystemInterface.h>
-#include <process.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/Base64.h>
 #include <wtf/text/CString.h>
 
+#if PLATFORM(COCOA)
+#include "ResourceHandleCFURLConnectionDelegateWithOperationQueue.h"
+#include "WebCoreSystemInterface.h"
+#if USE(CFURLCONNECTION)
+#include "WebCoreURLResponse.h"
+#include <CFNetwork/CFURLConnectionPriv.h>
+#include <CFNetwork/CFURLRequestPriv.h>
+#endif
+#endif
+
+#if PLATFORM(WIN)
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#include <process.h>
+
 // FIXME: Remove this declaration once it's in WebKitSupportLibrary.
 extern "C" {
 __declspec(dllimport) CFURLConnectionRef CFURLConnectionCreateWithProperties(
@@ -65,6 +77,7 @@ __declspec(dllimport) CFURLConnectionRef CFURLConnectionCreateWithProperties(
   CFURLConnectionClient *  client,
   CFDictionaryRef properties);
 }
+#endif
 
 namespace WebCore {
 
@@ -107,7 +120,11 @@ ResourceHandle::~ResourceHandle()
     
 static inline CFStringRef shouldSniffConnectionProperty()
 {
+#if PLATFORM(WIN)
     return CFSTR("_kCFURLConnectionPropertyShouldSniff");
+#else
+    return _kCFURLConnectionPropertyShouldSniff;
+#endif
 }
 
 void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool shouldContentSniff, SchedulingBehavior schedulingBehavior, CFDictionaryRef clientProperties)
@@ -149,6 +166,9 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
 
     RetainPtr<CFMutableDictionaryRef> sslProps;
 
+#if PLATFORM(IOS)
+    sslProps = adoptCF(ResourceHandle::createSSLPropertiesFromNSURLRequest(firstRequest()));
+#else
     if (allowsAnyHTTPSCertificateHosts().contains(firstRequest().url().host())) {
         sslProps = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
         CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsAnyRoot, kCFBooleanTrue);
@@ -161,8 +181,11 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
     if (clientCert != clientCertificates().end()) {
         if (!sslProps)
             sslProps = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+#if PLATFORM(WIN)
         wkSetClientCertificateInSSLProperties(sslProps.get(), (clientCert->value).get());
+#endif
     }
+#endif // PLATFORM(IOS)
 
     if (sslProps)
         CFURLRequestSetSSLProperties(request.get(), sslProps.get());
@@ -183,6 +206,12 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
         CFDictionarySetValue(streamProperties, CFSTR("_WebKitSynchronousRequest"), kCFBooleanTrue);
     }
 
+#if PLATFORM(COCOA)
+    RetainPtr<CFDataRef> sourceApplicationAuditData = d->m_context->sourceApplicationAuditData();
+    if (sourceApplicationAuditData)
+        CFDictionarySetValue(streamProperties, CFSTR("kCFStreamPropertySourceApplication"), sourceApplicationAuditData.get());
+#endif
+
     static const CFStringRef kCFURLConnectionSocketStreamProperties = CFSTR("kCFURLConnectionSocketStreamProperties");
     RetainPtr<CFMutableDictionaryRef> propertiesDictionary;
     if (clientProperties)
@@ -201,7 +230,14 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
     CFDictionaryAddValue(propertiesDictionary.get(), kCFURLConnectionSocketStreamProperties, streamProperties);
     CFRelease(streamProperties);
 
+#if PLATFORM(COCOA)
+    if (d->m_usesAsyncCallbacks)
+        d->m_connectionDelegate = adoptRef(new ResourceHandleCFURLConnectionDelegateWithOperationQueue(this));
+    else
+        d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this));
+#else
     d->m_connectionDelegate = adoptRef(new SynchronousResourceHandleCFURLConnectionDelegate(this));
+#endif
     d->m_connectionDelegate->setupRequest(request.get());
 
     CFURLConnectionClient_V6 client = d->m_connectionDelegate->makeConnectionClient();
@@ -228,6 +264,10 @@ bool ResourceHandle::start()
 
     bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
 
+#if ENABLE(WEB_TIMING) && PLATFORM(COCOA) && !HAVE(TIMINGDATAOPTIONS)
+    setCollectsTimingData();
+#endif
+
     SchedulingBehavior schedulingBehavior = client()->loadingSynchronousXHR() ? SchedulingBehavior::Synchronous : SchedulingBehavior::Asynchronous;
 
     createCFURLConnection(shouldUseCredentialStorage, d->m_shouldContentSniff, schedulingBehavior, client()->connectionProperties(this).get());
@@ -311,6 +351,16 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall
     ASSERT(challenge.cfURLAuthChallengeRef());
     ASSERT(challenge.authenticationClient() == this); // Should be already set.
 
+#if !PLATFORM(WIN)
+    // Proxy authentication is handled by CFNetwork internally. We can get here if the user cancels
+    // CFNetwork authentication dialog, and we shouldn't ask the client to display another one in that case.
+    if (challenge.protectionSpace().isProxy()) {
+        // Cannot use receivedRequestToContinueWithoutCredential(), because current challenge is not yet set.
+        CFURLConnectionUseCredential(d->m_connection.get(), 0, challenge.cfURLAuthChallengeRef());
+        return;
+    }
+#endif
+
     if (tryHandlePasswordBasedAuthentication(challenge))
         return;
 
@@ -331,7 +381,11 @@ bool ResourceHandle::tryHandlePasswordBasedAuthentication(const AuthenticationCh
 
     if (!d->m_user.isNull() && !d->m_pass.isNull()) {
         RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(CFURLCredentialCreate(kCFAllocatorDefault, d->m_user.createCFString().get(), d->m_pass.createCFString().get(), 0, kCFURLCredentialPersistenceNone));
+#if PLATFORM(COCOA)
+        Credential credential = Credential(cfCredential.get());
+#else
         Credential credential = core(cfCredential.get());
+#endif
         
         URL urlToStore;
         if (challenge.failureResponse().httpStatusCode() == 401)
@@ -361,8 +415,12 @@ bool ResourceHandle::tryHandlePasswordBasedAuthentication(const AuthenticationCh
                     // Store the credential back, possibly adding it as a default for this directory.
                     d->m_context->storageSession().credentialStorage().set(credential, challenge.protectionSpace(), challenge.failureResponse().url());
                 }
+#if PLATFORM(COCOA)
+                CFURLConnectionUseCredential(d->m_connection.get(), credential.cfCredential(), challenge.cfURLAuthChallengeRef());
+#else
                 RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential));
                 CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
+#endif
                 return true;
             }
         }
@@ -412,12 +470,20 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge
         d->m_context->storageSession().credentialStorage().set(webCredential, challenge.protectionSpace(), urlToStore);
 
         if (d->m_connection) {
+#if PLATFORM(COCOA)
+            CFURLConnectionUseCredential(d->m_connection.get(), webCredential.cfCredential(), challenge.cfURLAuthChallengeRef());
+#else
             RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(webCredential));
             CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
+#endif
         }
     } else if (d->m_connection) {
+#if PLATFORM(COCOA)
+        CFURLConnectionUseCredential(d->m_connection.get(), credential.cfCredential(), challenge.cfURLAuthChallengeRef());
+#else
         RetainPtr<CFURLCredentialRef> cfCredential = adoptCF(createCF(credential));
         CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef());
+#endif
     }
 
     clearAuthentication();
@@ -558,6 +624,30 @@ void ResourceHandle::platformSetDefersLoading(bool defers)
         CFURLConnectionResume(d->m_connection.get());
 }
 
+#if PLATFORM(COCOA)
+void ResourceHandle::schedule(SchedulePair& pair)
+{
+    CFRunLoopRef runLoop = pair.runLoop();
+    if (!runLoop)
+        return;
+
+    CFURLConnectionScheduleWithRunLoop(d->m_connection.get(), runLoop, pair.mode());
+    if (d->m_startWhenScheduled) {
+        CFURLConnectionStart(d->m_connection.get());
+        d->m_startWhenScheduled = false;
+    }
+}
+
+void ResourceHandle::unschedule(SchedulePair& pair)
+{
+    CFRunLoopRef runLoop = pair.runLoop();
+    if (!runLoop)
+        return;
+
+    CFURLConnectionUnscheduleFromRunLoop(d->m_connection.get(), runLoop, pair.mode());
+}
+#endif
+
 const ResourceRequest& ResourceHandle::currentRequest() const
 {
     return d->m_currentRequest;
index 51b2e9c..e250660 100644 (file)
 #include "FormDataStreamCFNet.h"
 #include "NetworkingContext.h"
 #include "ResourceHandle.h"
+
+#if PLATFORM(COCOA)
+#include "WebCoreSystemInterface.h"
+#endif
+
+#if PLATFORM(WIN)
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
 
 namespace WebCore {
 
index a6f8b45..a0c6f86 100644 (file)
@@ -75,6 +75,9 @@ void ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle()
 
 void ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest(CFMutableURLRequestRef request)
 {
+#if PLATFORM(IOS)
+    CFURLRequestSetShouldStartSynchronously(request, 1);
+#endif
     CFURLRef requestURL = CFURLRequestGetURL(request);
     if (!requestURL)
         return;
@@ -146,8 +149,10 @@ void ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse
             adjustMIMETypeIfNecessary(cfResponse, isMainResourceLoad);
         }
 
+#if !PLATFORM(IOS)
         if (_CFURLRequestCopyProtocolPropertyForKey(m_handle->firstRequest().cfURLRequest(DoNotUpdateHTTPBody), CFSTR("ForceHTMLMIMEType")))
             CFURLResponseSetMIMEType(cfResponse, CFSTR("text/html"));
+#endif // !PLATFORM(IOS)
         
         ResourceResponse resourceResponse(cfResponse);
 #if ENABLE(WEB_TIMING)
@@ -283,7 +288,15 @@ Boolean ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToPro
 
         LOG(Network, "CFNet - ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
-        m_handle->canAuthenticateAgainstProtectionSpace(ProtectionSpace(protectionSpace));
+        ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace);
+#if PLATFORM(IOS)
+        if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown) {
+            m_boolResult = false;
+            dispatch_semaphore_signal(m_semaphore);
+            return;
+        }
+#endif // PLATFORM(IOS)
+        m_handle->canAuthenticateAgainstProtectionSpace(coreProtectionSpace);
     });
     dispatch_semaphore_wait(m_semaphore, DISPATCH_TIME_FOREVER);
     return m_boolResult;
index 05c52a0..2e6f9fe 100644 (file)
@@ -62,6 +62,12 @@ public:
     }
     
 #if USE(CFURLCONNECTION)
+#if PLATFORM(COCOA)
+    WEBCORE_EXPORT ResourceRequest(NSURLRequest *);
+    void updateNSURLRequest();
+    void clearOrUpdateNSURLRequest();
+#endif
+
     ResourceRequest(CFURLRequestRef cfRequest)
         : ResourceRequestBase()
         , m_cfRequest(cfRequest)
@@ -78,7 +84,11 @@ public:
     WEBCORE_EXPORT void updateFromDelegatePreservingOldProperties(const ResourceRequest&);
 
 #if PLATFORM(COCOA)
+#if USE(CFURLCONNECTION)
+    bool encodingRequiresPlatformData() const { return m_httpBody || m_cfRequest; }
+#else
     bool encodingRequiresPlatformData() const { return m_httpBody || m_nsRequest; }
+#endif
     WEBCORE_EXPORT NSURLRequest *nsURLRequest(HTTPBodyUpdatePolicy) const;
 
     WEBCORE_EXPORT static CFStringRef isUserInitiatedKey();
index e414992..d7647f4 100644 (file)
@@ -64,6 +64,7 @@ bool ResourceRequest::s_httpPipeliningEnabled = false;
 typedef void (*CFURLRequestSetContentDispositionEncodingFallbackArrayFunction)(CFMutableURLRequestRef, CFArrayRef);
 typedef CFArrayRef (*CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction)(CFURLRequestRef);
 
+#if PLATFORM(WIN)
 static HMODULE findCFNetworkModule()
 {
 #ifndef DEBUG_ALL
@@ -82,6 +83,17 @@ static CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction findCFURL
 {
     return reinterpret_cast<CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction>(GetProcAddress(findCFNetworkModule(), "_CFURLRequestCopyContentDispositionEncodingFallbackArray"));
 }
+#elif PLATFORM(COCOA)
+static CFURLRequestSetContentDispositionEncodingFallbackArrayFunction findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction()
+{
+    return reinterpret_cast<CFURLRequestSetContentDispositionEncodingFallbackArrayFunction>(dlsym(RTLD_DEFAULT, "_CFURLRequestSetContentDispositionEncodingFallbackArray"));
+}
+
+static CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction()
+{
+    return reinterpret_cast<CFURLRequestCopyContentDispositionEncodingFallbackArrayFunction>(dlsym(RTLD_DEFAULT, "_CFURLRequestCopyContentDispositionEncodingFallbackArray"));
+}
+#endif
 
 static void setContentDispositionEncodingFallbackArray(CFMutableURLRequestRef request, CFArrayRef fallbackArray)
 {
@@ -144,6 +156,10 @@ void ResourceRequest::doUpdatePlatformRequest()
     if (resourcePrioritiesEnabled())
         CFURLRequestSetRequestPriority(cfRequest, toPlatformRequestPriority(priority()));
 
+#if !PLATFORM(WIN)
+    _CFURLRequestSetProtocolProperty(cfRequest, kCFURLRequestAllowAllPOSTCaching, kCFBooleanTrue);
+#endif
+
     setHeaderFields(cfRequest, httpHeaderFields());
 
     CFURLRequestSetShouldHandleHTTPCookies(cfRequest, allowCookies());
@@ -168,6 +184,9 @@ void ResourceRequest::doUpdatePlatformRequest()
 #endif
 
     m_cfRequest = adoptCF(cfRequest);
+#if PLATFORM(COCOA)
+    clearOrUpdateNSURLRequest();
+#endif
 }
 
 // FIXME: We should use a switch based on ResourceRequestCachePolicy parameter
@@ -206,12 +225,30 @@ void ResourceRequest::doUpdatePlatformHTTPBody()
     }
 
     m_cfRequest = adoptCF(cfRequest);
+#if PLATFORM(COCOA)
+    clearOrUpdateNSURLRequest();
+#endif
 }
 
 void ResourceRequest::doUpdateResourceRequest()
 {
     if (!m_cfRequest) {
+#if PLATFORM(IOS)
+        // <rdar://problem/9913526>
+        // This is a hack to mimic the subtle behaviour of the Foundation based ResourceRequest
+        // code. That code does not reset m_httpMethod if the NSURLRequest is nil. I filed
+        // <https://bugs.webkit.org/show_bug.cgi?id=66336> to track that.
+        // Another related bug is <https://bugs.webkit.org/show_bug.cgi?id=66350>. Fixing that
+        // would, ideally, allow us to not have this hack. But unfortunately that caused layout test
+        // failures.
+        // Removal of this hack is tracked by <rdar://problem/9970499>.
+
+        String httpMethod = m_httpMethod;
         *this = ResourceRequest();
+        m_httpMethod = httpMethod;
+#else
+        *this = ResourceRequest();
+#endif
         return;
     }
 
@@ -287,6 +324,9 @@ void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
     if (storageSession)
         _CFURLRequestSetStorageSession(cfRequest, storageSession);
     m_cfRequest = adoptCF(cfRequest);
+#if PLATFORM(COCOA)
+    clearOrUpdateNSURLRequest();
+#endif
 }
 
 #endif // USE(CFURLCONNECTION)
index 05b781d..3da41d2 100644 (file)
@@ -50,6 +50,9 @@ public:
     {
         m_isNull = !cfResponse;
     }
+#if PLATFORM(COCOA)
+    WEBCORE_EXPORT ResourceResponse(NSURLResponse *);
+#endif
 #else
     ResourceResponse(NSURLResponse *nsResponse)
         : m_initLevel(Uninitialized)
@@ -116,7 +119,8 @@ private:
 
 #if USE(CFURLCONNECTION)
     mutable RetainPtr<CFURLResponseRef> m_cfResponse;
-#elif PLATFORM(COCOA)
+#endif
+#if PLATFORM(COCOA)
     mutable RetainPtr<NSURLResponse> m_nsResponse;
 #endif
 };
index 7885b06..7cdacaf 100644 (file)
 #include "MIMETypeRegistry.h"
 #include <wtf/RetainPtr.h>
 
+#if PLATFORM(COCOA)
+#include "WebCoreSystemInterface.h"
+#endif
+
 namespace WebCore {
 
 static CFStringRef const commonHeaderFields[] = {
@@ -43,9 +47,13 @@ static CFStringRef const commonHeaderFields[] = {
 CFURLResponseRef ResourceResponse::cfURLResponse() const
 {
     if (!m_cfResponse && !m_isNull) {
+#if PLATFORM(COCOA)
+        nsURLResponse();
+#else
         RetainPtr<CFURLRef> url = m_url.createCFURL();
         // FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code.
         m_cfResponse = adoptCF(CFURLResponseCreate(0, url.get(), m_mimeType.string().createCFString().get(), m_expectedContentLength, m_textEncodingName.string().createCFString().get(), kCFURLCacheStorageAllowed));
+#endif
     }
 
     return m_cfResponse.get();
@@ -108,10 +116,12 @@ void ResourceResponse::platformLazyInit(InitLevel initLevel)
     m_initLevel = initLevel;
 }
 
+#if !PLATFORM(COCOA)
 CertificateInfo ResourceResponse::platformCertificateInfo() const
 {
     return { };
 }
+#endif
 
 String ResourceResponse::platformSuggestedFilename() const
 {
index a4d0d81..0d7c708 100644 (file)
@@ -32,7 +32,6 @@
 #include "AuthenticationChallenge.h"
 #include "LoaderRunLoopCF.h"
 #include "Logging.h"
-#include "MIMETypeRegistry.h"
 #include "ResourceHandle.h"
 #include "ResourceHandleClient.h"
 #include "ResourceResponse.h"
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
+#if PLATFORM(COCOA)
+#include "CFNetworkSPI.h"
+#include "WebCoreSystemInterface.h"
+#include "WebCoreURLResponse.h"
+#endif // PLATFORM(COCOA)
+
+#if PLATFORM(IOS)
+#include "WebCoreThread.h"
+#endif // PLATFORM(IOS)
+
+#if PLATFORM(WIN)
+#include "MIMETypeRegistry.h"
+#endif // PLATFORM(WIN)
+
 namespace WebCore {
 
 SynchronousResourceHandleCFURLConnectionDelegate::SynchronousResourceHandleCFURLConnectionDelegate(ResourceHandle* handle)
@@ -50,11 +63,20 @@ SynchronousResourceHandleCFURLConnectionDelegate::SynchronousResourceHandleCFURL
 
 void SynchronousResourceHandleCFURLConnectionDelegate::setupRequest(CFMutableURLRequestRef request)
 {
+#if PLATFORM(IOS)
+    CFURLRequestSetShouldStartSynchronously(request, 1);
+#endif
 }
 
 void SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling(CFURLConnectionRef connection)
 {
+#if PLATFORM(WIN)
     CFURLConnectionScheduleWithCurrentMessageQueue(connection);
+#elif PLATFORM(IOS)
+    CFURLConnectionScheduleWithRunLoop(connection, WebThreadRunLoop(), kCFRunLoopDefaultMode);
+#else
+    CFURLConnectionScheduleWithRunLoop(connection, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+#endif
     CFURLConnectionScheduleDownloadWithRunLoop(connection, loaderRunLoop(), kCFRunLoopDefaultMode);
 }
 
@@ -81,6 +103,7 @@ CFURLRequestRef SynchronousResourceHandleCFURLConnectionDelegate::willSendReques
     return newCFRequest;
 }
 
+#if !PLATFORM(COCOA)
 static void setDefaultMIMEType(CFURLResponseRef response)
 {
     static CFStringRef defaultMIMETypeString = defaultMIMEType().createCFString().leakRef();
@@ -110,14 +133,30 @@ static void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse)
     if (result != originalResult)
         CFURLResponseSetMIMEType(cfResponse, result.get());
 }
+#endif // !PLATFORM(COCOA)
 
-void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLConnectionRef, CFURLResponseRef cfResponse)
+void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLConnectionRef connection, CFURLResponseRef cfResponse)
 {
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(handle=%p) (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
     if (!m_handle->client())
         return;
 
+#if PLATFORM(COCOA)
+    // Avoid MIME type sniffing if the response comes back as 304 Not Modified.
+    auto msg = CFURLResponseGetHTTPResponse(cfResponse);
+    int statusCode = msg ? CFHTTPMessageGetResponseStatusCode(msg) : 0;
+
+    if (statusCode != 304) {
+        bool isMainResourceLoad = m_handle->firstRequest().requester() == ResourceRequest::Requester::Main;
+        adjustMIMETypeIfNecessary(cfResponse, isMainResourceLoad);
+    }
+
+#if !PLATFORM(IOS)
+    if (_CFURLRequestCopyProtocolPropertyForKey(m_handle->firstRequest().cfURLRequest(DoNotUpdateHTTPBody), CFSTR("ForceHTMLMIMEType")))
+        CFURLResponseSetMIMEType(cfResponse, CFSTR("text/html"));
+#endif // !PLATFORM(IOS)
+#else
     if (!CFURLResponseGetMIMEType(cfResponse))
         adjustMIMETypeIfNecessary(cfResponse);
 
@@ -126,6 +165,7 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLC
         ASSERT(!m_handle->shouldContentSniff());
         setDefaultMIMEType(cfResponse);
     }
+#endif
 
 #if USE(QUICK_LOOK)
     bool isQuickLookPreview = false;
@@ -137,6 +177,12 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse(CFURLC
 #endif
 
     ResourceResponse resourceResponse(cfResponse);
+#if PLATFORM(COCOA) && ENABLE(WEB_TIMING)
+    ResourceHandle::getConnectionTimingData(connection, resourceResponse.networkLoadTiming());
+#else
+    UNUSED_PARAM(connection);
+#endif
+
 #if USE(QUICK_LOOK)
     resourceResponse.setIsQuickLook(isQuickLookPreview);
 #endif
@@ -185,6 +231,7 @@ void SynchronousResourceHandleCFURLConnectionDelegate::didFail(CFErrorRef error)
 
 CFCachedURLResponseRef SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse(CFCachedURLResponseRef cachedResponse)
 {
+#if PLATFORM(WIN)
     // Workaround for <rdar://problem/6300990> Caching does not respect Vary HTTP header.
     // FIXME: WebCore cache has issues with Vary, too (bug 58797, bug 71509).
     CFURLResponseRef wrappedResponse = CFCachedURLResponseGetWrappedResponse(cachedResponse);
@@ -194,8 +241,16 @@ CFCachedURLResponseRef SynchronousResourceHandleCFURLConnectionDelegate::willCac
         if (varyValue)
             return 0;
     }
+#endif // PLATFORM(WIN)
+
+#if PLATFORM(WIN)
     if (m_handle->client() && !m_handle->client()->shouldCacheResponse(m_handle, cachedResponse))
         return 0;
+#else
+    CFCachedURLResponseRef newResponse = m_handle->client()->willCacheResponse(m_handle, cachedResponse);
+    if (newResponse != cachedResponse)
+        return newResponse;
+#endif
 
     CFRetain(cachedResponse);
     return cachedResponse;
@@ -232,7 +287,14 @@ Boolean SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtection
 
     LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace(handle=%p (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
 
+#if PLATFORM(IOS)
+    ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace);
+    if (coreProtectionSpace.authenticationScheme() == ProtectionSpaceAuthenticationSchemeUnknown)
+        return false;
+    return m_handle->canAuthenticateAgainstProtectionSpace(coreProtectionSpace);
+#else
     return m_handle->canAuthenticateAgainstProtectionSpace(core(protectionSpace));
+#endif
 }
 #endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
 
index 93def91..a69fc25 100644 (file)
 #include <Security/SecBase.h>
 #include <wtf/RetainPtr.h>
 
+#if USE(CFURLCONNECTION)
+#include "CFNetworkSPI.h"
+#endif
+
 OBJC_CLASS NSURLCredential;
 
 namespace WebCore {
@@ -47,12 +51,18 @@ public:
 
     Credential(const Credential&, CredentialPersistence);
 
+#if USE(CFURLCONNECTION)
+    explicit Credential(CFURLCredentialRef);
+#endif
     WEBCORE_EXPORT explicit Credential(NSURLCredential *);
 
     WEBCORE_EXPORT bool isEmpty() const;
 
     bool encodingRequiresPlatformData() const { return m_nsCredential && encodingRequiresPlatformData(m_nsCredential.get()); }
 
+#if USE(CFURLCONNECTION)
+    CFURLCredentialRef cfCredential() const;
+#endif
     WEBCORE_EXPORT NSURLCredential *nsCredential() const;
 
     static bool platformCompare(const Credential&, const Credential&);
index 7e05c46..9b735ba 100644 (file)
 #import "config.h"
 #import "CredentialCocoa.h"
 
+#if USE(CFURLCONNECTION)
+@interface NSURLCredential (WebDetails)
+- (id)_initWithCFURLCredential:(CFURLCredentialRef)credential;
+- (CFURLCredentialRef) _CFURLCredential;
+@end
+#endif
+
 namespace WebCore {
 
 static NSURLCredentialPersistence toNSURLCredentialPersistence(CredentialPersistence persistence)
@@ -77,12 +84,26 @@ Credential::Credential(const Credential& original, CredentialPersistence persist
     }
 }
 
+#if USE(CFURLCONNECTION)
+Credential::Credential(CFURLCredentialRef credential)
+    : Credential(adoptNS([[NSURLCredential alloc] _initWithCFURLCredential:credential]).get())
+{
+}
+#endif
+
 Credential::Credential(NSURLCredential *credential)
     : CredentialBase(credential.user, credential.password, toCredentialPersistence(credential.persistence))
     , m_nsCredential(credential)
 {
 }
 
+#if USE(CFURLCONNECTION)
+CFURLCredentialRef Credential::cfCredential() const
+{
+    return [nsCredential() _CFURLCredential];
+}
+#endif
+
 NSURLCredential *Credential::nsCredential() const
 {
     if (m_nsCredential)
index f490c6c..cf76697 100644 (file)
 #include "ProtectionSpaceBase.h"
 #include <wtf/RetainPtr.h>
 
+#if USE(CFURLCONNECTION)
+typedef struct _CFURLProtectionSpace* CFURLProtectionSpaceRef;
+#endif
+
 OBJC_CLASS NSURLProtectionSpace;
 
 namespace WebCore {
@@ -42,6 +46,9 @@ public:
 
     ProtectionSpace(WTF::HashTableDeletedValueType deletedValue) : ProtectionSpaceBase(deletedValue) { }
 
+#if USE(CFURLCONNECTION)
+    explicit ProtectionSpace(CFURLProtectionSpaceRef);
+#endif
     WEBCORE_EXPORT explicit ProtectionSpace(NSURLProtectionSpace *);
 
     static bool platformCompare(const ProtectionSpace& a, const ProtectionSpace& b);
@@ -50,6 +57,9 @@ public:
 
     WEBCORE_EXPORT bool receivesCredentialSecurely() const;
 
+#if USE(CFURLCONNECTION)
+    CFURLProtectionSpaceRef cfSpace() const;
+#endif
     WEBCORE_EXPORT NSURLProtectionSpace *nsSpace() const;
 
 private:
index ec89691..0a2e2d5 100644 (file)
 #import "config.h"
 #import "ProtectionSpaceCocoa.h"
 
+#if USE(CFURLCONNECTION)
+@interface NSURLProtectionSpace (WebDetails)
+- (CFURLProtectionSpaceRef) _CFURLProtectionSpace;
+- (id)_initWithCFURLProtectionSpace:(CFURLProtectionSpaceRef)cfProtSpace;
+@end
+#endif
 
 namespace WebCore {
 
+#if USE(CFURLCONNECTION)
+ProtectionSpace::ProtectionSpace(CFURLProtectionSpaceRef space)
+    : ProtectionSpace(adoptNS([[NSURLProtectionSpace alloc] _initWithCFURLProtectionSpace:space]).get())
+{
+}
+#endif
+
 static ProtectionSpaceServerType type(NSURLProtectionSpace *space)
 {
     if ([space isProxy]) {
@@ -92,6 +105,13 @@ ProtectionSpace::ProtectionSpace(NSURLProtectionSpace *space)
     m_nsSpace = space;
 }
 
+#if USE(CFURLCONNECTION)
+CFURLProtectionSpaceRef ProtectionSpace::cfSpace() const
+{
+    return [nsSpace() _CFURLProtectionSpace];
+}
+#endif
+
 NSURLProtectionSpace *ProtectionSpace::nsSpace() const
 {
     if (m_nsSpace)
index e71cc1f..460f49d 100644 (file)
@@ -53,9 +53,15 @@ namespace WebCore {
 NSURLRequest *ResourceRequest::nsURLRequest(HTTPBodyUpdatePolicy bodyPolicy) const
 {
     updatePlatformRequest(bodyPolicy);
+#if USE(CFURLCONNECTION)
+    if (!m_nsRequest)
+        const_cast<ResourceRequest*>(this)->updateNSURLRequest();
+#endif
     return [[m_nsRequest.get() retain] autorelease];
 }
 
+#if !USE(CFURLCONNECTION)
+
 CFURLRequestRef ResourceRequest::cfURLRequest(HTTPBodyUpdatePolicy bodyPolicy) const
 {
     return [nsURLRequest(bodyPolicy) _CFURLRequest];
@@ -238,6 +244,8 @@ void ResourceRequest::setStorageSession(CFURLStorageSessionRef storageSession)
     m_nsRequest = adoptNS(wkCopyRequestWithStorageSession(storageSession, m_nsRequest.get()));
 }
 
+#endif // USE(CFURLCONNECTION)
+
 } // namespace WebCore
 
 #endif // PLATFORM(COCOA)
index d9d736a..e991c35 100644 (file)
@@ -75,8 +75,13 @@ void ResourceResponse::disableLazyInitialization()
 
 CertificateInfo ResourceResponse::platformCertificateInfo() const
 {
+#if USE(CFURLCONNECTION)
+    ASSERT(m_cfResponse);
+    CFURLResponseRef cfResponse = m_cfResponse.get();
+#else
     ASSERT(m_nsResponse);
     CFURLResponseRef cfResponse = [m_nsResponse _CFURLResponse];
+#endif
 
     if (!cfResponse)
         return { };
@@ -109,6 +114,35 @@ CertificateInfo ResourceResponse::platformCertificateInfo() const
 #endif
 }
 
+#if USE(CFURLCONNECTION)
+
+NSURLResponse *ResourceResponse::nsURLResponse() const
+{
+    if (!m_nsResponse && !m_cfResponse && !m_isNull) {
+        initNSURLResponse();
+        m_cfResponse = [m_nsResponse.get() _CFURLResponse];
+        return m_nsResponse.get();
+    }
+
+    if (!m_cfResponse)
+        return nil;
+
+    if (!m_nsResponse)
+        m_nsResponse = [NSURLResponse _responseWithCFURLResponse:m_cfResponse.get()];
+
+    return m_nsResponse.get();
+}
+
+ResourceResponse::ResourceResponse(NSURLResponse* nsResponse)
+    : m_initLevel(Uninitialized)
+    , m_cfResponse([nsResponse _CFURLResponse])
+    , m_nsResponse(nsResponse)
+{
+    m_isNull = !nsResponse;
+}
+
+#else
+
 static NSString* const commonHeaderFields[] = {
     @"Age", @"Cache-Control", @"Content-Type", @"Date", @"Etag", @"Expires", @"Last-Modified", @"Pragma"
 };
@@ -208,6 +242,8 @@ bool ResourceResponse::platformCompare(const ResourceResponse& a, const Resource
     return a.nsURLResponse() == b.nsURLResponse();
 }
 
+#endif // USE(CFURLCONNECTION)
+
 } // namespace WebCore
 
 #endif // PLATFORM(COCOA)
index d13fcfc..6d70903 100644 (file)
 #import <objc/objc-runtime.h>
 #import <wtf/RefPtr.h>
 
+#if USE(CFURLCONNECTION)
+#include "CFNetworkSPI.h"
+#endif
+
 OBJC_CLASS NSData;
 OBJC_CLASS NSDictionary;
 OBJC_CLASS NSFileHandle;
@@ -77,6 +81,9 @@ public:
     WEBCORE_EXPORT static bool shouldCreateForMIMEType(const String&);
 
     static std::unique_ptr<QuickLookHandle> create(ResourceHandle*, NSURLConnection *, NSURLResponse *, id delegate);
+#if USE(CFURLCONNECTION)
+    static std::unique_ptr<QuickLookHandle> create(ResourceHandle*, SynchronousResourceHandleCFURLConnectionDelegate*, CFURLResponseRef);
+#endif
     // FIXME: Use of ResourceLoader here is a platform violation.
     WEBCORE_EXPORT static std::unique_ptr<QuickLookHandle> create(ResourceLoader&, const ResourceResponse&);
 
@@ -88,6 +95,9 @@ public:
     WEBCORE_EXPORT void didFail();
 
     WEBCORE_EXPORT NSURLResponse *nsResponse();
+#if USE(CFURLCONNECTION)
+    CFURLResponseRef cfResponse();
+#endif
 
     void setClient(PassRefPtr<QuickLookHandleClient> client) { m_client = client; }
 
index 3fb7f17..eadf3dd 100644 (file)
@@ -185,6 +185,81 @@ const char* WebCore::QLPreviewProtocol()
     return previewProtocol.get().data();
 }
 
+#if USE(CFURLCONNECTION)
+// The way QuickLook works is we pass it an NSURLConnectionDelegate callback object at creation
+// time. Then we pass it all the data as we receive it. Once we've downloaded the full URL,
+// QuickLook turns around and send us, through this delegate, the HTML version of the file which we
+// pass on to WebCore. The flag m_finishedLoadingDataIntoConverter in QuickLookHandle decides
+// whether to pass the data to QuickLook or WebCore.
+//
+// This works fine when using NS APIs, but when using CFNetwork, we don't have a NSURLConnectionDelegate.
+// So we create WebQuickLookHandleAsDelegate as an intermediate delegate object and pass it to
+// QLPreviewConverter. The proxy delegate then forwards the messages on to the CFNetwork code.
+@interface WebQuickLookHandleAsDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
+    RefPtr<SynchronousResourceHandleCFURLConnectionDelegate> m_connectionDelegate;
+}
+
+- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate;
+@end
+
+@implementation WebQuickLookHandleAsDelegate
+- (id)initWithConnectionDelegate:(SynchronousResourceHandleCFURLConnectionDelegate*)connectionDelegate
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    m_connectionDelegate = connectionDelegate;
+    return self;
+}
+
+- (void)connection:(NSURLConnection *)connection didReceiveDataArray:(NSArray *)dataArray
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, "WebQuickLookHandleAsDelegate::didReceiveDataArray()");
+    m_connectionDelegate->didReceiveDataArray(reinterpret_cast<CFArrayRef>(dataArray));
+}
+
+- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data lengthReceived:(long long)lengthReceived
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, "WebQuickLookHandleAsDelegate::didReceiveData() - data length = %ld", (long)[data length]);
+
+    // QuickLook code sends us a nil data at times. The check below is the same as the one in
+    // ResourceHandleMac.cpp added for a different bug.
+    if (![data length])
+        return;
+    m_connectionDelegate->didReceiveData(reinterpret_cast<CFDataRef>(data), static_cast<int>(lengthReceived));
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection *)connection
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, "WebQuickLookHandleAsDelegate::didFinishLoading()");
+    m_connectionDelegate->didFinishLoading();
+}
+
+- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
+{
+    UNUSED_PARAM(connection);
+    if (!m_connectionDelegate)
+        return;
+    LOG(Network, "WebQuickLookHandleAsDelegate::didFail()");
+    m_connectionDelegate->didFail(reinterpret_cast<CFErrorRef>(error));
+}
+
+- (void)detachHandle
+{
+    m_connectionDelegate = nullptr;
+}
+@end
+#endif
+
 @interface WebResourceLoaderQuickLookDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     RefPtr<ResourceLoader> _resourceLoader;
     BOOL _hasSentDidReceiveResponse;
@@ -339,6 +414,26 @@ std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle,
     return quickLookHandle;
 }
 
+#if USE(CFURLCONNECTION)
+std::unique_ptr<QuickLookHandle> QuickLookHandle::create(ResourceHandle* handle, SynchronousResourceHandleCFURLConnectionDelegate* connectionDelegate, CFURLResponseRef cfResponse)
+{
+    ASSERT_ARG(handle, handle);
+    if (handle->firstRequest().requester() != ResourceRequest::Requester::Main || ![QLPreviewGetSupportedMIMETypesSet() containsObject:(NSString *)CFURLResponseGetMIMEType(cfResponse)])
+        return nullptr;
+
+    NSURLResponse *nsResponse = [NSURLResponse _responseWithCFURLResponse:cfResponse];
+    WebQuickLookHandleAsDelegate *delegate = [[[WebQuickLookHandleAsDelegate alloc] initWithConnectionDelegate:connectionDelegate] autorelease];
+    std::unique_ptr<QuickLookHandle> quickLookHandle(new QuickLookHandle([handle->firstRequest().nsURLRequest(DoNotUpdateHTTPBody) URL], nil, nsResponse, delegate));
+    handle->client()->didCreateQuickLookHandle(*quickLookHandle);
+    return quickLookHandle;
+}
+
+CFURLResponseRef QuickLookHandle::cfResponse()
+{
+    return [m_nsResponse _CFURLResponse];
+}
+#endif
+
 bool QuickLookHandle::shouldCreateForMIMEType(const String& mimeType)
 {
     return [QLPreviewGetSupportedMIMETypesSet() containsObject:mimeType];
diff --git a/Source/WebCore/platform/network/ios/ResourceHandleIOS.mm b/Source/WebCore/platform/network/ios/ResourceHandleIOS.mm
new file mode 100644 (file)
index 0000000..bcbb780
--- /dev/null
@@ -0,0 +1,39 @@
+//
+//  ResourceHandleIPhone.mm
+//  WebCore
+//
+//  Copyright 2011 Apple Inc. All rights reserved.
+//
+
+#import "config.h"
+#import "ResourceHandleInternal.h"
+
+#if USE(CFURLCONNECTION)
+
+#import <CFNetwork/CFSocketStreamPriv.h>
+#import <Foundation/NSURLRequestPrivate.h>
+
+using namespace WebCore;
+
+namespace WebCore {
+
+CFMutableDictionaryRef ResourceHandle::createSSLPropertiesFromNSURLRequest(const ResourceRequest& request)
+{
+    NSString *host = request.url().host();
+    NSArray *certArray = [NSURLRequest allowsSpecificHTTPSCertificateForHost:host];
+    BOOL allowsAnyCertificate = [NSURLRequest allowsAnyHTTPSCertificateForHost:host];
+    if (!certArray && !allowsAnyCertificate)
+        return 0;
+
+    CFMutableDictionaryRef sslProps = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+    if (certArray)
+        CFDictionarySetValue(sslProps, _kCFStreamSSLTrustedLeafCertificates, (CFTypeRef) certArray);
+
+    if (allowsAnyCertificate)
+        CFDictionarySetValue(sslProps, kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);
+    return sslProps;
+}
+
+}
+
+#endif
diff --git a/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm b/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm
new file mode 100644 (file)
index 0000000..fe6d7c1
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+#import "ResourceRequest.h"
+
+#if PLATFORM(IOS)
+
+@interface NSURLRequest (WebNSURLRequestDetails)
+- (CFURLRequestRef)_CFURLRequest;
+- (id)_initWithCFURLRequest:(CFURLRequestRef)request;
+@end
+
+namespace WebCore {
+
+#if USE(CFURLCONNECTION)
+
+ResourceRequest::ResourceRequest(NSURLRequest *nsRequest)
+    : ResourceRequestBase()
+    , m_cfRequest([nsRequest _CFURLRequest])
+    , m_nsRequest(nsRequest)
+{
+}
+
+void ResourceRequest::updateNSURLRequest()
+{
+    if (m_cfRequest)
+        m_nsRequest = adoptNS([[NSMutableURLRequest alloc] _initWithCFURLRequest:m_cfRequest.get()]);
+}
+
+void ResourceRequest::clearOrUpdateNSURLRequest()
+{
+    // There is client code that extends NSURLRequest and expects to get back, in the delegate
+    // callbacks, an object of the same type that they passed into WebKit. To keep then running, we
+    // create an object of the same type and return that. See <rdar://9843582>.
+    // Also, developers really really want an NSMutableURLRequest so try to create an
+    // NSMutableURLRequest instead of NSURLRequest.
+    static Class nsURLRequestClass = [NSURLRequest class];
+    static Class nsMutableURLRequestClass = [NSMutableURLRequest class];
+    Class requestClass = [m_nsRequest.get() class];
+
+    if (!m_cfRequest)
+        return;
+
+    if (requestClass && requestClass != nsURLRequestClass && requestClass != nsMutableURLRequestClass)
+        m_nsRequest = adoptNS([[requestClass alloc] _initWithCFURLRequest:m_cfRequest.get()]);
+    else
+        m_nsRequest = nullptr;
+}
+
+#endif // USE(CFURLCONNECTION)
+
+} // namespace WebCore
+
+#endif // PLATFORM(IOS)
index 4112dbe..73ebd86 100644 (file)
 #import <Foundation/NSURLAuthenticationChallenge.h>
 #import <Foundation/NSURLProtectionSpace.h>
 
+#if USE(CFURLCONNECTION)
+#import "CFNSURLConnectionSPI.h"
+#endif
+
 using namespace WebCore;
 
 @interface WebCoreAuthenticationClientAsChallengeSender : NSObject <NSURLAuthenticationChallengeSender>
 {
     AuthenticationClient* m_client;
+#if USE(CFURLCONNECTION)
+    CFURLAuthChallengeRef m_cfChallenge;
+#endif
 }
 - (id)initWithAuthenticationClient:(AuthenticationClient*)client;
 - (AuthenticationClient*)client;
@@ -94,10 +101,47 @@ using namespace WebCore;
         m_client->receivedCancellation(core(challenge));
 }
 
+#if USE(CFURLCONNECTION)
+- (void)setCFChallenge:(CFURLAuthChallengeRef)challenge
+{
+    m_cfChallenge = challenge;
+}
+
+- (CFURLAuthChallengeRef)cfChallenge
+{
+    return m_cfChallenge;
+}
+#endif
+
 @end
 
 namespace WebCore {
 
+#if USE(CFURLCONNECTION)
+
+AuthenticationChallenge core(NSURLAuthenticationChallenge *macChallenge)
+{
+    WebCoreAuthenticationClientAsChallengeSender *challengeSender = (WebCoreAuthenticationClientAsChallengeSender*) [macChallenge sender];
+    return AuthenticationChallenge([challengeSender cfChallenge], [challengeSender client]);
+}
+
+NSURLAuthenticationChallenge *mac(const AuthenticationChallenge& coreChallenge)
+{
+    AuthenticationClient* authClient = coreChallenge.authenticationClient();
+    RetainPtr<WebCoreAuthenticationClientAsChallengeSender> challengeSender = adoptNS([[WebCoreAuthenticationClientAsChallengeSender alloc] initWithAuthenticationClient:authClient]);
+    RetainPtr<CFURLAuthChallengeRef> authChallenge = coreChallenge.cfURLAuthChallengeRef();
+    if (!authChallenge)
+        authChallenge = adoptCF(createCF(coreChallenge));
+    [challengeSender.get() setCFChallenge:authChallenge.get()];
+#if PLATFORM(IOS)
+    return [[NSURLAuthenticationChallenge _createAuthenticationChallengeForCFAuthChallenge:authChallenge.get() sender:challengeSender.get()] autorelease];
+#else
+    return [[NSURLAuthenticationChallenge _authenticationChallengeForCFAuthChallenge:authChallenge.get() sender:challengeSender.get()] autorelease];
+#endif
+}
+
+#else
+
 AuthenticationChallenge::AuthenticationChallenge(const ProtectionSpace& protectionSpace,
                                                  const Credential& proposedCredential,
                                                  unsigned previousFailureCount,
@@ -171,4 +215,6 @@ AuthenticationChallenge core(NSURLAuthenticationChallenge *macChallenge)
     return AuthenticationChallenge(macChallenge);
 }
 
+#endif // USE(CFURLCONNECTION)
+
 } // namespace WebCore
index 07eea1c..a4cdadf 100644 (file)
 #import "PlatformCookieJar.h"
 
 #import "CFNetworkSPI.h"
-#import "Cookie.h"
-#import "CookieStorage.h"
 #import "NetworkStorageSession.h"
-#import "URL.h"
 #import "WebCoreSystemInterface.h"
 #import <wtf/BlockObjCExceptions.h>
+
+namespace WebCore {
+static NSHTTPCookieStorage *cookieStorage(const NetworkStorageSession&);
+}
+
+#if !USE(CFURLCONNECTION)
+
+#import "Cookie.h"
+#import "CookieStorage.h"
+#import "URL.h"
 #import <wtf/Optional.h>
 #import <wtf/text/StringBuilder.h>
 
@@ -184,7 +191,6 @@ void setCookiesFromDOM(const NetworkStorageSession& session, const URL& firstPar
     NSURL *cookieURL = url;
     NSDictionary *headerFields = [NSDictionary dictionaryWithObject:cookieString forKey:@"Set-Cookie"];
 
-    // FIXME: Is this needed on iOS, too?
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
     NSArray *unfilteredCookies = [NSHTTPCookie _parsedCookiesWithResponseHeaderFields:headerFields forURL:cookieURL];
 #else
@@ -254,15 +260,6 @@ void deleteCookie(const NetworkStorageSession& session, const URL& url, const St
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-static NSHTTPCookieStorage *cookieStorage(const NetworkStorageSession& session)
-{
-    auto cookieStorage = session.cookieStorage();
-    if (!cookieStorage || [NSHTTPCookieStorage sharedHTTPCookieStorage]._cookieStorage == cookieStorage)
-        return [NSHTTPCookieStorage sharedHTTPCookieStorage];
-    
-    return [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cookieStorage.get()] autorelease];
-}
-
 void addCookie(const NetworkStorageSession& session, const URL& url, const Cookie& cookie)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
@@ -283,10 +280,12 @@ void addCookie(const NetworkStorageSession& session, const URL& url, const Cooki
         NSHTTPCookieExpires: [NSDate dateWithTimeIntervalSince1970:cookie.expires / 1000.0],
     }];
 
+#if !USE(CFURLCONNECTION)
     if (!cookieStorage) {
         [WebCore::cookieStorage(session) setCookie:httpCookie];
         return;
     }
+#endif // !USE(CFURLCONNECTION)
 
     CFHTTPCookieStorageSetCookie(cookieStorage.get(), [httpCookie _CFHTTPCookie]);
 
@@ -310,6 +309,21 @@ void deleteAllCookies(const NetworkStorageSession& session)
     wkDeleteAllHTTPCookies(session.cookieStorage().get());
 }
 
+}
+
+#endif // !USE(CFURLCONNECTION)
+
+namespace WebCore {
+
+static NSHTTPCookieStorage *cookieStorage(const NetworkStorageSession& session)
+{
+    auto cookieStorage = session.cookieStorage();
+    if (!cookieStorage || [NSHTTPCookieStorage sharedHTTPCookieStorage]._cookieStorage == cookieStorage)
+        return [NSHTTPCookieStorage sharedHTTPCookieStorage];
+
+    return [[[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:cookieStorage.get()] autorelease];
+}
+
 void deleteCookiesForHostnames(const NetworkStorageSession& session, const Vector<String>& hostnames)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
index f0a4f3a..bc6e0b6 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "CredentialStorage.h"
 
+#if !USE(CFURLCONNECTION)
+
 #include "AuthenticationMac.h"
 #include "Credential.h"
 #include "ProtectionSpace.h"
@@ -50,3 +52,5 @@ void CredentialStorage::saveToPersistentStorage(const ProtectionSpace& protectio
 #endif
 
 } // namespace WebCore
+
+#endif // !USE(CFURLCONNECTION)
index 0e9b6d9..f167daa 100644 (file)
@@ -28,6 +28,8 @@
 
 #pragma once
 
+#if !USE(CFURLCONNECTION)
+
 #include <wtf/Forward.h>
 
 typedef const struct _CFURLRequest* CFURLRequestRef;
@@ -45,3 +47,5 @@ FormData* httpBodyFromStream(NSInputStream *);
 CFStringRef formDataStreamLengthPropertyName();
 
 } // namespace WebCore
+
+#endif // !USE(CFURLCONNECTION)
index ac4e149..f4a0417 100644 (file)
@@ -29,6 +29,8 @@
 #import "config.h"
 #import "FormDataStreamMac.h"
 
+#if !USE(CFURLCONNECTION)
+
 #import "FormData.h"
 #import "FormDataStreamCFNet.h"
 
@@ -49,3 +51,5 @@ FormData* httpBodyFromStream(NSInputStream *stream)
 }
 
 } // namespace WebCore
+
+#endif // !USE(CFURLCONNECTION)
index 709b699..00d6e27 100644 (file)
 #import <Foundation/Foundation.h>
 #import <wtf/BlockObjCExceptions.h>
 
+#if PLATFORM(IOS) && USE(CFURLCONNECTION)
+#import <CFNetwork/CFSocketStreamPriv.h>
+#endif
+
 @interface NSError (WebExtras)
 - (NSString *)_web_localizedDescription;
 @end
@@ -87,6 +91,85 @@ static NSDictionary* dictionaryThatCanCode(NSDictionary* src)
 
 @end
 
+
+#if USE(CFURLCONNECTION)
+static NSError *NSErrorFromCFError(CFErrorRef cfError, NSURL *url)
+{
+    CFIndex errCode = CFErrorGetCode(cfError);
+    if (CFEqual(CFErrorGetDomain(cfError), kCFErrorDomainCFNetwork) && errCode <= kCFURLErrorUnknown && errCode > -4000) {
+        // This is an URL error and needs to be translated to the NSURLErrorDomain
+        id keys[10], values[10];
+        CFDictionaryRef userInfo = CFErrorCopyUserInfo(cfError);
+        NSError *result;
+        NSInteger count = 0;
+
+        if (url) {
+            keys[count] = NSURLErrorFailingURLErrorKey;
+            values[count] = url;
+            count++;
+
+            keys[count] = NSURLErrorFailingURLStringErrorKey;
+            values[count] = [url absoluteString];
+            count++;
+        }
+
+        values[count] = (id)CFDictionaryGetValue(userInfo, kCFErrorLocalizedDescriptionKey);
+        if (values[count]) {
+            keys[count] = NSLocalizedDescriptionKey;
+            count++;
+        }
+
+        values[count] = (id)CFDictionaryGetValue(userInfo, kCFErrorLocalizedFailureReasonKey);
+        if (values[count]) {
+            keys[count] = NSLocalizedFailureReasonErrorKey;
+            count++;
+        }
+
+        values[count] = (id)CFDictionaryGetValue(userInfo, kCFErrorLocalizedRecoverySuggestionKey);
+        if (values[count]) {
+            keys[count] = NSLocalizedRecoverySuggestionErrorKey;
+            count++;
+        }
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+        if (userInfo && (values[count] = (id)CFDictionaryGetValue(userInfo, kCFStreamPropertySSLPeerCertificates)) != nil) {
+            // Need to translate the cert
+            keys[count] = @"NSErrorPeerCertificateChainKey";
+            count++;
+
+            values[count] = (id)CFDictionaryGetValue(userInfo, _kCFStreamPropertySSLClientCertificates);
+            if (values[count]) {
+                keys[count] = @"NSErrorClientCertificateChainKey";
+                count++;
+            }
+
+            values[count] = (id)CFDictionaryGetValue(userInfo, _kCFStreamPropertySSLClientCertificateState);
+            if (values[count]) {
+                keys[count] = @"NSErrorClientCertificateStateKey";
+                count++;
+            }
+        }
+#pragma clang diagnostic pop
+
+        if (userInfo && (values[count] = (id)CFDictionaryGetValue(userInfo, kCFStreamPropertySSLPeerTrust)) != nil) {
+            keys[count] = NSURLErrorFailingURLPeerTrustErrorKey;
+            count++;
+        }
+
+        keys[count] = NSUnderlyingErrorKey;
+        values[count] = (id)cfError;
+        count++;
+
+        result = [WebCustomNSURLError errorWithDomain:NSURLErrorDomain code:(errCode == kCFURLErrorUnknown ? (CFIndex)NSURLErrorUnknown : errCode) userInfo:[NSDictionary dictionaryWithObjects:values forKeys:keys count:count]];
+        if (userInfo)
+            CFRelease(userInfo);
+        return result;
+    }
+    return (NSError *)cfError;
+}
+#endif // USE(CFURLCONNECTION)
+
 #endif // PLATFORM(IOS)
 
 namespace WebCore {
@@ -107,6 +190,53 @@ static RetainPtr<NSError> createNSErrorFromResourceErrorBase(const ResourceError
     return adoptNS([[NSError alloc] initWithDomain:resourceError.domain() code:resourceError.errorCode() userInfo:userInfo.get()]);
 }
 
+#if USE(CFURLCONNECTION)
+
+ResourceError::ResourceError(NSError *error)
+    : ResourceErrorBase(Type::Null)
+    , m_dataIsUpToDate(false)
+    , m_platformError(reinterpret_cast<CFErrorRef>(error))
+{
+    if (error)
+        setType(([error code] == NSURLErrorTimedOut) ? Type::Timeout : Type::General);
+}
+
+NSError *ResourceError::nsError() const
+{
+    if (isNull()) {
+        ASSERT(!m_platformError);
+        return nil;
+    }
+
+    if (m_platformNSError)
+        return m_platformNSError.get();
+
+    if (m_platformError) {
+        CFErrorRef error = m_platformError.get();
+        RetainPtr<CFDictionaryRef> userInfo = adoptCF(CFErrorCopyUserInfo(error));
+#if PLATFORM(IOS)
+        m_platformNSError = NSErrorFromCFError(error, (NSURL *)[(NSDictionary *)userInfo.get() objectForKey:(id) kCFURLErrorFailingURLErrorKey]);
+        // If NSErrorFromCFError created a new NSError for us, return that.
+        if (m_platformNSError.get() != (NSError *)error)
+            return m_platformNSError.get();
+
+        // Otherwise fall through to create a new NSError from the CFError.
+#endif
+        m_platformNSError = adoptNS([[NSError alloc] initWithDomain:(NSString *)CFErrorGetDomain(error) code:CFErrorGetCode(error) userInfo:(NSDictionary *)userInfo.get()]);
+        return m_platformNSError.get();
+    }
+
+    m_platformNSError = createNSErrorFromResourceErrorBase(*this);
+    return m_platformNSError.get();
+}
+
+ResourceError::operator NSError *() const
+{
+    return nsError();
+}
+
+#else
+
 ResourceError::ResourceError(NSError *nsError)
     : ResourceErrorBase(Type::Null)
     , m_dataIsUpToDate(false)
@@ -179,4 +309,6 @@ ResourceError::operator CFErrorRef() const
     return cfError();
 }
 
+#endif // USE(CFURLCONNECTION)
+
 } // namespace WebCore
index c18350a..63521a7 100644 (file)
 #import <wtf/text/Base64.h>
 #import <wtf/text/CString.h>
 
+#if USE(CFURLCONNECTION)
+#if USE(APPLE_INTERNAL_SDK)
+#import <CFNetwork/CFURLConnectionPriv.h>
+#endif
+typedef struct _CFURLConnection* CFURLConnectionRef;
+extern "C" {
+CFDictionaryRef _CFURLConnectionCopyTimingData(CFURLConnectionRef);
+}
+#endif // USE(CFURLCONNECTION)
+
 #if PLATFORM(IOS)
 #import "CFNetworkSPI.h"
 #import "RuntimeApplicationChecks.h"
@@ -80,6 +90,8 @@ using namespace WebCore;
 
 namespace WebCore {
     
+#if !USE(CFURLCONNECTION)
+    
 static void applyBasicAuthorizationHeader(ResourceRequest& request, const Credential& credential)
 {
     String authenticationHeader = "Basic " + base64Encode(String(credential.user() + ":" + credential.password()).utf8());
@@ -317,6 +329,8 @@ void ResourceHandle::platformSetDefersLoading(bool defers)
         [d->m_connection setDefersCallbacks:defers];
 }
 
+#if !USE(CFURLCONNECTION)
+
 void ResourceHandle::schedule(SchedulePair& pair)
 {
     NSRunLoop *runLoop = pair.nsRunLoop();
@@ -335,6 +349,8 @@ void ResourceHandle::unschedule(SchedulePair& pair)
         [d->m_connection.get() unscheduleFromRunLoop:runLoop forMode:(NSString *)pair.mode()];
 }
 
+#endif
+
 id ResourceHandle::makeDelegate(bool shouldUseCredentialStorage)
 {
     ASSERT(!d->m_delegate);
@@ -714,14 +730,27 @@ void ResourceHandle::continueWillCacheResponse(NSCachedURLResponse *response)
 
     [(id)delegate() continueWillCacheResponse:response];
 }
-
+    
+#endif // !USE(CFURLCONNECTION)
+    
 #if ENABLE(WEB_TIMING)
+
+#if USE(CFURLCONNECTION)
+    
+void ResourceHandle::getConnectionTimingData(CFURLConnectionRef connection, NetworkLoadTiming& timing)
+{
+    copyTimingData((__bridge NSDictionary*)adoptCF(_CFURLConnectionCopyTimingData(connection)).get(), timing);
+}
+    
+#else
     
 void ResourceHandle::getConnectionTimingData(NSURLConnection *connection, NetworkLoadTiming& timing)
 {
     copyTimingData([connection _timingData], timing);
 }
     
+#endif
+    
 #endif // ENABLE(WEB_TIMING)
 
 } // namespace WebCore
diff --git a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm
new file mode 100644 (file)
index 0000000..d05efab
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 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. 
+ */
+
+#import "config.h"
+#import "ResourceRequest.h"
+
+#if PLATFORM(MAC)
+
+#import <Foundation/Foundation.h>
+
+@interface NSURLRequest (WebNSURLRequestDetails)
+- (CFURLRequestRef)_CFURLRequest;
+- (id)_initWithCFURLRequest:(CFURLRequestRef)request;
+@end
+
+namespace WebCore {
+
+#if USE(CFURLCONNECTION)
+
+ResourceRequest::ResourceRequest(NSURLRequest *nsRequest)
+    : ResourceRequestBase()
+    , m_cfRequest([nsRequest _CFURLRequest])
+    , m_nsRequest(nsRequest)
+{
+}
+
+void ResourceRequest::updateNSURLRequest()
+{
+    if (m_cfRequest)
+        m_nsRequest = adoptNS([[NSURLRequest alloc] _initWithCFURLRequest:m_cfRequest.get()]);
+}
+
+#endif
+
+} // namespace WebCore
+
+#endif
index 65f76df..dbad144 100644 (file)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "SynchronousLoaderClient.h"
 
+#if !USE(CFURLCONNECTION)
+
 #include "AuthenticationChallenge.h"
 
 namespace WebCore {
@@ -36,10 +38,14 @@ void SynchronousLoaderClient::didReceiveAuthenticationChallenge(ResourceHandle*,
     [challenge.sender() continueWithoutCredentialForAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
 }
 
+#if !USE(CFURLCONNECTION)
 ResourceError SynchronousLoaderClient::platformBadResponseError()
 {
     RetainPtr<NSError> error = adoptNS([[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorBadServerResponse userInfo:nil]);
     return error.get();
 }
+#endif
 
 }
+
+#endif // !USE(CFURLCONNECTION)
index 5754165..a873b48 100644 (file)
@@ -33,8 +33,12 @@ class ResourceHandle;
 - (void)detachHandle;
 @end
 
+#if !USE(CFURLCONNECTION)
+
 @interface WebCoreResourceHandleAsDelegate : NSObject <NSURLConnectionDelegate, WebCoreResourceLoaderDelegate> {
     WebCore::ResourceHandle* m_handle;
 }
 - (id)initWithHandle:(WebCore::ResourceHandle*)handle;
 @end
+
+#endif // !USE(CFURLCONNECTION)
index 1e89462..885f0c0 100644 (file)
@@ -26,6 +26,8 @@
 #import "config.h"
 #import "WebCoreResourceHandleAsDelegate.h"
 
+#if !USE(CFURLCONNECTION)
+
 #import "AuthenticationChallenge.h"
 #import "AuthenticationMac.h"
 #import "Logging.h"
@@ -274,3 +276,6 @@ using namespace WebCore;
 }
 
 @end
+
+#endif // !USE(CFURLCONNECTION)
+
index 984b1e4..03fc6e9 100644 (file)
@@ -25,6 +25,8 @@
 
 #pragma once
 
+#if !USE(CFURLCONNECTION)
+
 #include "WebCoreResourceHandleAsDelegate.h"
 #include <dispatch/dispatch.h>
 #include <wtf/RetainPtr.h>
@@ -55,3 +57,5 @@ class ResourceHandle;
 @interface WebCoreResourceHandleWithCredentialStorageAsOperationQueueDelegate : WebCoreResourceHandleAsOperationQueueDelegate
 
 @end
+
+#endif // !USE(CFURLCONNECTION)
index 21b7678..452d9db 100644 (file)
@@ -26,6 +26,8 @@
 #import "config.h"
 #import "WebCoreResourceHandleAsOperationQueueDelegate.h"
 
+#if !USE(CFURLCONNECTION)
+
 #import "AuthenticationChallenge.h"
 #import "AuthenticationMac.h"
 #import "Logging.h"
@@ -327,3 +329,6 @@ using namespace WebCore;
 }
 
 @end
+
+#endif // !USE(CFURLCONNECTION)
+
index 007b109..f1cca02 100644 (file)
@@ -325,6 +325,7 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse, bool isMainResourceL
 }
 #endif
 
+#if !USE(CFURLCONNECTION)
 NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLRequest *currentRequest, NSURLRequest *newRequest, NSURLResponse *redirectResponse)
 {
     if (redirectResponse)
@@ -338,5 +339,6 @@ NSURLResponse *synthesizeRedirectResponseIfNecessary(NSURLRequest *currentReques
     NSDictionary *synthesizedResponseHeaderFields = @{ @"Location": [[newRequest URL] absoluteString], @"Cache-Control": @"no-store" };
     return [[[NSHTTPURLResponse alloc] initWithURL:[currentRequest URL] statusCode:302 HTTPVersion:(NSString *)kCFHTTPVersion1_1 headerFields:synthesizedResponseHeaderFields] autorelease];
 }
+#endif
 
 }
index b64799e..449708e 100644 (file)
@@ -1,3 +1,13 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        * WebCoreSupport/WebResourceLoadScheduler.cpp:
+        (WebResourceLoadScheduler::scheduleLoad):
+
 2016-10-14  Alex Christensen  <achristensen@webkit.org>
 
         Fix CMake build.
index b728261..f32df71 100644 (file)
@@ -1,3 +1,21 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        * Misc/WebDownload.mm:
+        (-[WebDownload _initWithLoadingCFURLConnection:request:response:delegate:proxy:]):
+        * Misc/WebDownloadInternal.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::convertMainResourceLoadToDownload):
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:]):
+        * WebView/WebView.mm:
+        (-[WebView scheduleInRunLoop:forMode:]):
+        (-[WebView unscheduleFromRunLoop:forMode:]):
+
 2016-10-19  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r207557.
index 29c854d..efa4622 100644 (file)
 
 #import "WebTypesInternal.h"
 
+#if USE(CFURLCONNECTION)
+#import <CFNetwork/CFNetwork.h>
+#import <CFNetwork/CFURLConnection.h>
+#endif
+
 using namespace WebCore;
 
 @class NSURLConnectionDelegateProxy;
@@ -56,6 +61,10 @@ using namespace WebCore;
               delegate:(id)delegate
              directory:(NSString *)directory;
 
+#if USE(CFURLCONNECTION)
+- (id)_initWithLoadingCFURLConnection:(CFURLConnectionRef)connection request:(CFURLRequestRef)request response:(CFURLResponseRef)response delegate:(id)delegate proxy:(NSURLConnectionDelegateProxy *)proxy;
+#endif
+
 @end
 
 @interface WebDownloadInternal : NSObject <NSURLDownloadDelegate>
@@ -218,6 +227,14 @@ using namespace WebCore;
     return [super _initWithLoadingConnection:connection request:request response:response delegate:_webInternal proxy:proxy];
 }
 
+#if USE(CFURLCONNECTION)
+- (id)_initWithLoadingCFURLConnection:(CFURLConnectionRef)connection request:(CFURLRequestRef)request response:(CFURLResponseRef)response delegate:(id)delegate proxy:(NSURLConnectionDelegateProxy *)proxy
+{
+    [self _setRealDelegate:delegate];
+    return [super _initWithLoadingCFURLConnection:connection request:request response:response delegate:_webInternal proxy:proxy];
+}
+#endif
+
 - (id)_initWithRequest:(NSURLRequest *)request
               delegate:(id)delegate
              directory:(NSString *)directory
index e802d49..589fc93 100644 (file)
 */
  
 #import <WebKitLegacy/WebDownload.h>
+
+#if USE(CFURLCONNECTION)
+#import <CFNetwork/CFURLConnection.h>
+#endif
  
 @interface WebDownload (WebDownloadCreation)
-+(id)_downloadWithLoadingConnection:(NSURLConnection *)connection
-                            request:(NSURLRequest *)request
-                           response:(NSURLResponse *)r
-                           delegate:(id)delegate
-                              proxy:(id)proxy;
++(id)_downloadWithLoadingConnection:(NSURLConnection *)connection request:(NSURLRequest *)request response:(NSURLResponse *)r delegate:(id)delegate proxy:(id)proxy;
+
++(id)_downloadWithRequest:(NSURLRequest *)request delegate:(id)delegate directory:(NSString *)directory;
 
-+(id)_downloadWithRequest:(NSURLRequest *)request
-                 delegate:(id)delegate
-                directory:(NSString *)directory;
+#if USE(CFURLCONNECTION)
++ (id)_downloadWithLoadingCFURLConnection:(CFURLConnectionRef)connection request:(CFURLRequestRef)request response:(CFURLResponseRef)response delegate:(id)delegate proxy:(id)proxy;
+#endif
 
 @end
index 8be873b..11476a0 100644 (file)
@@ -304,7 +304,13 @@ void WebFrameLoaderClient::convertMainResourceLoadToDownload(DocumentLoader* doc
 
     ResourceHandle* handle = mainResourceLoader->handle();
 
+#if USE(CFURLCONNECTION)
+    ASSERT([WebDownload respondsToSelector:@selector(_downloadWithLoadingCFURLConnection:request:response:delegate:proxy:)]);
+    auto connection = handle->releaseConnectionForDownload();
+    [WebDownload _downloadWithLoadingCFURLConnection:connection.get() request:request.cfURLRequest(UpdateHTTPBody) response:response.cfURLResponse() delegate:[webView downloadDelegate] proxy:nil];
+#else
     [WebDownload _downloadWithLoadingConnection:handle->connection() request:request.nsURLRequest(UpdateHTTPBody) response:response.nsURLResponse() delegate:[webView downloadDelegate] proxy:nil];
+#endif
 }
 
 bool WebFrameLoaderClient::dispatchDidLoadResourceFromMemoryCache(DocumentLoader* loader, const ResourceRequest& request, const ResourceResponse& response, int length)
index 743198e..075d9ca 100644 (file)
@@ -1801,7 +1801,7 @@ static NSString *classIBCreatorID = nil;
 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
 {
     RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage();
-    ASSERT(cookieStorage); // Will fail when NetworkStorageSession::switchToNewTestingSession() was not called beforehand.
+    ASSERT(cookieStorage); // Will fail when building without USE(CFURLCONNECTION) and NetworkStorageSession::switchToNewTestingSession() was not called beforehand.
     CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
 }
 
index b6b67d0..dcbcf3d 100644 (file)
@@ -6791,14 +6791,24 @@ static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0)
 
 - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode
 {
+#if USE(CFURLCONNECTION)
+    CFRunLoopRef schedulePairRunLoop = [runLoop getCFRunLoop];
+#else
+    NSRunLoop *schedulePairRunLoop = runLoop;
+#endif
     if (runLoop && mode)
-        core(self)->addSchedulePair(SchedulePair::create(runLoop, (CFStringRef)mode));
+        core(self)->addSchedulePair(SchedulePair::create(schedulePairRunLoop, (CFStringRef)mode));
 }
 
 - (void)unscheduleFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode
 {
+#if USE(CFURLCONNECTION)
+    CFRunLoopRef schedulePairRunLoop = [runLoop getCFRunLoop];
+#else
+    NSRunLoop *schedulePairRunLoop = runLoop;
+#endif
     if (runLoop && mode)
-        core(self)->removeSchedulePair(SchedulePair::create(runLoop, (CFStringRef)mode));
+        core(self)->removeSchedulePair(SchedulePair::create(schedulePairRunLoop, (CFStringRef)mode));
 }
 
 static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *string, WebFindOptions options)
index 6273a0f..9760bea 100644 (file)
@@ -1,3 +1,36 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        * DefaultDownloadDelegate.h:
+        * WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebFrameLoaderClient::savePlatformDataToCachedFrame):
+        * WebCoreSupport/WebFrameNetworkingContext.cpp:
+        (WebFrameNetworkingContext::ensurePrivateBrowsingSession):
+        * WebCoreSupport/WebFrameNetworkingContext.h:
+        * WebCoreSupport/WebPlatformStrategies.cpp:
+        * WebDownload.h:
+        * WebError.cpp:
+        (WebError::localizedDescription):
+        (WebError::sslPeerCertificate):
+        * WebError.h:
+        * WebMutableURLRequest.cpp:
+        (WebMutableURLRequest::mutableCopy):
+        * WebURLAuthenticationChallenge.cpp:
+        (WebURLAuthenticationChallenge::initWithProtectionSpace):
+        (WebURLAuthenticationChallenge::initWithAuthenticationChallenge):
+        * WebURLResponse.cpp:
+        (WebURLResponse::sslPeerCertificate):
+        * WebURLResponse.h:
+        * WebView.cpp:
+        (WebView::setCacheModel):
+        (WebView::canHandleRequest):
+        (WebView::notifyPreferencesChanged):
+        (updateSharedSettingsFromPreferencesIfNeeded):
+
 2016-10-18  Darin Adler  <darin@apple.com>
 
         Move many miscellaneous classes from ExceptionCode to Exception
index d54404d..ab2dd48 100644 (file)
@@ -5261,7 +5261,7 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
     hr = preferences->privateBrowsingEnabled(&enabled);
     if (FAILED(hr))
         return hr;
-#if USE(CFURLCONNECTION)
+#if PLATFORM(WIN) || USE(CFURLCONNECTION)
     if (enabled)
         WebFrameNetworkingContext::ensurePrivateBrowsingSession();
     else
index 261a68e..019c3b1 100644 (file)
@@ -1,3 +1,30 @@
+2016-10-19  Alex Christensen  <achristensen@webkit.org>
+
+        Revert r207151
+        https://bugs.webkit.org/show_bug.cgi?id=163675
+
+        Reviewed by Brent Fulgham.
+
+        * NetworkProcess/Downloads/Download.h:
+        * NetworkProcess/Downloads/mac/DownloadMac.mm:
+        * NetworkProcess/NetworkLoad.h:
+        * NetworkProcess/mac/NetworkLoadMac.mm:
+        (WebKit::NetworkLoad::willCacheResponseAsync):
+        * Shared/Authentication/cocoa/AuthenticationManagerCocoa.mm:
+        (WebKit::AuthenticationManager::receivedCredential):
+        (WebKit::AuthenticationManager::receivedRequestToContinueWithoutCredential):
+        (WebKit::AuthenticationManager::receivedCancellation):
+        (WebKit::AuthenticationManager::receivedRequestToPerformDefaultHandling):
+        (WebKit::AuthenticationManager::receivedChallengeRejection):
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * Shared/mac/WebCoreArgumentCodersMac.mm:
+        (IPC::ArgumentCoder<ResourceRequest>::encodePlatformData):
+        (IPC::ArgumentCoder<ResourceRequest>::decodePlatformData):
+        * WebKit2.xcodeproj/project.pbxproj:
+
 2016-10-19  Chris Dumez  <cdumez@apple.com>
 
         [WK2] Expose suggested filename via WKBundleHitTestResult API
index 7989f7e..ef2a7bd 100644 (file)
@@ -47,6 +47,10 @@ OBJC_CLASS WKDownloadAsDelegate;
 #endif
 #endif
 
+#if USE(CFURLCONNECTION)
+#include <CFNetwork/CFURLDownloadPriv.h>
+#endif
+
 namespace IPC {
 class DataReference;
 }
@@ -135,6 +139,9 @@ private:
     RetainPtr<WKDownloadAsDelegate> m_delegate;
 #endif
 #endif
+#if USE(CFURLCONNECTION)
+    RetainPtr<CFURLDownloadRef> m_download;
+#endif
     std::unique_ptr<WebCore::ResourceHandleClient> m_downloadClient;
     RefPtr<WebCore::ResourceHandle> m_resourceHandle;
     String m_suggestedName;
index 883a4b5..bb3ff2b 100644 (file)
@@ -26,7 +26,7 @@
 #import "config.h"
 #import "Download.h"
 
-#if !USE(NETWORK_SESSION)
+#if !USE(CFURLCONNECTION) && !USE(NETWORK_SESSION)
 
 #import <WebCore/AuthenticationChallenge.h>
 #import <WebCore/AuthenticationMac.h>
@@ -272,4 +272,4 @@ static void dispatchOnMainThread(void (^block)())
 
 @end
 
-#endif // !USE(NETWORK_SESSION)
+#endif // !USE(CFURLCONNECTION) && !USE(NETWORK_SESSION)
index 1dd5b39..3b1a05f 100644 (file)
@@ -79,8 +79,12 @@ public:
     void didReceiveDataArray(WebCore::ResourceHandle*, CFArrayRef) override;
 #endif
 #if PLATFORM(COCOA)
+#if USE(CFURLCONNECTION)
+    void willCacheResponseAsync(WebCore::ResourceHandle*, CFCachedURLResponseRef) override;
+#else
     void willCacheResponseAsync(WebCore::ResourceHandle*, NSCachedURLResponse *) override;
 #endif
+#endif
 
 #if USE(PROTECTION_SPACE_AUTH_CALLBACK)
     void continueCanAuthenticateAgainstProtectionSpace(bool);
index a6d6e15..15fbb6d 100644 (file)
@@ -33,6 +33,17 @@ namespace WebKit {
 
 using namespace WebCore;
 
+#if USE(CFURLCONNECTION)
+
+void NetworkLoad::willCacheResponseAsync(ResourceHandle* handle, CFCachedURLResponseRef cfResponse)
+{
+    ASSERT_UNUSED(handle, handle == m_handle);
+
+    m_handle->continueWillCacheResponse(cfResponse);
+}
+
+#else
+
 void NetworkLoad::willCacheResponseAsync(ResourceHandle* handle, NSCachedURLResponse *nsResponse)
 {
     ASSERT_UNUSED(handle, handle == m_handle);
@@ -40,4 +51,6 @@ void NetworkLoad::willCacheResponseAsync(ResourceHandle* handle, NSCachedURLResp
     m_handle->continueWillCacheResponse(nsResponse);
 }
 
+#endif // !USE(CFURLCONNECTION)
+
 } // namespace WebKit
index eed0539..a49a9b1 100644 (file)
@@ -32,27 +32,37 @@ namespace WebKit {
 
 void AuthenticationManager::receivedCredential(const AuthenticationChallenge& authenticationChallenge, const Credential& credential)
 {
+#if !USE(CFURLCONNECTION)
     [authenticationChallenge.sender() useCredential:credential.nsCredential() forAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+#endif
 }
 
 void AuthenticationManager::receivedRequestToContinueWithoutCredential(const AuthenticationChallenge& authenticationChallenge)
 {
+#if !USE(CFURLCONNECTION)
     [authenticationChallenge.sender() continueWithoutCredentialForAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+#endif
 }
 
 void AuthenticationManager::receivedCancellation(const AuthenticationChallenge& authenticationChallenge)
 {
+#if !USE(CFURLCONNECTION)
     [authenticationChallenge.sender() cancelAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+#endif
 }
 
 void AuthenticationManager::receivedRequestToPerformDefaultHandling(const AuthenticationChallenge& authenticationChallenge)
 {
+#if !USE(CFURLCONNECTION)
     [authenticationChallenge.sender() performDefaultHandlingForAuthenticationChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+#endif
 }
 
 void AuthenticationManager::receivedChallengeRejection(const AuthenticationChallenge& authenticationChallenge)
 {
+#if !USE(CFURLCONNECTION)
     [authenticationChallenge.sender() rejectProtectionSpaceAndContinueWithChallenge:authenticationChallenge.nsURLAuthenticationChallenge()];
+#endif
 }
 
 }
index 0b85213..1b00d74 100644 (file)
@@ -104,7 +104,7 @@ void WebProcessCreationParameters::encode(IPC::Encoder& encoder) const
     encoder << textCheckerState;
     encoder << fullKeyboardAccessEnabled;
     encoder << defaultRequestTimeoutInterval;
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || USE(CFURLCONNECTION)
     encoder << uiProcessBundleIdentifier;
 #endif
 #if PLATFORM(COCOA)
@@ -240,7 +240,7 @@ bool WebProcessCreationParameters::decode(IPC::Decoder& decoder, WebProcessCreat
         return false;
     if (!decoder.decode(parameters.defaultRequestTimeoutInterval))
         return false;
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || USE(CFURLCONNECTION)
     if (!decoder.decode(parameters.uiProcessBundleIdentifier))
         return false;
 #endif
index 3c7918c..ec86e1e 100644 (file)
@@ -123,7 +123,7 @@ struct WebProcessCreationParameters {
 
     double defaultRequestTimeoutInterval;
 
-#if PLATFORM(COCOA)
+#if PLATFORM(COCOA) || USE(CFURLCONNECTION)
     String uiProcessBundleIdentifier;
 #endif
 
index 9cedce8..2fe02ab 100644 (file)
 #import <WebCore/ResourceError.h>
 #import <WebCore/ResourceRequest.h>
 
+#if USE(CFURLCONNECTION)
+#import <CFNetwork/CFURLRequest.h>
+#endif
+
 #if ENABLE(WIRELESS_PLAYBACK_TARGET)
 #import <WebCore/AVFoundationSPI.h>
 #import <WebCore/MediaPlaybackTargetContext.h>
@@ -53,6 +57,36 @@ using namespace WebCore;
 
 namespace IPC {
 
+#if USE(CFURLCONNECTION)
+void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const ResourceRequest& resourceRequest)
+{
+    RetainPtr<CFURLRequestRef> requestToSerialize = resourceRequest.cfURLRequest(DoNotUpdateHTTPBody);
+
+    bool requestIsPresent = requestToSerialize;
+    encoder << requestIsPresent;
+
+    if (!requestIsPresent)
+        return;
+
+    // We don't send HTTP body over IPC for better performance.
+    // Also, it's not always possible to do, as streams can only be created in process that does networking.
+    RetainPtr<CFDataRef> requestHTTPBody = adoptCF(CFURLRequestCopyHTTPRequestBody(requestToSerialize.get()));
+    RetainPtr<CFReadStreamRef> requestHTTPBodyStream = adoptCF(CFURLRequestCopyHTTPRequestBodyStream(requestToSerialize.get()));
+    if (requestHTTPBody || requestHTTPBodyStream) {
+        CFMutableURLRequestRef mutableRequest = CFURLRequestCreateMutableCopy(0, requestToSerialize.get());
+        requestToSerialize = adoptCF(mutableRequest);
+        CFURLRequestSetHTTPRequestBody(mutableRequest, nil);
+        CFURLRequestSetHTTPRequestBodyStream(mutableRequest, nil);
+    }
+
+    RetainPtr<CFDictionaryRef> dictionary = adoptCF(WKCFURLRequestCreateSerializableRepresentation(requestToSerialize.get(), IPC::tokenNullTypeRef()));
+    IPC::encode(encoder, dictionary.get());
+
+    // The fallback array is part of CFURLRequest, but it is not encoded by WKCFURLRequestCreateSerializableRepresentation.
+    encoder << resourceRequest.responseContentDispositionEncodingFallbackArray();
+    encoder.encodeEnum(resourceRequest.requester());
+}
+#else
 void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const ResourceRequest& resourceRequest)
 {
     RetainPtr<NSURLRequest> requestToSerialize = resourceRequest.nsURLRequest(DoNotUpdateHTTPBody);
@@ -79,6 +113,7 @@ void ArgumentCoder<ResourceRequest>::encodePlatformData(Encoder& encoder, const
     encoder.encodeEnum(resourceRequest.requester());
     encoder.encodeEnum(resourceRequest.cachePolicy());
 }
+#endif
 
 bool ArgumentCoder<ResourceRequest>::decodePlatformData(Decoder& decoder, ResourceRequest& resourceRequest)
 {
@@ -95,11 +130,19 @@ bool ArgumentCoder<ResourceRequest>::decodePlatformData(Decoder& decoder, Resour
     if (!IPC::decode(decoder, dictionary))
         return false;
 
+#if USE(CFURLCONNECTION)
+    RetainPtr<CFURLRequestRef> cfURLRequest = adoptCF(WKCreateCFURLRequestFromSerializableRepresentation(dictionary.get(), IPC::tokenNullTypeRef()));
+    if (!cfURLRequest)
+        return false;
+
+    resourceRequest = ResourceRequest(cfURLRequest.get());
+#else
     RetainPtr<NSURLRequest> nsURLRequest = WKNSURLRequestFromSerializableRepresentation(dictionary.get(), IPC::tokenNullTypeRef());
     if (!nsURLRequest)
         return false;
 
     resourceRequest = ResourceRequest(nsURLRequest.get());
+#endif
     
     Vector<String> responseContentDispositionEncodingFallbackArray;
     if (!decoder.decode(responseContentDispositionEncodingFallbackArray))
index 6366071..a7ea673 100644 (file)
                5C1427051C23F84C00D41183 /* DownloadID.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426F71C23F84300D41183 /* DownloadID.h */; };
                5C1427061C23F84C00D41183 /* DownloadManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1426F81C23F84300D41183 /* DownloadManager.cpp */; };
                5C1427071C23F84C00D41183 /* DownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426F91C23F84300D41183 /* DownloadManager.h */; };
+               5C1427111C23F89E00D41183 /* DownloadIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C14270D1C23F88500D41183 /* DownloadIOS.mm */; };
                5C1427121C23F89E00D41183 /* DownloadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C14270F1C23F89900D41183 /* DownloadMac.mm */; };
                5C1427131C23F89E00D41183 /* DownloadCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C1427091C23F86900D41183 /* DownloadCocoa.mm */; };
                5C1427181C23F8B700D41183 /* CustomProtocolManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1427141C23F8B000D41183 /* CustomProtocolManager.h */; };
                5C1426F81C23F84300D41183 /* DownloadManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DownloadManager.cpp; path = NetworkProcess/Downloads/DownloadManager.cpp; sourceTree = "<group>"; };
                5C1426F91C23F84300D41183 /* DownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DownloadManager.h; path = NetworkProcess/Downloads/DownloadManager.h; sourceTree = "<group>"; };
                5C1427091C23F86900D41183 /* DownloadCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadCocoa.mm; path = NetworkProcess/Downloads/cocoa/DownloadCocoa.mm; sourceTree = "<group>"; };
+               5C14270D1C23F88500D41183 /* DownloadIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadIOS.mm; path = NetworkProcess/Downloads/ios/DownloadIOS.mm; sourceTree = "<group>"; };
                5C14270F1C23F89900D41183 /* DownloadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DownloadMac.mm; path = NetworkProcess/Downloads/mac/DownloadMac.mm; sourceTree = "<group>"; };
                5C1427141C23F8B000D41183 /* CustomProtocolManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomProtocolManager.h; path = NetworkProcess/CustomProtocols/CustomProtocolManager.h; sourceTree = "<group>"; };
                5C1427151C23F8B000D41183 /* CustomProtocolManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManager.messages.in; path = NetworkProcess/CustomProtocols/CustomProtocolManager.messages.in; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                5C1427081C23F85200D41183 /* cocoa */,
+                               5C14270C1C23F87700D41183 /* ios */,
                                5C14270B1C23F87100D41183 /* mac */,
                                83BFAC411D96136000433490 /* BlobDownloadClient.cpp */,
                                83BFAC401D96136000433490 /* BlobDownloadClient.h */,
                        name = mac;
                        sourceTree = "<group>";
                };
+               5C14270C1C23F87700D41183 /* ios */ = {
+                       isa = PBXGroup;
+                       children = (
+                               5C14270D1C23F88500D41183 /* DownloadIOS.mm */,
+                       );
+                       name = ios;
+                       sourceTree = "<group>";
+               };
                5C14271A1C23F8BF00D41183 /* Cocoa */ = {
                        isa = PBXGroup;
                        children = (
                                5C1427011C23F84C00D41183 /* Download.cpp in Sources */,
                                A1DF631218E0B7C8003A3E2A /* DownloadClient.mm in Sources */,
                                5C1427131C23F89E00D41183 /* DownloadCocoa.mm in Sources */,
+                               5C1427111C23F89E00D41183 /* DownloadIOS.mm in Sources */,
                                5C1427121C23F89E00D41183 /* DownloadMac.mm in Sources */,
                                5C1427061C23F84C00D41183 /* DownloadManager.cpp in Sources */,
                                1AB7D4CB1288AAA700CFD08C /* DownloadProxy.cpp in Sources */,