[webkit-changes] [WebKit/WebKit] d417f6: Inform client if intercepted navigation failed
Matthew Finkel
noreply at github.com
Mon Aug 28 11:47:30 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d417f615be0edfa07b8c7260a13e8b1599731aaf
https://github.com/WebKit/WebKit/commit/d417f615be0edfa07b8c7260a13e8b1599731aaf
Author: Matthew Finkel <sysrqb at apple.com>
Date: 2023-08-28 (Mon, 28 Aug 2023)
Changed paths:
M Source/WebKit/UIProcess/Cocoa/NavigationState.mm
M Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp
M Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h
M Source/WebKit/UIProcess/WebFrameProxy.cpp
M Source/WebKit/UIProcess/WebFrameProxy.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm
Log Message:
-----------
Inform client if intercepted navigation failed
https://bugs.webkit.org/show_bug.cgi?id=260638
rdar://105809792
Reviewed by Brent Fulgham and J Pascoe.
A client may allow a navigation, but that navigation is ignored anyway. In this
situation, the client may never learn that the navigation was canceled. In the
specific case for SOAuthentication, the client may allow the navigation but
then that decision is overridden by SOAuthentication and the request is
cancelled. When this happens, WebKit doesn't dispatch a failure because we
never reach the provisional load stage.
This change addresses this issue by identifying when a policy decision was
intercepted and the resulting decision is PolicyAction::Ignore. In this case,
we dispatch didFailProvisionalNavigation. We make this call in
WebPageProxy::receivedNavigationPolicyDecision because if we call it earlier
then WKWebView::isLoading returns true and this is wrong and confuses clients.
Most of this patch is just plumbing.
This change extends the existing test and resolves the FIXME.
* Source/WebKit/UIProcess/Cocoa/NavigationState.mm:
(WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
* Source/WebKit/UIProcess/WebFramePolicyListenerProxy.cpp:
(WebKit::WebFramePolicyListenerProxy::didReceiveAppBoundDomainResult):
(WebKit::WebFramePolicyListenerProxy::didReceiveSafeBrowsingResults):
(WebKit::WebFramePolicyListenerProxy::didReceiveInitialLinkDecorationFilteringData):
(WebKit::WebFramePolicyListenerProxy::use):
(WebKit::WebFramePolicyListenerProxy::download):
(WebKit::WebFramePolicyListenerProxy::ignore):
* Source/WebKit/UIProcess/WebFramePolicyListenerProxy.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::setUpPolicyListenerProxy):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::receivedNavigationPolicyDecision):
(WebKit::WebPageProxy::decidePolicyForNavigationAction):
(WebKit::WebPageProxy::decidePolicyForNewWindowAction):
(WebKit::WebPageProxy::decidePolicyForResponseShared):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SOAuthorizationTests.mm:
(-[TestSOAuthorizationDelegate webView:didFailProvisionalNavigation:withError:]):
(resetState):
(TestWebKitAPI::TEST):
Canonical link: https://commits.webkit.org/267360@main
More information about the webkit-changes
mailing list