Diff
Modified: trunk/Source/WebCore/ChangeLog (210889 => 210890)
--- trunk/Source/WebCore/ChangeLog 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/ChangeLog 2017-01-18 22:52:17 UTC (rev 210890)
@@ -1,3 +1,28 @@
+2017-01-18 Alex Christensen <[email protected]>
+
+ Fix CFURLConnection build on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=167168
+
+ Reviewed by Andy Estes.
+
+ This is old code, and it hurts to do this, but I need this working to compare with Windows
+ to get the ResourceHandleCFURLConnectionDelegateWithOperationQueue working so we can make
+ loading asynchronous in WebCore.
+
+ * page/mac/PageMac.mm:
+ (WebCore::Page::platformInitialize):
+ * platform/network/cf/AuthenticationCF.cpp:
+ * platform/network/cf/ResourceHandleCFNet.cpp:
+ (WebCore::ResourceHandle::createCFURLConnection):
+ * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
+ (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
+ * platform/network/cocoa/ResourceRequestCocoa.mm:
+ (WebCore::ResourceRequest::clearOrUpdateNSURLRequest):
+ Moved from iOS-specific file. It's needed on Mac using CFURLConnection, too.
+ * platform/network/ios/ResourceRequestIOS.mm:
+ (WebCore::ResourceRequest::clearOrUpdateNSURLRequest): Deleted.
+
2017-01-18 Michael Catanzaro <[email protected]>
REGRESSION(r210531): Broke local resource loads from custom local protocols
Modified: trunk/Source/WebCore/page/mac/PageMac.mm (210889 => 210890)
--- trunk/Source/WebCore/page/mac/PageMac.mm 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/page/mac/PageMac.mm 2017-01-18 22:52:17 UTC (rev 210890)
@@ -51,8 +51,12 @@
addSchedulePair(SchedulePair::create(WebThreadNSRunLoop(), kCFRunLoopCommonModes));
#endif // USE(CFURLCONNECTION)
#else
+#if USE(CFURLCONNECTION)
+ addSchedulePair(SchedulePair::create([[NSRunLoop currentRunLoop] getCFRunLoop], kCFRunLoopCommonModes));
+#else
addSchedulePair(SchedulePair::create([NSRunLoop currentRunLoop], kCFRunLoopCommonModes));
#endif
+#endif
#if ENABLE(TREE_DEBUGGING)
static std::once_flag onceFlag;
Modified: trunk/Source/WebCore/platform/network/cf/AuthenticationCF.cpp (210889 => 210890)
--- trunk/Source/WebCore/platform/network/cf/AuthenticationCF.cpp 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/platform/network/cf/AuthenticationCF.cpp 2017-01-18 22:52:17 UTC (rev 210890)
@@ -93,6 +93,7 @@
return result;
}
+#if !PLATFORM(COCOA)
CFURLCredentialRef createCF(const Credential& coreCredential)
{
CFURLCredentialPersistence persistence = kCFURLCredentialPersistenceNone;
@@ -274,6 +275,7 @@
CFURLProtectionSpaceGetRealm(cfSpace),
scheme);
}
+#endif
}
Modified: trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp (210889 => 210890)
--- trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp 2017-01-18 22:52:17 UTC (rev 210890)
@@ -171,9 +171,12 @@
#else
if (allowsAnyHTTPSCertificateHosts().contains(firstRequest().url().host())) {
sslProps = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsAnyRoot, kCFBooleanTrue);
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsExpiredRoots, kCFBooleanTrue);
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLAllowsExpiredCertificates, kCFBooleanTrue);
+#pragma clang diagnostic pop
CFDictionaryAddValue(sslProps.get(), kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);
}
Modified: trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp (210889 => 210890)
--- trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp 2017-01-18 22:52:17 UTC (rev 210890)
@@ -65,6 +65,8 @@
{
#if PLATFORM(IOS)
CFURLRequestSetShouldStartSynchronously(request, 1);
+#else
+ UNUSED_PARAM(request);
#endif
}
@@ -259,13 +261,13 @@
LOG(Network, "CFNet - SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace(handle=%p (%s)", m_handle, m_handle->firstRequest().url().string().utf8().data());
+ ProtectionSpace coreProtectionSpace = ProtectionSpace(protectionSpace);
#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));
+ return m_handle->canAuthenticateAgainstProtectionSpace(coreProtectionSpace);
#endif
}
#endif // USE(PROTECTION_SPACE_AUTH_CALLBACK)
Modified: trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm (210889 => 210890)
--- trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/platform/network/cocoa/ResourceRequestCocoa.mm 2017-01-18 22:52:17 UTC (rev 210890)
@@ -61,8 +61,30 @@
return [[m_nsRequest.get() retain] autorelease];
}
-#if !USE(CFURLCONNECTION)
+#if USE(CFURLCONNECTION)
+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;
+}
+
+#else
+
CFURLRequestRef ResourceRequest::cfURLRequest(HTTPBodyUpdatePolicy bodyPolicy) const
{
return [nsURLRequest(bodyPolicy) _CFURLRequest];
Modified: trunk/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm (210889 => 210890)
--- trunk/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebCore/platform/network/ios/ResourceRequestIOS.mm 2017-01-18 22:52:17 UTC (rev 210890)
@@ -50,26 +50,6 @@
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
Modified: trunk/Source/WebKit2/ChangeLog (210889 => 210890)
--- trunk/Source/WebKit2/ChangeLog 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebKit2/ChangeLog 2017-01-18 22:52:17 UTC (rev 210890)
@@ -1,5 +1,26 @@
2017-01-18 Alex Christensen <[email protected]>
+ Fix CFURLConnection build on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=167168
+
+ Reviewed by Andy Estes.
+
+ * NetworkProcess/Downloads/mac/DownloadMac.mm:
+ (WebKit::Download::resume):
+ (WebKit::Download::platformDidFinish):
+ (WebKit::Download::platformCancelNetworkLoad):
+ (WebKit::Download::startNetworkLoadWithHandle):
+ (WebKit::Download::startNetworkLoad):
+ (WebKit::Download::platformInvalidate):
+ * NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
+ (WebKit::NetworkDataTaskCocoa::allowsSpecificHTTPSCertificateForHost):
+ (WebKit::serverTrustCredential):
+ * Shared/Authentication/mac/AuthenticationManager.mac.mm:
+ (WebKit::AuthenticationManager::tryUseCertificateInfoForChallenge):
+ * config.h:
+
+2017-01-18 Alex Christensen <[email protected]>
+
Modernize DelayedReply IPC code
https://bugs.webkit.org/show_bug.cgi?id=167176
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm (210889 => 210890)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/mac/DownloadMac.mm 2017-01-18 22:52:17 UTC (rev 210890)
@@ -26,7 +26,7 @@
#import "config.h"
#import "Download.h"
-#if !USE(CFURLCONNECTION) && !USE(NETWORK_SESSION)
+#if !USE(NETWORK_SESSION)
#import <WebCore/AuthenticationChallenge.h>
#import <WebCore/AuthenticationMac.h>
@@ -38,6 +38,44 @@
#import "DataReference.h"
#import "WebPage.h"
+#if USE(CFURLCONNECTION)
+
+namespace WebKit {
+
+void Download::resume(const IPC::DataReference&, const String&, const SandboxExtension::Handle&)
+{
+ notImplemented();
+}
+
+void Download::platformDidFinish()
+{
+ notImplemented();
+}
+
+void Download::platformCancelNetworkLoad()
+{
+ notImplemented();
+}
+
+void Download::startNetworkLoadWithHandle(WebCore::ResourceHandle*, const WebCore::ResourceResponse&)
+{
+ notImplemented();
+}
+
+void Download::startNetworkLoad()
+{
+ notImplemented();
+}
+
+void Download::platformInvalidate()
+{
+ notImplemented();
+}
+
+}
+
+#else
+
@interface WKDownloadAsDelegate : NSObject <NSURLDownloadDelegate> {
WebKit::Download* _download;
}
@@ -272,4 +310,5 @@
@end
-#endif // !USE(CFURLCONNECTION) && !USE(NETWORK_SESSION)
+#endif // USE(CFURLCONNECTION)
+#endif // !USE(NETWORK_SESSION)
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm (210889 => 210890)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm 2017-01-18 22:52:17 UTC (rev 210890)
@@ -40,6 +40,7 @@
#import <WebCore/CFNetworkSPI.h>
#import <WebCore/FileSystem.h>
#import <WebCore/NetworkStorageSession.h>
+#import <WebCore/NotImplemented.h>
#import <WebCore/ResourceRequest.h>
#import <wtf/MainThread.h>
#import <wtf/text/Base64.h>
@@ -278,6 +279,7 @@
download.setSandboxExtension(WTFMove(m_sandboxExtension));
}
+#if !USE(CFURLCONNECTION)
static bool certificatesMatch(SecTrustRef trust1, SecTrustRef trust2)
{
if (!trust1 || !trust2)
@@ -299,6 +301,7 @@
return true;
}
+#endif
bool NetworkDataTaskCocoa::allowsSpecificHTTPSCertificateForHost(const WebCore::AuthenticationChallenge& challenge)
{
@@ -315,7 +318,12 @@
return false;
RetainPtr<SecTrustRef> trust = adoptCF(trustRef);
+#if USE(CFURLCONNECTION)
+ notImplemented();
+ return false;
+#else
return certificatesMatch(trust.get(), challenge.nsURLAuthenticationChallenge().protectionSpace.serverTrust);
+#endif
}
String NetworkDataTaskCocoa::suggestedFilename() const
@@ -363,7 +371,12 @@
WebCore::Credential serverTrustCredential(const WebCore::AuthenticationChallenge& challenge)
{
+#if USE(CFURLCONNECTION)
+ notImplemented();
+ return { };
+#else
return WebCore::Credential([NSURLCredential credentialForTrust:challenge.nsURLAuthenticationChallenge().protectionSpace.serverTrust]);
+#endif
}
}
Modified: trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm (210889 => 210890)
--- trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebKit2/Shared/Authentication/mac/AuthenticationManager.mac.mm 2017-01-18 22:52:17 UTC (rev 210890)
@@ -31,6 +31,7 @@
#include <Security/SecIdentity.h>
#include <WebCore/AuthenticationChallenge.h>
#include <WebCore/CertificateInfo.h>
+#include <WebCore/NotImplemented.h>
using namespace WebCore;
@@ -80,8 +81,13 @@
LOG_ERROR("Unable to create SecIdentityRef with certificate - %i", result);
if (completionHandler)
completionHandler(AuthenticationChallengeDisposition::Cancel, { });
- else
+ else {
+#if USE(CFURLCONNECTION)
+ notImplemented();
+#else
[challenge.sender() cancelAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
+#endif
+ }
return true;
}
@@ -88,8 +94,13 @@
NSURLCredential *credential = [NSURLCredential credentialWithIdentity:identity certificates:chain(certificateInfo) persistence:NSURLCredentialPersistenceNone];
if (completionHandler)
completionHandler(AuthenticationChallengeDisposition::UseCredential, Credential(credential));
- else
+ else {
+#if USE(CFURLCONNECTION)
+ notImplemented();
+#else
[challenge.sender() useCredential:credential forAuthenticationChallenge:challenge.nsURLAuthenticationChallenge()];
+#endif
+ }
return true;
}
Modified: trunk/Source/WebKit2/config.h (210889 => 210890)
--- trunk/Source/WebKit2/config.h 2017-01-18 22:48:07 UTC (rev 210889)
+++ trunk/Source/WebKit2/config.h 2017-01-18 22:52:17 UTC (rev 210890)
@@ -75,6 +75,12 @@
#endif
#endif
+#if USE(CFURLCONNECTION)
+#ifndef USE_NETWORK_SESSION
+#define USE_NETWORK_SESSION 0
+#endif
+#endif
+
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) \
|| (PLATFORM(IOS) && TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) \
|| (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 100000) \