Navigations away from the SafeBrowsing interstitial show a flash of old content
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2018 00:55:10 +0000 (00:55 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2018 00:55:10 +0000 (00:55 +0000)
commit13e5d98aa5fdfa0edae6c1655427b2c570efdd32
treef06b32ac23210bbd237eb2c9abdb5fd0cd65daf9
parent17218e24f1cb05aac78cb951ab7d1208c405f2e4
Navigations away from the SafeBrowsing interstitial show a flash of old content
https://bugs.webkit.org/show_bug.cgi?id=192676

Reviewed by Chris Dumez.

Source/WebKit:

When a user clicks through a safe browsing warning, do not remove the warning until content is drawn for the destination.
Otherwise, the user will confusingly see the page before the warning while the navigation happens.
We can only do this for warnings caused by main frame navigations, though.  Other warnings (such as those caused by iframes)
need to be cleared immediately, and we still need to clear the warning immediately if the user has said to go back.

This change is reflected in an updated API test.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _showSafeBrowsingWarning:completionHandler:]):
* UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm:
(WebKit::SafeBrowsingWarning::SafeBrowsingWarning):
* UIProcess/Cocoa/WKSafeBrowsingWarning.h:
* UIProcess/Cocoa/WKSafeBrowsingWarning.mm:
(-[WKSafeBrowsingWarning forMainFrameNavigation]):
* UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::beginSafeBrowsingCheck):
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::showSafeBrowsingWarning):
(WebKit::WebViewImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):
* UIProcess/PageClient.h:
(WebKit::PageClient::clearSafeBrowsingWarningIfForMainFrameNavigation):
* UIProcess/SafeBrowsingWarning.h:
(WebKit::SafeBrowsingWarning::create):
(WebKit::SafeBrowsingWarning::forMainFrameNavigation const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didReachLayoutMilestone):
(WebKit::WebPageProxy::beginSafeBrowsingCheck):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/mac/PageClientImplMac.h:
* UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::clearSafeBrowsingWarningIfForMainFrameNavigation):

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(safeBrowsingView):
(TEST):
(-[SafeBrowsingHelper webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239408 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/Cocoa/SafeBrowsingWarningCocoa.mm
Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.h
Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/Cocoa/WebViewImpl.h
Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
Source/WebKit/UIProcess/PageClient.h
Source/WebKit/UIProcess/SafeBrowsingWarning.h
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.h
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/mac/PageClientImplMac.h
Source/WebKit/UIProcess/mac/PageClientImplMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm