WKWebView.goBack should reload if there is a safe browsing warning
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 19:42:27 +0000 (19:42 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Jan 2019 19:42:27 +0000 (19:42 +0000)
commite0af3ffdeccad7ebebba2d9749e9f1cbc061eab8
tree247728a0d4582b402856c42244c2f8001b43c283
parent13722698014463f35c474b0784c3da0d0f7c1ef6
WKWebView.goBack should reload if there is a safe browsing warning
https://bugs.webkit.org/show_bug.cgi?id=193805
<rdar://problem/46908216>

Reviewed by Geoff Garen.

Source/WebKit:

If a WKWebView is showing a safe browsing warning and the user clicks a back button
in the app which calls WKWebView.goBack, the WKWebView is in a state where it has not navigated yet,
so actually going back will appear to the user to go back twice.  We can't just do nothing because the
app is in a state where it is expecting a navigation to happen.  Reloading achieves what the user expects
and makes the app work like the app expects.

* UIProcess/API/C/WKPage.cpp:
(WKPageGoBack):
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView goBack]):
* UIProcess/PageClient.h:
(WebKit::PageClient::hasSafeBrowsingWarning const):
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::hasSafeBrowsingWarning const):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(+[Simple3LookupContext sharedLookupContext]):
(-[Simple3LookupContext lookUpURL:completionHandler:]):
(-[WKWebViewGoBackNavigationDelegate webView:didFinishNavigation:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240490 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/C/WKPage.cpp
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/mac/PageClientImplMac.h
Source/WebKit/UIProcess/mac/PageClientImplMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm