Diff
Modified: trunk/Source/WebKit/ChangeLog (260913 => 260914)
--- trunk/Source/WebKit/ChangeLog 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Source/WebKit/ChangeLog 2020-04-29 21:18:33 UTC (rev 260914)
@@ -1,3 +1,17 @@
+2020-04-29 Alex Christensen <[email protected]>
+
+ Add WKNavigationDelegate API shouldAllowDeprecatedTLS
+ https://bugs.webkit.org/show_bug.cgi?id=210981
+ <rdar://problem/61742976>
+
+ Reviewed by Geoffrey Garen.
+
+ * UIProcess/API/Cocoa/WKNavigationDelegate.h:
+ * UIProcess/Cocoa/NavigationState.h:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::setNavigationDelegate):
+ (WebKit::NavigationState::NavigationClient::shouldAllowLegacyTLS):
+
2020-04-29 Chris Dumez <[email protected]>
[iOS][WK2] Temporarily stop using RunningBoard for the foreground process assertion
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h (260913 => 260914)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegate.h 2020-04-29 21:18:33 UTC (rev 260914)
@@ -157,6 +157,13 @@
*/
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView WK_API_AVAILABLE(macos(10.11), ios(9.0));
+/*! @abstract Invoked when the web view is establishing a network connection using a deprecated version of TLS.
+ @param webView The web view initiating the connection.
+ @param challenge The authentication challenge.
+ @param decisionHandler The decision handler you must invoke to respond to indicate whether or not to continue with the connection establishment.
+ */
+- (void)webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowDeprecatedTLS:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
@end
NS_ASSUME_NONNULL_END
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h (260913 => 260914)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2020-04-29 21:18:33 UTC (rev 260914)
@@ -230,6 +230,7 @@
bool webViewRenderingProgressDidChange : 1;
bool webViewDidReceiveAuthenticationChallengeCompletionHandler : 1;
bool webViewAuthenticationChallengeShouldAllowLegacyTLS : 1;
+ bool webViewAuthenticationChallengeShouldAllowDeprecatedTLS : 1;
bool webViewDidNegotiateModernTLS : 1;
bool webViewWebContentProcessDidTerminate : 1;
bool webViewWebContentProcessDidTerminateWithReason : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (260913 => 260914)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2020-04-29 21:18:33 UTC (rev 260914)
@@ -179,6 +179,7 @@
m_navigationDelegateMethods.webViewRenderingProgressDidChange = [delegate respondsToSelector:@selector(_webView:renderingProgressDidChange:)];
m_navigationDelegateMethods.webViewDidReceiveAuthenticationChallengeCompletionHandler = [delegate respondsToSelector:@selector(webView:didReceiveAuthenticationChallenge:completionHandler:)];
m_navigationDelegateMethods.webViewAuthenticationChallengeShouldAllowLegacyTLS = [delegate respondsToSelector:@selector(_webView:authenticationChallenge:shouldAllowLegacyTLS:)];
+ m_navigationDelegateMethods.webViewAuthenticationChallengeShouldAllowDeprecatedTLS = [delegate respondsToSelector:@selector(webView:authenticationChallenge:shouldAllowDeprecatedTLS:)];
m_navigationDelegateMethods.webViewDidNegotiateModernTLS = [delegate respondsToSelector:@selector(_webView:didNegotiateModernTLS:)];
m_navigationDelegateMethods.webViewWebContentProcessDidTerminate = [delegate respondsToSelector:@selector(webViewWebContentProcessDidTerminate:)];
m_navigationDelegateMethods.webViewWebContentProcessDidTerminateWithReason = [delegate respondsToSelector:@selector(_webView:webContentProcessDidTerminateWithReason:)];
@@ -1032,7 +1033,8 @@
void NavigationState::NavigationClient::shouldAllowLegacyTLS(WebPageProxy& page, AuthenticationChallengeProxy& authenticationChallenge, CompletionHandler<void(bool)>&& completionHandler)
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewAuthenticationChallengeShouldAllowLegacyTLS)
+ if (!m_navigationState.m_navigationDelegateMethods.webViewAuthenticationChallengeShouldAllowLegacyTLS
+ && !m_navigationState.m_navigationDelegateMethods.webViewAuthenticationChallengeShouldAllowDeprecatedTLS)
return completionHandler(systemAllowsLegacyTLSFor(page));
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
@@ -1039,6 +1041,16 @@
if (!navigationDelegate)
return completionHandler(systemAllowsLegacyTLSFor(page));
+ if (m_navigationState.m_navigationDelegateMethods.webViewAuthenticationChallengeShouldAllowDeprecatedTLS) {
+ auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:authenticationChallenge:shouldAllowDeprecatedTLS:));
+ [navigationDelegate.get() webView:m_navigationState.m_webView authenticationChallenge:wrapper(authenticationChallenge) shouldAllowDeprecatedTLS:makeBlockPtr([checker = WTFMove(checker), completionHandler = WTFMove(completionHandler)](BOOL shouldAllow) mutable {
+ if (checker->completionHandlerHasBeenCalled())
+ return;
+ checker->didCallCompletionHandler();
+ completionHandler(shouldAllow);
+ }).get()];
+ return;
+ }
auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(_webView:authenticationChallenge:shouldAllowLegacyTLS:));
[static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView authenticationChallenge:wrapper(authenticationChallenge) shouldAllowLegacyTLS:makeBlockPtr([checker = WTFMove(checker), completionHandler = WTFMove(completionHandler)](BOOL shouldAllow) mutable {
if (checker->completionHandlerHasBeenCalled())
Modified: trunk/Tools/ChangeLog (260913 => 260914)
--- trunk/Tools/ChangeLog 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Tools/ChangeLog 2020-04-29 21:18:33 UTC (rev 260914)
@@ -1,3 +1,19 @@
+2020-04-29 Alex Christensen <[email protected]>
+
+ Add WKNavigationDelegate API shouldAllowDeprecatedTLS
+ https://bugs.webkit.org/show_bug.cgi?id=210981
+ <rdar://problem/61742976>
+
+ Reviewed by Geoffrey Garen.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm:
+ (-[TLSNavigationDelegate receivedShouldAllowDeprecatedTLS]):
+ (-[TLSNavigationDelegate webView:authenticationChallenge:shouldAllowDeprecatedTLS:]):
+ (TestWebKitAPI::TEST):
+ (-[TLSNavigationDelegate receivedShouldAllowLegacyTLS]): Deleted.
+ (-[TLSNavigationDelegate _webView:authenticationChallenge:shouldAllowLegacyTLS:]): Deleted.
+ * TestWebKitAPI/config.h:
+
2020-04-29 Kate Cheney <[email protected]>
Refactor layout tests after updates to In-App Browser Privacy
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm (260913 => 260914)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TLSDeprecation.mm 2020-04-29 21:18:33 UTC (rev 260914)
@@ -74,14 +74,14 @@
- (void)waitForDidFinishNavigation;
- (void)waitForDidFailProvisionalNavigation;
- (NSURLAuthenticationChallenge *)waitForDidNegotiateModernTLS;
-- (bool)receivedShouldAllowLegacyTLS;
-@property (nonatomic) bool shouldAllowLegacyTLS;
+- (bool)receivedShouldAllowDeprecatedTLS;
+@property (nonatomic) bool shouldAllowDeprecatedTLS;
@end
@implementation TLSNavigationDelegate {
bool _navigationFinished;
bool _navigationFailed;
- bool _receivedShouldAllowLegacyTLS;
+ bool _receivedShouldAllowDeprecatedTLS;
RetainPtr<NSURLAuthenticationChallenge> _negotiatedModernTLS;
}
@@ -104,9 +104,9 @@
return _negotiatedModernTLS.autorelease();
}
-- (bool)receivedShouldAllowLegacyTLS
+- (bool)receivedShouldAllowDeprecatedTLS
{
- return _receivedShouldAllowLegacyTLS;
+ return _receivedShouldAllowDeprecatedTLS;
}
- (void)webView:(WKWebView *)webView didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * credential))completionHandler
@@ -125,10 +125,10 @@
_navigationFailed = true;
}
-- (void)_webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowLegacyTLS:(void (^)(BOOL))completionHandler
+- (void)webView:(WKWebView *)webView authenticationChallenge:(NSURLAuthenticationChallenge *)challenge shouldAllowDeprecatedTLS:(void (^)(BOOL))completionHandler
{
- _receivedShouldAllowLegacyTLS = true;
- completionHandler([self shouldAllowLegacyTLS]);
+ _receivedShouldAllowDeprecatedTLS = true;
+ completionHandler([self shouldAllowDeprecatedTLS]);
}
- (void)_webView:(WKWebView *)webView didNegotiateModernTLS:(NSURLAuthenticationChallenge *)challenge
@@ -158,8 +158,9 @@
[delegate waitForDidFinishNavigation];
}
-// FIXME: This test should remain disabled until rdar://problem/56522601 is fixed.
-TEST(TLSVersion, DISABLED_NetworkSession)
+#if HAVE(TLS_VERSION_DURING_CHALLENGE)
+
+TEST(TLSVersion, NetworkSession)
{
static auto delegate = adoptNS([TestNavigationDelegate new]);
auto makeWebViewWith = [&] (WKWebsiteDataStore *store) {
@@ -216,13 +217,11 @@
[[NSUserDefaults standardUserDefaults] removeObjectForKey:defaultsKey];
}
-// FIXME: This test should remain disabled until rdar://problem/56522601 is fixed.
-TEST(TLSVersion, DISABLED_NavigationDelegateSPI)
+TEST(TLSVersion, ShouldAllowDeprecatedTLS)
{
{
auto delegate = adoptNS([TLSNavigationDelegate new]);
TCPServer server(TCPServer::Protocol::HTTPS, [](SSL *ssl) {
- // FIXME: This is only if we have the new SPI.
EXPECT_FALSE(ssl);
}, tls1_1);
auto webView = adoptNS([WKWebView new]);
@@ -229,20 +228,22 @@
[webView setNavigationDelegate:delegate.get()];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
[delegate waitForDidFailProvisionalNavigation];
- EXPECT_TRUE([delegate receivedShouldAllowLegacyTLS]);
+ EXPECT_TRUE([delegate receivedShouldAllowDeprecatedTLS]);
}
{
auto delegate = adoptNS([TLSNavigationDelegate new]);
- delegate.get().shouldAllowLegacyTLS = YES;
+ delegate.get().shouldAllowDeprecatedTLS = YES;
TCPServer server(TCPServer::Protocol::HTTPS, TCPServer::respondWithOK, tls1_1);
auto webView = adoptNS([WKWebView new]);
[webView setNavigationDelegate:delegate.get()];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://127.0.0.1:%d/", server.port()]]]];
[delegate waitForDidFinishNavigation];
- EXPECT_TRUE([delegate receivedShouldAllowLegacyTLS]);
+ EXPECT_TRUE([delegate receivedShouldAllowDeprecatedTLS]);
}
}
+#endif // HAVE(TLS_VERSION_DURING_CHALLENGE)
+
#if HAVE(NETWORK_FRAMEWORK) && HAVE(TLS_PROTOCOL_VERSION_T)
static std::pair<RetainPtr<WKWebView>, RetainPtr<TestNavigationDelegate>> webViewWithNavigationDelegate()
Modified: trunk/Tools/TestWebKitAPI/config.h (260913 => 260914)
--- trunk/Tools/TestWebKitAPI/config.h 2020-04-29 20:39:03 UTC (rev 260913)
+++ trunk/Tools/TestWebKitAPI/config.h 2020-04-29 21:18:33 UTC (rev 260914)
@@ -126,3 +126,7 @@
#if PLATFORM(COCOA) && !(PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500)
#define HAVE_TLS_PROTOCOL_VERSION_T 1
#endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
+#define HAVE_TLS_VERSION_DURING_CHALLENGE 1
+#endif