WKNavigationDelegatePrivate client redirect SPI needs to be able to detect redirects...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2017 21:26:24 +0000 (21:26 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2017 21:26:24 +0000 (21:26 +0000)
commit629e783b6de89c7fa3b1103a3de51a1f8c9547ce
tree943e0f1e87c24e88845ba521a64b3260f49cd8fe
parent14668f9ea2ce4c8e52aee4c4701364bf97813d27
WKNavigationDelegatePrivate client redirect SPI needs to be able to detect redirects scheduled before the document finishes loading
https://bugs.webkit.org/show_bug.cgi?id=176128
rdar://problem/34068476

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

Source/WebCore:

Removed FrameLoaderClient::dispatchDidPerformClientRedirect() since no client cares about this event anymore.
Also removed FrameLoader::performClientRedirect() since it wouldn't do anything but call changeLocation().

No new tests - no change in functionality.

* loader/FrameLoader.cpp:
* loader/FrameLoader.h:
* loader/FrameLoaderClient.h:
* loader/NavigationScheduler.cpp:

Source/WebKit:

_webView:didPerformClientRedirect: isn't useful for delegates that want to know about client redirects
started before the document is finished loading. This is because the method would be called after the
navigation scheduler's timer fires and the navigation for the redirect has begun. Since this happens in
a later iteration of the run loop, the document has already finished loading. Address this by replacing
the method with two that give the navigation delegate more information about when client redirects are
scheduled and canceled.

* UIProcess/API/APINavigationClient.h:
(API::NavigationClient::willPerformClientRedirect):
(API::NavigationClient::didCancelClientRedirect):
* UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
* UIProcess/Cocoa/NavigationState.h:
* UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::setNavigationDelegate):
(WebKit::NavigationState::NavigationClient::willPerformClientRedirect):
(WebKit::NavigationState::NavigationClient::didCancelClientRedirect):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::willPerformClientRedirectForFrame):
(WebKit::WebPageProxy::didCancelClientRedirectForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidCancelClientRedirect):
(WebKit::WebFrameLoaderClient::dispatchWillPerformClientRedirect):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:

Tools:

Removed API test for the deleted WKNavigationDelegatePrivate method,
and added two new tests for the two new methods.

* TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
(-[ClientRedirectNavigationDelegate _webView:willPerformClientRedirectToURL:delay:]):
(-[ClientRedirectNavigationDelegate _webViewDidCancelClientRedirect:]):
(-[ClientRedirectNavigationDelegate webView:didFinishNavigation:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221444 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/WebKitCocoa/Navigation.mm