WKWebView should ask WKNavigationDelegate about bad ssl certificates
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2016 19:19:24 +0000 (19:19 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2016 19:19:24 +0000 (19:19 +0000)
commit57bab5cf710f6124ace4ad4b077ba1a40665eee5
tree6de720067f1a27dc1cb7a0bdb4d6ff0cc1a544d2
parent79558704a08ccb0c51353f16a2d3ee15865164a3
WKWebView should ask WKNavigationDelegate about bad ssl certificates
https://bugs.webkit.org/show_bug.cgi?id=159176
Source/WebKit2:

rdar://problem/26864882

Patch by Alex Christensen <achristensen@webkit.org> on 2016-06-29
Reviewed by Sam Weinig.

This can be tested manually by visiting a site in MiniBrowser that has invalid ssl certificates, but we don't have proper ssl testing yet.
Before this change, we would just open the site as if nothing were invalid, now we call the WKNavigationDelegate's didReceiveAuthenticationChallenge
like we did before using NSURLSession, and we do not open the page, also like we did before using NSURLSession.

* NetworkProcess/NetworkLoad.cpp:
(WebKit::NetworkLoad::continueCanAuthenticateAgainstProtectionSpace):
When using NSURLConnection and responding to canAuthenticateAgainstProtectionSpace with YES,
we get an NSURLAuthenticationChallenge when a bad ssl certificate is encountered in the handshake.
When using NSURLSession, we want to call webView:didReceiveAuthenticationChallenge:completionHandler: in this case.
The default implementation of NavigationState::NavigationClient::canAuthenticateAgainstProtectionSpace returns true
if there is an implementation of webView:didReceiveAuthenticationChallenge:completionHandler: in its WKNavigationDelegate.
Internal clients can implement _webView:canAuthenticateAgainstProtectionSpace:
and Safari uses canHandleHTTPSServerTrustEvaluation, so it will be unaffected.

Tools:

Patch by Alex Christensen <achristensen@webkit.org> on 2016-06-29
Reviewed by Sam Weinig.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController webView:didFinishLoadingNavigation:]):
(-[WK2BrowserWindowController webView:didReceiveAuthenticationChallenge:completionHandler:]):
(-[WK2BrowserWindowController webView:didFailNavigation:withError:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/NetworkLoad.cpp
Tools/ChangeLog
Tools/MiniBrowser/mac/WK2BrowserWindowController.m