Add SPI to notify WKNavigationDelegate about client redirects
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 00:39:09 +0000 (00:39 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 00:39:09 +0000 (00:39 +0000)
commit9475f62f3602aa91309f00c64e4430a25d5ae4e9
tree32cec488d53aa85eff45b4b4a652e0f5d2090642
parent057552ca85b3efd9c97d13a0f044abd0daba7526
Add SPI to notify WKNavigationDelegate about client redirects
https://bugs.webkit.org/show_bug.cgi?id=174680
rdar://problem/33184886

Patch by David Quesada <david_quesada@apple.com> on 2017-07-20
Reviewed by Brady Eidson.

Source/WebCore:

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::performClientRedirect):
* loader/FrameLoader.h:
Add a convenience method for NavigationScheduler that handles a FrameLoadRequest
as a client redirect. Currently this means loading the request and informing the
client about it.

* loader/FrameLoaderClient.h:
Add FrameLoaderClient::dispatchDidPerformClientRedirect() to inform the client when
a client redirect occurs.

* loader/NavigationScheduler.cpp:
Removed ScheduledURLNavigation::fire(). This class was never instantiated directly,
and all subclasses override fire(), so this was unused code.
For ScheduledRedirects and ScheduledLocationChange, use FrameLoader's new method to
load the request as a client redirect.

Source/WebKit:

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::didPerformClientRedirectForNavigation):
Add a new virtual method for navigation clients to implement if they want to be informed
when the page is initiating a navigation that is a client redirect.

* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
Declare the new WKNavigationDelegate method -_webView:didPerformClientRedirectForNavigation:

* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::didPerformClientRedirectForNavigation):
Add a new method to NavigationState method to tell the WKNavigationDelegate when a
client redirect happens.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didPerformClientRedirectForLoadForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
Allow the WebPageProxy to receive a message from the web process when a client redirect happens.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidPerformClientRedirect):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
Send this new message to the UI process on client redirects.

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/Navigation.mm:
(-[DidPerformClientRedirectNavigationDelegate _webView:didPerformClientRedirectForNavigation:]):
(TEST):
Add API test for -[id<WKNavigationDelegatePrivate> _webView:didPerformClientRedirectForNavigation:].

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@219709 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/loader/FrameLoader.h
Source/WebCore/loader/FrameLoaderClient.h
Source/WebCore/loader/NavigationScheduler.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APINavigationClient.h
Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h
Source/WebKit/UIProcess/Cocoa/NavigationState.h
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Navigation.mm