Diff
Modified: trunk/Source/WebKit/ChangeLog (257962 => 257963)
--- trunk/Source/WebKit/ChangeLog 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/ChangeLog 2020-03-06 02:37:45 UTC (rev 257963)
@@ -1,5 +1,64 @@
2020-03-05 Alex Christensen <achristen...@webkit.org>
+ Add WKNavigationDelegatePrivate SPI to inform application of subframe navigations
+ https://bugs.webkit.org/show_bug.cgi?id=208670
+
+ Reviewed by Brady Eidson.
+
+ There is no WKNavigation for subframe navigations, so just expose the NSURLRequest directly.
+ This is equivalent to WKNavigation._request, which is distinct from WKFrameInfo.request.
+ The former is the currently pending request, the latter is the request that has already loaded.
+ I needed to move the isMainFrame check to the NavigationClient implementations.
+ This is needed for <rdar://problem/57201034>.
+ Covered by API tests.
+
+ * UIProcess/API/APINavigationClient.h:
+ (API::NavigationClient::didStartProvisionalNavigation):
+ (API::NavigationClient::didFailProvisionalNavigationWithError):
+ (API::NavigationClient::didCommitNavigation):
+ (API::NavigationClient::didFinishNavigation):
+ (API::NavigationClient::didFailNavigationWithError):
+ (API::NavigationClient::didFailProvisionalLoadInSubframeWithError): Deleted.
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageNavigationClient):
+ * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
+ * UIProcess/API/glib/WebKitNavigationClient.cpp:
+ * UIProcess/Cocoa/NavigationState.h:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::setNavigationDelegate):
+ (WebKit::NavigationState::NavigationClient::didStartProvisionalNavigation):
+ (WebKit::createErrorWithRecoveryAttempter):
+ (WebKit::NavigationState::NavigationClient::didFailProvisionalNavigationWithError):
+ (WebKit::NavigationState::NavigationClient::didCommitNavigation):
+ (WebKit::NavigationState::NavigationClient::didFinishNavigation):
+ (WebKit::NavigationState::NavigationClient::didFailNavigationWithError):
+ (WebKit::NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError): Deleted.
+ * UIProcess/ProvisionalPageProxy.cpp:
+ (WebKit::ProvisionalPageProxy::cancel):
+ (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame):
+ (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame):
+ (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
+ * UIProcess/ProvisionalPageProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::commitProvisionalPage):
+ (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
+ (WebKit::WebPageProxy::didStartProvisionalLoadForFrameShared):
+ (WebKit::WebPageProxy::didFailProvisionalLoadForFrame):
+ (WebKit::WebPageProxy::didFailProvisionalLoadForFrameShared):
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+ (WebKit::WebPageProxy::didFinishLoadForFrame):
+ (WebKit::WebPageProxy::didFailLoadForFrame):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
+ (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
+ (WebKit::WebFrameLoaderClient::dispatchDidFailProvisionalLoad):
+ (WebKit::WebFrameLoaderClient::dispatchDidFailLoad):
+ (WebKit::WebFrameLoaderClient::dispatchDidFinishLoad):
+
+2020-03-05 Alex Christensen <achristen...@webkit.org>
+
Add WKFrameInfo._parentFrameHandle SPI
https://bugs.webkit.org/show_bug.cgi?id=208674
Modified: trunk/Source/WebKit/UIProcess/API/APINavigationClient.h (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2020-03-06 02:37:45 UTC (rev 257963)
@@ -78,17 +78,16 @@
public:
virtual ~NavigationClient() { }
- virtual void didStartProvisionalNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { }
+ virtual void didStartProvisionalNavigation(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, WebCore::ResourceRequest&&, Navigation*, Object*) { }
virtual void didReceiveServerRedirectForProvisionalNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { }
virtual void willPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String& destinationURL, double) { }
virtual void didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String& sourceURL, const WTF::String& destinationURL) { }
virtual void didCancelClientRedirect(WebKit::WebPageProxy&) { }
- virtual void didFailProvisionalNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, Navigation*, const WebCore::ResourceError&, Object*) { }
- virtual void didFailProvisionalLoadInSubframeWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebKit::FrameInfoData&&, Navigation*, const WebCore::ResourceError&, Object*) { }
- virtual void didCommitNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { }
+ virtual void didFailProvisionalNavigationWithError(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, WebCore::ResourceRequest&&, Navigation*, const WebCore::ResourceError&, Object*) { }
+ virtual void didCommitNavigation(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, WebCore::ResourceRequest&&, Navigation*, Object*) { }
virtual void didFinishDocumentLoad(WebKit::WebPageProxy&, Navigation*, Object*) { }
- virtual void didFinishNavigation(WebKit::WebPageProxy&, Navigation*, Object*) { }
- virtual void didFailNavigationWithError(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, Navigation*, const WebCore::ResourceError&, Object*) { }
+ virtual void didFinishNavigation(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, WebCore::ResourceRequest&&, Navigation*, Object*) { }
+ virtual void didFailNavigationWithError(WebKit::WebPageProxy&, WebKit::FrameInfoData&&, WebCore::ResourceRequest&&, Navigation*, const WebCore::ResourceError&, Object*) { }
virtual void didSameDocumentNavigation(WebKit::WebPageProxy&, Navigation*, WebKit::SameDocumentNavigationType, Object*) { }
virtual void didDisplayInsecureContent(WebKit::WebPageProxy&, API::Object*) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2020-03-06 02:37:45 UTC (rev 257963)
@@ -2139,8 +2139,10 @@
m_client.decidePolicyForNavigationResponse(toAPI(&page), toAPI(navigationResponse.ptr()), toAPI(listener.ptr()), toAPI(userData), m_client.base.clientInfo);
}
- void didStartProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+ void didStartProvisionalNavigation(WebPageProxy& page, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation* navigation, API::Object* userData) override
{
+ if (!frameInfo.isMainFrame)
+ return;
if (!m_client.didStartProvisionalNavigation)
return;
m_client.didStartProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
@@ -2153,41 +2155,45 @@
m_client.didReceiveServerRedirectForProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
}
- void didFailProvisionalNavigationWithError(WebPageProxy& page, WebFrameProxy&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
+ void didFailProvisionalNavigationWithError(WebPageProxy& page, FrameInfoData&& frameInfo, WebCore::ResourceRequest&&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
{
- if (!m_client.didFailProvisionalNavigation)
- return;
- m_client.didFailProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo);
+ if (frameInfo.isMainFrame) {
+ if (m_client.didFailProvisionalNavigation)
+ m_client.didFailProvisionalNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo);
+ } else {
+ if (m_client.didFailProvisionalLoadInSubframe)
+ m_client.didFailProvisionalLoadInSubframe(toAPI(&page), toAPI(navigation), toAPI(API::FrameInfo::create(WTFMove(frameInfo), &page).ptr()), toAPI(error), toAPI(userData), m_client.base.clientInfo);
+ }
}
- void didCommitNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+ void didCommitNavigation(WebPageProxy& page, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation* navigation, API::Object* userData) override
{
+ if (!frameInfo.isMainFrame)
+ return;
+
if (!m_client.didCommitNavigation)
return;
m_client.didCommitNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
}
- void didFinishNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
+ void didFinishNavigation(WebPageProxy& page, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation* navigation, API::Object* userData) override
{
+ if (!frameInfo.isMainFrame)
+ return;
if (!m_client.didFinishNavigation)
return;
m_client.didFinishNavigation(toAPI(&page), toAPI(navigation), toAPI(userData), m_client.base.clientInfo);
}
- void didFailNavigationWithError(WebPageProxy& page, WebFrameProxy&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
+ void didFailNavigationWithError(WebPageProxy& page, FrameInfoData&& frameInfo, WebCore::ResourceRequest&&, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
{
+ if (!frameInfo.isMainFrame)
+ return;
if (!m_client.didFailNavigation)
return;
m_client.didFailNavigation(toAPI(&page), toAPI(navigation), toAPI(error), toAPI(userData), m_client.base.clientInfo);
}
- void didFailProvisionalLoadInSubframeWithError(WebPageProxy& page, WebFrameProxy& subframe, FrameInfoData&& frameInfo, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userData) override
- {
- if (!m_client.didFailProvisionalLoadInSubframe)
- return;
- m_client.didFailProvisionalLoadInSubframe(toAPI(&page), toAPI(navigation), toAPI(API::FrameInfo::create(WTFMove(frameInfo), &page).ptr()), toAPI(error), toAPI(userData), m_client.base.clientInfo);
- }
-
void didFinishDocumentLoad(WebPageProxy& page, API::Navigation* navigation, API::Object* userData) override
{
if (!m_client.didFinishDocumentLoad)
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h 2020-03-06 02:37:45 UTC (rev 257963)
@@ -105,6 +105,12 @@
- (void)_webView:(WKWebView *)webView contentRuleListWithIdentifier:(NSString *)identifier performedAction:(_WKContentRuleListAction *)action forURL:(NSURL *)url WK_API_AVAILABLE(macos(10.15), ios(13.0));
- (void)_webView:(WKWebView *)webView webContentProcessDidTerminateWithReason:(_WKProcessTerminationReason)reason WK_API_AVAILABLE(macos(10.14), ios(12.0));
+- (void)_webView:(WKWebView *)webView didStartProvisionalLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView didFailProvisionalLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame withError:(NSError *)error WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView didCommitLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView didFailLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame withError:(NSError *)error WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_webView:(WKWebView *)webView didFinishLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
#if TARGET_OS_IPHONE
- (void)_webView:(WKWebView *)webView didStartLoadForQuickLookDocumentInMainFrameWithFileName:(NSString *)fileName uti:(NSString *)uti;
- (void)_webView:(WKWebView *)webView didFinishLoadForQuickLookDocumentInMainFrame:(NSData *)documentData;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitNavigationClient.cpp 2020-03-06 02:37:45 UTC (rev 257963)
@@ -22,6 +22,7 @@
#include "APINavigationAction.h"
#include "APINavigationClient.h"
+#include "FrameInfoData.h"
#include "WebKitBackForwardListPrivate.h"
#include "WebKitNavigationPolicyDecisionPrivate.h"
#include "WebKitPrivate.h"
@@ -42,8 +43,10 @@
}
private:
- void didStartProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ void didStartProvisionalNavigation(WebPageProxy&, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation*, API::Object* /* userData */) override
{
+ if (!frameInfo.isMainFrame)
+ return;
webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_STARTED);
}
@@ -52,9 +55,9 @@
webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_REDIRECTED);
}
- void didFailProvisionalNavigationWithError(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
+ void didFailProvisionalNavigationWithError(WebPageProxy&, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
{
- if (!frame.isMainFrame())
+ if (!frameInfo.isMainFrame)
return;
GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
@@ -65,19 +68,23 @@
webkitWebViewLoadFailed(m_webView, WEBKIT_LOAD_STARTED, resourceError.failingURL().string().utf8().data(), error.get());
}
- void didCommitNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ void didCommitNavigation(WebPageProxy&, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation*, API::Object* /* userData */) override
{
+ if (!frameInfo.isMainFrame)
+ return;
webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_COMMITTED);
}
- void didFinishNavigation(WebPageProxy&, API::Navigation*, API::Object* /* userData */) override
+ void didFinishNavigation(WebPageProxy&, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation*, API::Object* /* userData */) override
{
+ if (!frameInfo.isMainFrame)
+ return;
webkitWebViewLoadChanged(m_webView, WEBKIT_LOAD_FINISHED);
}
- void didFailNavigationWithError(WebPageProxy&, WebFrameProxy& frame, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
+ void didFailNavigationWithError(WebPageProxy&, FrameInfoData&& frameInfo, ResourceRequest&&, API::Navigation*, const ResourceError& resourceError, API::Object* /* userData */) override
{
- if (!frame.isMainFrame())
+ if (!frameInfo.isMainFrame)
return;
GUniquePtr<GError> error(g_error_new_literal(g_quark_from_string(resourceError.domain().utf8().data()),
toWebKitError(resourceError.errorCode()), resourceError.localizedDescription().utf8().data()));
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2020-03-06 02:37:45 UTC (rev 257963)
@@ -94,17 +94,16 @@
~NavigationClient();
private:
- void didStartProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
+ void didStartProvisionalNavigation(WebPageProxy&, FrameInfoData&&, WebCore::ResourceRequest&&, API::Navigation*, API::Object*) override;
void didReceiveServerRedirectForProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
void willPerformClientRedirect(WebPageProxy&, const WTF::String&, double) override;
void didPerformClientRedirect(WebPageProxy&, const WTF::String&, const WTF::String&) override;
void didCancelClientRedirect(WebPageProxy&) override;
- void didFailProvisionalNavigationWithError(WebPageProxy&, WebFrameProxy&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
- void didFailProvisionalLoadInSubframeWithError(WebPageProxy&, WebFrameProxy&, FrameInfoData&&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
- void didCommitNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
+ void didFailProvisionalNavigationWithError(WebPageProxy&, FrameInfoData&&, WebCore::ResourceRequest&&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
+ void didCommitNavigation(WebPageProxy&, FrameInfoData&&, WebCore::ResourceRequest&&, API::Navigation*, API::Object*) override;
void didFinishDocumentLoad(WebPageProxy&, API::Navigation*, API::Object*) override;
- void didFinishNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
- void didFailNavigationWithError(WebPageProxy&, WebFrameProxy&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
+ void didFinishNavigation(WebPageProxy&, FrameInfoData&&, WebCore::ResourceRequest&&, API::Navigation*, API::Object*) override;
+ void didFailNavigationWithError(WebPageProxy&, FrameInfoData&&, WebCore::ResourceRequest&&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
void didSameDocumentNavigation(WebPageProxy&, API::Navigation*, SameDocumentNavigationType, API::Object*) override;
void renderingProgressDidChange(WebPageProxy&, OptionSet<WebCore::LayoutMilestone>) override;
@@ -203,17 +202,23 @@
bool webViewDidStartProvisionalNavigation : 1;
bool webViewDidStartProvisionalNavigationUserInfo : 1;
+ bool webViewDidStartProvisionalLoadWithRequestInFrame : 1;
bool webViewDidReceiveServerRedirectForProvisionalNavigation : 1;
bool webViewDidFailProvisionalNavigationWithError : 1;
+ bool webViewDidFailProvisionalLoadWithRequestInFrameWithError : 1;
bool webViewNavigationDidFailProvisionalLoadInSubframeWithError : 1;
+ bool webViewDidFailProvisionalLoadWithRequestInFrame : 1;
bool webViewWillPerformClientRedirect : 1;
bool webViewDidPerformClientRedirect : 1;
bool webViewDidCancelClientRedirect : 1;
bool webViewDidCommitNavigation : 1;
+ bool webViewDidCommitLoadWithRequestInFrame : 1;
bool webViewNavigationDidFinishDocumentLoad : 1;
bool webViewDidFinishNavigation : 1;
+ bool webViewDidFinishLoadWithRequestInFrame : 1;
bool webViewDidFailNavigationWithError : 1;
bool webViewDidFailNavigationWithErrorUserInfo : 1;
+ bool webViewDidFailLoadWithRequestInFrameWithError : 1;
bool webViewNavigationDidSameDocumentNavigation : 1;
bool webViewRenderingProgressDidChange : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2020-03-06 02:37:45 UTC (rev 257963)
@@ -156,12 +156,17 @@
m_navigationDelegateMethods.webViewDidStartProvisionalNavigation = [delegate respondsToSelector:@selector(webView:didStartProvisionalNavigation:)];
m_navigationDelegateMethods.webViewDidStartProvisionalNavigationUserInfo = [delegate respondsToSelector:@selector(_webView:didStartProvisionalNavigation:userInfo:)];
+ m_navigationDelegateMethods.webViewDidStartProvisionalLoadWithRequestInFrame = [delegate respondsToSelector:@selector(_webView:didStartProvisionalLoadWithRequest:inFrame:)];
m_navigationDelegateMethods.webViewDidReceiveServerRedirectForProvisionalNavigation = [delegate respondsToSelector:@selector(webView:didReceiveServerRedirectForProvisionalNavigation:)];
m_navigationDelegateMethods.webViewDidFailProvisionalNavigationWithError = [delegate respondsToSelector:@selector(webView:didFailProvisionalNavigation:withError:)];
+ m_navigationDelegateMethods.webViewDidFailProvisionalLoadWithRequestInFrameWithError = [delegate respondsToSelector:@selector(_webView:didFailProvisionalLoadWithRequest:inFrame:withError:)];
m_navigationDelegateMethods.webViewDidCommitNavigation = [delegate respondsToSelector:@selector(webView:didCommitNavigation:)];
+ m_navigationDelegateMethods.webViewDidCommitLoadWithRequestInFrame = [delegate respondsToSelector:@selector(_webView:didCommitLoadWithRequest:inFrame:)];
m_navigationDelegateMethods.webViewDidFinishNavigation = [delegate respondsToSelector:@selector(webView:didFinishNavigation:)];
+ m_navigationDelegateMethods.webViewDidFinishLoadWithRequestInFrame = [delegate respondsToSelector:@selector(_webView:didFinishLoadWithRequest:inFrame:)];
m_navigationDelegateMethods.webViewDidFailNavigationWithError = [delegate respondsToSelector:@selector(webView:didFailNavigation:withError:)];
m_navigationDelegateMethods.webViewDidFailNavigationWithErrorUserInfo = [delegate respondsToSelector:@selector(_webView:didFailNavigation:withError:userInfo:)];
+ m_navigationDelegateMethods.webViewDidFailLoadWithRequestInFrameWithError = [delegate respondsToSelector:@selector(_webView:didFailLoadWithRequest:inFrame:withError:)];
m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError = [delegate respondsToSelector:@selector(_webView:navigation:didFailProvisionalLoadInSubframe:withError:)];
m_navigationDelegateMethods.webViewWillPerformClientRedirect = [delegate respondsToSelector:@selector(_webView:willPerformClientRedirectToURL:delay:)];
@@ -748,22 +753,21 @@
}).get()];
}
-void NavigationState::NavigationClient::didStartProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object* userInfo)
+void NavigationState::NavigationClient::didStartProvisionalNavigation(WebPageProxy& page, FrameInfoData&& frameInfo, WebCore::ResourceRequest&& request, API::Navigation* navigation, API::Object* userInfo)
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalNavigation
- && !m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalNavigationUserInfo)
- return;
-
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
if (!navigationDelegate)
return;
- // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
-
- if (m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalNavigationUserInfo)
- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didStartProvisionalNavigation:wrapper(navigation) userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil];
- else
- [navigationDelegate webView:m_navigationState.m_webView didStartProvisionalNavigation:wrapper(navigation)];
+ if (frameInfo.isMainFrame) {
+ // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalNavigationUserInfo)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didStartProvisionalNavigation:wrapper(navigation) userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil];
+ else if (m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalNavigation)
+ [navigationDelegate webView:m_navigationState.m_webView didStartProvisionalNavigation:wrapper(navigation)];
+ }
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidStartProvisionalLoadWithRequestInFrame)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate.get() _webView:m_navigationState.m_webView didStartProvisionalLoadWithRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody) inFrame:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page))];
}
void NavigationState::NavigationClient::didReceiveServerRedirectForProvisionalNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object*)
@@ -821,9 +825,9 @@
[static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate) _webViewDidCancelClientRedirect:m_navigationState.m_webView];
}
-static RetainPtr<NSError> createErrorWithRecoveryAttempter(WKWebView *webView, WebFrameProxy& webFrameProxy, NSError *originalError)
+static RetainPtr<NSError> createErrorWithRecoveryAttempter(WKWebView *webView, const FrameInfoData& frameInfo, NSError *originalError)
{
- auto frameHandle = API::FrameHandle::create(webFrameProxy.frameID());
+ auto frameHandle = API::FrameHandle::create(frameInfo.frameID ? *frameInfo.frameID : FrameIdentifier { });
auto recoveryAttempter = adoptNS([[WKReloadFrameErrorRecoveryAttempter alloc] initWithWebView:webView frameHandle:wrapper(frameHandle.get()) urlString:originalError.userInfo[NSURLErrorFailingURLStringErrorKey]]);
@@ -835,50 +839,39 @@
return adoptNS([[NSError alloc] initWithDomain:originalError.domain code:originalError.code userInfo:userInfo.get()]);
}
-// FIXME: Shouldn't need to pass the WebFrameProxy in here. At most, a FrameHandle.
-void NavigationState::NavigationClient::didFailProvisionalNavigationWithError(WebPageProxy& page, WebFrameProxy& webFrameProxy, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object*)
+void NavigationState::NavigationClient::didFailProvisionalNavigationWithError(WebPageProxy& page, FrameInfoData&& frameInfo, WebCore::ResourceRequest&& request, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object*)
{
- // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
-
- // FIXME: Set the error on the navigation object.
-
- if (!m_navigationState.m_navigationDelegateMethods.webViewDidFailProvisionalNavigationWithError)
- return;
-
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
if (!navigationDelegate)
return;
- auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, webFrameProxy, error);
- [navigationDelegate webView:m_navigationState.m_webView didFailProvisionalNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get()];
-}
+ auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, frameInfo, error);
-// FIXME: Shouldn't need to pass the WebFrameProxy in here. At most, a FrameHandle.
-void NavigationState::NavigationClient::didFailProvisionalLoadInSubframeWithError(WebPageProxy& page, WebFrameProxy& webFrameProxy, FrameInfoData&& frameInfo, API::Navigation*, const WebCore::ResourceError& error, API::Object*)
-{
- // FIXME: We should assert that navigation is not null here, but it's currently null because WebPageProxy::didFailProvisionalLoadForFrame passes null.
-
- if (!m_navigationState.m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError)
- return;
-
- auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
- auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, webFrameProxy, error);
-
- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView navigation:nil didFailProvisionalLoadInSubframe:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page)) withError:errorWithRecoveryAttempter.get()];
+ if (frameInfo.isMainFrame) {
+ // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidFailProvisionalNavigationWithError)
+ [navigationDelegate webView:m_navigationState.m_webView didFailProvisionalNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get()];
+ } else {
+ if (m_navigationState.m_navigationDelegateMethods.webViewNavigationDidFailProvisionalLoadInSubframeWithError)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView navigation:nil didFailProvisionalLoadInSubframe:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page)) withError:errorWithRecoveryAttempter.get()];
+ }
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidFailProvisionalLoadWithRequestInFrameWithError)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFailProvisionalLoadWithRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody) inFrame:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page)) withError:errorWithRecoveryAttempter.get()];
}
-void NavigationState::NavigationClient::didCommitNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object*)
+void NavigationState::NavigationClient::didCommitNavigation(WebPageProxy& page, FrameInfoData&& frameInfo, ResourceRequest&& request, API::Navigation* navigation, API::Object*)
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewDidCommitNavigation)
- return;
-
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
if (!navigationDelegate)
return;
- // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
-
- [navigationDelegate webView:m_navigationState.m_webView didCommitNavigation:wrapper(navigation)];
+ if (frameInfo.isMainFrame) {
+ // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidCommitNavigation)
+ [navigationDelegate webView:m_navigationState.m_webView didCommitNavigation:wrapper(navigation)];
+ }
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidCommitLoadWithRequestInFrame)
+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView didCommitLoadWithRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody) inFrame:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page))];
}
void NavigationState::NavigationClient::didFinishDocumentLoad(WebPageProxy& page, API::Navigation* navigation, API::Object*)
@@ -895,38 +888,38 @@
[static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) _webView:m_navigationState.m_webView navigationDidFinishDocumentLoad:wrapper(navigation)];
}
-void NavigationState::NavigationClient::didFinishNavigation(WebPageProxy& page, API::Navigation* navigation, API::Object*)
+void NavigationState::NavigationClient::didFinishNavigation(WebPageProxy& page, FrameInfoData&& frameInfo, ResourceRequest&& request, API::Navigation* navigation, API::Object*)
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewDidFinishNavigation)
- return;
-
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
if (!navigationDelegate)
return;
- // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
-
- [navigationDelegate webView:m_navigationState.m_webView didFinishNavigation:wrapper(navigation)];
+ if (frameInfo.isMainFrame) {
+ // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidFinishNavigation)
+ [navigationDelegate webView:m_navigationState.m_webView didFinishNavigation:wrapper(navigation)];
+ }
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidFinishLoadWithRequestInFrame)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFinishLoadWithRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody) inFrame:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page))];
}
-// FIXME: Shouldn't need to pass the WebFrameProxy in here. At most, a FrameHandle.
-void NavigationState::NavigationClient::didFailNavigationWithError(WebPageProxy& page, WebFrameProxy& webFrameProxy, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userInfo)
+void NavigationState::NavigationClient::didFailNavigationWithError(WebPageProxy& page, FrameInfoData&& frameInfo, ResourceRequest&& request, API::Navigation* navigation, const WebCore::ResourceError& error, API::Object* userInfo)
{
- if (!m_navigationState.m_navigationDelegateMethods.webViewDidFailNavigationWithError
- && !m_navigationState.m_navigationDelegateMethods.webViewDidFailNavigationWithErrorUserInfo)
- return;
-
auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
if (!navigationDelegate)
return;
- // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
+ auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, frameInfo, error);
- auto errorWithRecoveryAttempter = createErrorWithRecoveryAttempter(m_navigationState.m_webView, webFrameProxy, error);
- if (m_navigationState.m_navigationDelegateMethods.webViewDidFailNavigationWithErrorUserInfo)
- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFailNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get() userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil];
- else
- [navigationDelegate webView:m_navigationState.m_webView didFailNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get()];
+ if (frameInfo.isMainFrame) {
+ // FIXME: We should assert that navigation is not null here, but it's currently null for some navigations through the back/forward cache.
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidFailNavigationWithErrorUserInfo)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFailNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get() userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil];
+ else if (m_navigationState.m_navigationDelegateMethods.webViewDidFailNavigationWithError)
+ [navigationDelegate webView:m_navigationState.m_webView didFailNavigation:wrapper(navigation) withError:errorWithRecoveryAttempter.get()];
+ }
+ if (m_navigationState.m_navigationDelegateMethods.webViewDidFailLoadWithRequestInFrameWithError)
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView didFailLoadWithRequest:request.nsURLRequest(HTTPBodyUpdatePolicy::DoNotUpdateHTTPBody) inFrame:wrapper(API::FrameInfo::create(WTFMove(frameInfo), &page)) withError:errorWithRecoveryAttempter.get()];
}
void NavigationState::NavigationClient::didSameDocumentNavigation(WebPageProxy&, API::Navigation* navigation, SameDocumentNavigationType navigationType, API::Object*)
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2020-03-06 02:37:45 UTC (rev 257963)
@@ -132,7 +132,7 @@
ASSERT(m_mainFrame);
auto error = WebKit::cancelledError(m_request);
error.setType(WebCore::ResourceError::Type::Cancellation);
- didFailProvisionalLoadForFrame(m_mainFrame->frameID(), { }, m_navigationID, m_provisionalLoadURL, error, WebCore::WillContinueLoading::No, UserData { }); // Will delete |this|.
+ didFailProvisionalLoadForFrame(m_mainFrame->frameID(), { }, { }, m_navigationID, m_provisionalLoadURL, error, WebCore::WillContinueLoading::No, UserData { }); // Will delete |this|.
}
void ProvisionalPageProxy::initializeWebPage()
@@ -228,7 +228,7 @@
m_page.didPerformClientRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID);
}
-void ProvisionalPageProxy::didStartProvisionalLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
+void ProvisionalPageProxy::didStartProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
{
if (!validateInput(frameID, navigationID))
return;
@@ -245,10 +245,10 @@
if (auto* pageMainFrame = m_page.mainFrame())
pageMainFrame->didStartProvisionalLoad(url);
- m_page.didStartProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url), WTFMove(unreachableURL), userData);
+ m_page.didStartProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), WTFMove(request), navigationID, WTFMove(url), WTFMove(unreachableURL), userData);
}
-void ProvisionalPageProxy::didFailProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError& error, WebCore::WillContinueLoading willContinueLoading, const UserData& userData)
+void ProvisionalPageProxy::didFailProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError& error, WebCore::WillContinueLoading willContinueLoading, const UserData& userData)
{
if (!validateInput(frameID, navigationID))
return;
@@ -261,10 +261,10 @@
if (auto* pageMainFrame = m_page.mainFrame())
pageMainFrame->didFailProvisionalLoad();
- m_page.didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), navigationID, provisionalURL, error, willContinueLoading, userData); // May delete |this|.
+ m_page.didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), WTFMove(request), navigationID, provisionalURL, error, willContinueLoading, userData); // May delete |this|.
}
-void ProvisionalPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData)
+void ProvisionalPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData)
{
if (!validateInput(frameID, navigationID))
return;
@@ -274,7 +274,7 @@
m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID);
m_wasCommitted = true;
- m_page.commitProvisionalPage(frameID, navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, userData); // Will delete |this|.
+ m_page.commitProvisionalPage(frameID, WTFMove(frameInfo), WTFMove(request), navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, userData); // Will delete |this|.
}
void ProvisionalPageProxy::didNavigateWithNavigationData(const WebNavigationDataStore& store, FrameIdentifier frameID)
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2020-03-06 02:37:45 UTC (rev 257963)
@@ -122,9 +122,9 @@
void didNavigateWithNavigationData(const WebNavigationDataStore&, WebCore::FrameIdentifier);
void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, WebCore::FrameIdentifier);
void didCreateMainFrame(WebCore::FrameIdentifier);
- void didStartProvisionalLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
- void didCommitLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
- void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
+ void didStartProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
+ void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
+ void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
void startURLSchemeTask(URLSchemeTaskParameters&&);
void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(SandboxExtension::Handle&&, const WebBackForwardListCounts&)>&&);
void decidePolicyForNavigationActionSync(WebCore::FrameIdentifier, bool isMainFrame, FrameInfoData&&, WebCore::PolicyCheckIdentifier, uint64_t navigationID, NavigationActionData&&, FrameInfoData&& originatingFrameInfo,
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-03-06 02:37:45 UTC (rev 257963)
@@ -3240,7 +3240,7 @@
sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), hasNavigatedAwayFromAppBoundDomain(), action, navigation ? navigation->navigationID() : 0, downloadID, WTFMove(websitePolicies) });
}
-void WebPageProxy::commitProvisionalPage(FrameIdentifier frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData)
+void WebPageProxy::commitProvisionalPage(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData)
{
ASSERT(m_provisionalPage);
RELEASE_LOG_IF_ALLOWED(Loading, "commitProvisionalPage: newPID = %i", m_provisionalPage->process().processIdentifier());
@@ -3274,7 +3274,7 @@
const auto oldWebPageID = m_webPageID;
swapToProvisionalPage(std::exchange(m_provisionalPage, nullptr));
- didCommitLoadForFrame(frameID, navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, userData);
+ didCommitLoadForFrame(frameID, WTFMove(frameInfo), WTFMove(request), navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, userData);
m_inspectorController->didCommitProvisionalPage(oldWebPageID, m_webPageID);
}
@@ -4318,12 +4318,12 @@
m_navigationState->didDestroyNavigation(navigationID);
}
-void WebPageProxy::didStartProvisionalLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
+void WebPageProxy::didStartProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
{
- didStartProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url), WTFMove(unreachableURL), userData);
+ didStartProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), WTFMove(request), navigationID, WTFMove(url), WTFMove(unreachableURL), userData);
}
-void WebPageProxy::didStartProvisionalLoadForFrameShared(Ref<WebProcessProxy>&& process, FrameIdentifier frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
+void WebPageProxy::didStartProvisionalLoadForFrameShared(Ref<WebProcessProxy>&& process, FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData)
{
PageClientProtector protector(pageClient());
@@ -4365,8 +4365,8 @@
m_pageLoadState.commitChanges();
if (m_loaderClient)
m_loaderClient->didStartProvisionalLoadForFrame(*this, *frame, navigation.get(), process->transformHandlesToObjects(userData.object()).get());
- else if (frame->isMainFrame())
- m_navigationClient->didStartProvisionalNavigation(*this, navigation.get(), process->transformHandlesToObjects(userData.object()).get());
+ else
+ m_navigationClient->didStartProvisionalNavigation(*this, WTFMove(frameInfo), WTFMove(request), navigation.get(), process->transformHandlesToObjects(userData.object()).get());
#if ENABLE(WEB_AUTHN)
m_websiteDataStore->authenticatorManager().cancelRequest(m_webPageID, frameID);
@@ -4481,7 +4481,7 @@
frame->didReceiveServerRedirectForProvisionalLoad(url);
}
-void WebPageProxy::didFailProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, uint64_t navigationID, const String& provisionalURL, const ResourceError& error, WillContinueLoading willContinueLoading, const UserData& userData)
+void WebPageProxy::didFailProvisionalLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, WebCore::ResourceRequest&& request, uint64_t navigationID, const String& provisionalURL, const ResourceError& error, WillContinueLoading willContinueLoading, const UserData& userData)
{
if (m_provisionalPage && m_provisionalPage->navigationID() == navigationID) {
// The load did not fail, it is merely happening in a new provisional process.
@@ -4488,10 +4488,10 @@
return;
}
- didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), navigationID, provisionalURL, error, willContinueLoading, userData);
+ didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), WTFMove(request), navigationID, provisionalURL, error, willContinueLoading, userData);
}
-void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref<WebProcessProxy>&& process, FrameIdentifier frameID, FrameInfoData&& frameInfo, uint64_t navigationID, const String& provisionalURL, const ResourceError& error, WillContinueLoading willContinueLoading, const UserData& userData)
+void WebPageProxy::didFailProvisionalLoadForFrameShared(Ref<WebProcessProxy>&& process, FrameIdentifier frameID, FrameInfoData&& frameInfo, WebCore::ResourceRequest&& request, uint64_t navigationID, const String& provisionalURL, const ResourceError& error, WillContinueLoading willContinueLoading, const UserData& userData)
{
LOG(Loading, "(Loading) WebPageProxy %" PRIu64 " in web process pid %i didFailProvisionalLoadForFrame to provisionalURL %s", m_identifier.toUInt64(), process->processIdentifier(), provisionalURL.utf8().data());
RELEASE_LOG_IF_ALLOWED(Process, "didFailProvisionalLoadForFrame: frameID = %" PRIu64 ", domain = %s, code = %d", frameID.toUInt64(), error.domain().utf8().data(), error.errorCode());
@@ -4530,12 +4530,8 @@
if (m_loaderClient)
m_loaderClient->didFailProvisionalLoadWithErrorForFrame(*this, *frame, navigation.get(), error, process->transformHandlesToObjects(userData.object()).get());
- else if (frame->isMainFrame())
- m_navigationClient->didFailProvisionalNavigationWithError(*this, *frame, navigation.get(), error, process->transformHandlesToObjects(userData.object()).get());
- else {
- // FIXME: Get the main frame's current navigation.
- m_navigationClient->didFailProvisionalLoadInSubframeWithError(*this, *frame, WTFMove(frameInfo), nullptr, error, process->transformHandlesToObjects(userData.object()).get());
- }
+ else
+ m_navigationClient->didFailProvisionalNavigationWithError(*this, WTFMove(frameInfo), WTFMove(request), navigation.get(), error, process->transformHandlesToObjects(userData.object()).get());
m_failingProvisionalLoadURL = { };
@@ -4572,7 +4568,7 @@
}
#endif
-void WebPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, const UserData& userData)
+void WebPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, const UserData& userData)
{
LOG(Loading, "(Loading) WebPageProxy %" PRIu64 " didCommitLoadForFrame in navigation %" PRIu64, m_identifier.toUInt64(), navigationID);
LOG(BackForward, "(Back/Forward) After load commit, back/forward list is now:%s", m_backForwardList->loggingString());
@@ -4672,8 +4668,8 @@
m_pageLoadState.commitChanges();
if (m_loaderClient)
m_loaderClient->didCommitLoadForFrame(*this, *frame, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
- else if (frame->isMainFrame())
- m_navigationClient->didCommitNavigation(*this, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
+ else
+ m_navigationClient->didCommitNavigation(*this, WTFMove(frameInfo), WTFMove(request), navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
#if ENABLE(ATTACHMENT_ELEMENT)
if (frame->isMainFrame())
@@ -4713,7 +4709,7 @@
}
}
-void WebPageProxy::didFinishLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, const UserData& userData)
+void WebPageProxy::didFinishLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const UserData& userData)
{
LOG(Loading, "WebPageProxy::didFinishLoadForFrame - WebPageProxy %p with navigationID %" PRIu64 " didFinishLoad", this, navigationID);
RELEASE_LOG_IF_ALLOWED(Loading, "didFinishLoadForFrame: frameID = %" PRIu64, frameID.toUInt64());
@@ -4744,8 +4740,8 @@
m_pageLoadState.commitChanges();
if (m_loaderClient)
m_loaderClient->didFinishLoadForFrame(*this, *frame, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
- else if (isMainFrame)
- m_navigationClient->didFinishNavigation(*this, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
+ else
+ m_navigationClient->didFinishNavigation(*this, WTFMove(frameInfo), WTFMove(request), navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
if (isMainFrame) {
reportPageLoadResult();
@@ -4762,7 +4758,7 @@
m_isLoadingAlternateHTMLStringForFailingProvisionalLoad = false;
}
-void WebPageProxy::didFailLoadForFrame(FrameIdentifier frameID, uint64_t navigationID, const ResourceError& error, const UserData& userData)
+void WebPageProxy::didFailLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const ResourceError& error, const UserData& userData)
{
RELEASE_LOG_IF_ALLOWED(Loading, "didFailLoadForFrame: frameID = %" PRIu64 ", domain = %s, code = %d", frameID.toUInt64(), error.domain().utf8().data(), error.errorCode());
@@ -4795,8 +4791,8 @@
m_pageLoadState.commitChanges();
if (m_loaderClient)
m_loaderClient->didFailLoadWithErrorForFrame(*this, *frame, navigation.get(), error, m_process->transformHandlesToObjects(userData.object()).get());
- else if (frame->isMainFrame())
- m_navigationClient->didFailNavigationWithError(*this, *frame, navigation.get(), error, m_process->transformHandlesToObjects(userData.object()).get());
+ else
+ m_navigationClient->didFailNavigationWithError(*this, WTFMove(frameInfo), WTFMove(request), navigation.get(), error, m_process->transformHandlesToObjects(userData.object()).get());
if (isMainFrame) {
reportPageLoadResult(error);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-03-06 02:37:45 UTC (rev 257963)
@@ -1609,11 +1609,11 @@
#endif
ProvisionalPageProxy* provisionalPageProxy() const { return m_provisionalPage.get(); }
- void commitProvisionalPage(WebCore::FrameIdentifier, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
+ void commitProvisionalPage(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
// Logic shared between the WebPageProxy and the ProvisionalPageProxy.
- void didStartProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
- void didFailProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, FrameInfoData&& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
+ void didStartProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
+ void didFailProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
void didReceiveServerRedirectForProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);
void didPerformServerRedirectShared(Ref<WebProcessProxy>&&, const String& sourceURLString, const String& destinationURLString, WebCore::FrameIdentifier);
void didPerformClientRedirectShared(Ref<WebProcessProxy>&&, const String& sourceURLString, const String& destinationURLString, WebCore::FrameIdentifier);
@@ -1753,16 +1753,16 @@
void didCreateSubframe(WebCore::FrameIdentifier);
void didCreateWindow(WebCore::FrameIdentifier, WebCore::GlobalWindowIdentifier&&);
- void didStartProvisionalLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
+ void didStartProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
void didReceiveServerRedirectForProvisionalLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, WebCore::ResourceRequest&&, const UserData&);
void willPerformClientRedirectForFrame(WebCore::FrameIdentifier, const String& url, double delay, WebCore::LockBackForwardList);
void didCancelClientRedirectForFrame(WebCore::FrameIdentifier);
void didChangeProvisionalURLForFrame(WebCore::FrameIdentifier, uint64_t navigationID, URL&&);
- void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
- void didCommitLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
+ void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
+ void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
void didFinishDocumentLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const UserData&);
- void didFinishLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const UserData&);
- void didFailLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
+ void didFinishLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const UserData&);
+ void didFailLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
void didSameDocumentNavigationForFrame(WebCore::FrameIdentifier, uint64_t navigationID, uint32_t sameDocumentNavigationType, URL&&, const UserData&);
void didChangeMainDocument(WebCore::FrameIdentifier);
void didExplicitOpenForFrame(WebCore::FrameIdentifier, URL&&, String&& mimeType);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (257962 => 257963)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-03-06 02:37:45 UTC (rev 257963)
@@ -120,16 +120,16 @@
DidCreateWindow(WebCore::FrameIdentifier frameID, struct WebCore::GlobalWindowIdentifier windowIdentifier)
# Frame load messages
- DidStartProvisionalLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, URL url, URL unreachableURL, WebKit::UserData userData)
+ DidStartProvisionalLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, URL url, URL unreachableURL, WebKit::UserData userData)
DidReceiveServerRedirectForProvisionalLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, WebCore::ResourceRequest request, WebKit::UserData userData)
WillPerformClientRedirectForFrame(WebCore::FrameIdentifier frameID, String url, double delay, enum:bool WebCore::LockBackForwardList lockBackForwardList)
DidCancelClientRedirectForFrame(WebCore::FrameIdentifier frameID)
DidChangeProvisionalURLForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, URL url)
- DidFailProvisionalLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, enum:bool WebCore::WillContinueLoading willContinueLoading, WebKit::UserData userData)
- DidCommitLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData)
- DidFailLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
+ DidFailProvisionalLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, enum:bool WebCore::WillContinueLoading willContinueLoading, WebKit::UserData userData)
+ DidCommitLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData)
+ DidFailLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
DidFinishDocumentLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, WebKit::UserData userData)
- DidFinishLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, WebKit::UserData userData)
+ DidFinishLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, WebKit::UserData userData)
DidFirstLayoutForFrame(WebCore::FrameIdentifier frameID, WebKit::UserData userData)
DidFirstVisuallyNonEmptyLayoutForFrame(WebCore::FrameIdentifier frameID, WebKit::UserData userData)
DidReachLayoutMilestone(OptionSet<WebCore::LayoutMilestone> layoutMilestones)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (257962 => 257963)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-03-06 02:37:45 UTC (rev 257963)
@@ -533,7 +533,7 @@
auto& unreachableURL = provisionalLoader.unreachableURL();
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), provisionalLoader.navigationID(), url, unreachableURL, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), m_frame->info(), provisionalLoader.request(), provisionalLoader.navigationID(), url, unreachableURL, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
}
static constexpr unsigned maxTitleLength = 1000; // Closest power of 10 above the W3C recommendation for Title length.
@@ -575,7 +575,7 @@
usedLegacyTLS = usedLegacyTLSFromPageCache == UsedLegacyTLS::Yes;
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), usedLegacyTLS, m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), m_frame->info(), documentLoader.request(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), usedLegacyTLS, m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
webPage->didCommitLoad(m_frame);
}
@@ -603,12 +603,15 @@
// A better solution to this problem would be find a clean way to postpone the disconnection of the DocumentLoader from the Frame until
// the entire FrameLoaderClient function was complete.
uint64_t navigationID = 0;
- if (auto documentLoader = m_frame->coreFrame()->loader().provisionalDocumentLoader())
+ ResourceRequest request;
+ if (auto documentLoader = m_frame->coreFrame()->loader().provisionalDocumentLoader()) {
navigationID = static_cast<WebDocumentLoader*>(documentLoader)->navigationID();
+ request = documentLoader->request();
+ }
// Notify the UIProcess.
WebCore::Frame* coreFrame = m_frame->coreFrame();
- webPage->send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame->frameID(), m_frame->info(), navigationID, coreFrame->loader().provisionalLoadErrorBeingHandledURL(), error, willContinueLoading, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::DidFailProvisionalLoadForFrame(m_frame->frameID(), m_frame->info(), request, navigationID, coreFrame->loader().provisionalLoadErrorBeingHandledURL(), error, willContinueLoading, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
@@ -625,13 +628,14 @@
RefPtr<API::Object> userData;
- auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+ auto& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader());
+ auto navigationID = documentLoader.navigationID();
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFailLoadWithErrorForFrame(*webPage, *m_frame, error, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), navigationID, error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::DidFailLoadForFrame(m_frame->frameID(), m_frame->info(), documentLoader.request(), navigationID, error, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
@@ -665,13 +669,14 @@
RefPtr<API::Object> userData;
- auto navigationID = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader()).navigationID();
+ auto& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().documentLoader());
+ auto navigationID = documentLoader.navigationID();
// Notify the bundle client.
webPage->injectedBundleLoaderClient().didFinishLoadForFrame(*webPage, *m_frame, userData);
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidFinishLoadForFrame(m_frame->frameID(), navigationID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::DidFinishLoadForFrame(m_frame->frameID(), m_frame->info(), documentLoader.request(), navigationID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
// If we have a load listener, notify it.
if (WebFrame::LoadListener* loadListener = m_frame->loadListener())
Modified: trunk/Tools/ChangeLog (257962 => 257963)
--- trunk/Tools/ChangeLog 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Tools/ChangeLog 2020-03-06 02:37:45 UTC (rev 257963)
@@ -1,5 +1,24 @@
2020-03-05 Alex Christensen <achristen...@webkit.org>
+ Add WKNavigationDelegatePrivate SPI to inform application of subframe navigations
+ https://bugs.webkit.org/show_bug.cgi?id=208670
+
+ Reviewed by Brady Eidson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
+ (-[FrameNavigationDelegate waitForNavigations:]):
+ (-[FrameNavigationDelegate requests]):
+ (-[FrameNavigationDelegate frames]):
+ (-[FrameNavigationDelegate callbacks]):
+ (-[FrameNavigationDelegate _webView:didStartProvisionalLoadWithRequest:inFrame:]):
+ (-[FrameNavigationDelegate _webView:didFailProvisionalLoadWithRequest:inFrame:withError:]):
+ (-[FrameNavigationDelegate _webView:didCommitLoadWithRequest:inFrame:]):
+ (-[FrameNavigationDelegate _webView:didFailLoadWithRequest:inFrame:withError:]):
+ (-[FrameNavigationDelegate _webView:didFinishLoadWithRequest:inFrame:]):
+ (TEST):
+
+2020-03-05 Alex Christensen <achristen...@webkit.org>
+
Add WKFrameInfo._parentFrameHandle SPI
https://bugs.webkit.org/show_bug.cgi?id=208674
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm (257962 => 257963)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm 2020-03-06 02:33:30 UTC (rev 257962)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm 2020-03-06 02:37:45 UTC (rev 257963)
@@ -32,8 +32,10 @@
#import <WebKit/WKWebView.h>
#import <WebKit/WKWebViewConfigurationPrivate.h>
#import <wtf/RetainPtr.h>
+#import <wtf/Vector.h>
#import "PlatformUtilities.h"
#import "Test.h"
+#import "TestURLSchemeHandler.h"
static bool isDone;
static RetainPtr<WKNavigation> currentNavigation;
@@ -98,6 +100,189 @@
TestWebKitAPI::Util::run(&isDone);
}
+@interface FrameNavigationDelegate : NSObject <WKNavigationDelegate>
+- (void)waitForNavigations:(size_t)count;
+@property (nonatomic, readonly) NSArray<NSURLRequest *> *requests;
+@property (nonatomic, readonly) NSArray<WKFrameInfo *> *frames;
+@property (nonatomic, readonly) NSArray<NSString *> *callbacks;
+@end
+
+@implementation FrameNavigationDelegate {
+ RetainPtr<NSMutableArray<NSURLRequest *>> _requests;
+ RetainPtr<NSMutableArray<WKFrameInfo *>> _frames;
+ RetainPtr<NSMutableArray<NSString *>> _callbacks;
+ size_t _navigationCount;
+}
+
+- (void)waitForNavigations:(size_t)expectedNavigationCount
+{
+ while (_navigationCount < expectedNavigationCount)
+ TestWebKitAPI::Util::spinRunLoop();
+}
+
+- (NSArray<NSURLRequest *> *)requests
+{
+ return _requests.get();
+}
+
+- (NSArray<WKFrameInfo *> *)frames
+{
+ return _frames.get();
+}
+
+- (NSArray<NSString *> *)callbacks
+{
+ return _callbacks.get();
+}
+
+- (void)_webView:(WKWebView *)webView didStartProvisionalLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame
+{
+ if (!_requests)
+ _requests = [NSMutableArray array];
+ [_requests addObject:request];
+
+ if (!_frames)
+ _frames = [NSMutableArray array];
+ [_frames addObject:frame];
+
+ if (!_callbacks)
+ _callbacks = [NSMutableArray array];
+ [_callbacks addObject:@"start provisional"];
+}
+
+- (void)_webView:(WKWebView *)webView didFailProvisionalLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame withError:(NSError *)error
+{
+ [_requests addObject:request];
+ [_frames addObject:frame];
+ [_callbacks addObject:@"fail provisional"];
+ _navigationCount++;
+}
+
+- (void)_webView:(WKWebView *)webView didCommitLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame
+{
+ [_requests addObject:request];
+ [_frames addObject:frame];
+ [_callbacks addObject:@"commit"];
+}
+
+- (void)_webView:(WKWebView *)webView didFailLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame withError:(NSError *)error
+{
+ [_requests addObject:request];
+ [_frames addObject:frame];
+ [_callbacks addObject:@"fail"];
+ _navigationCount++;
+}
+
+- (void)_webView:(WKWebView *)webView didFinishLoadWithRequest:(NSURLRequest *)request inFrame:(WKFrameInfo *)frame
+{
+ [_requests addObject:request];
+ [_frames addObject:frame];
+ [_callbacks addObject:@"finish"];
+ _navigationCount++;
+}
+
+@end
+
+TEST(WKNavigation, Frames)
+{
+ WKWebViewConfiguration *configuration = [[[WKWebViewConfiguration alloc] init] autorelease];
+ TestURLSchemeHandler *handler = [[TestURLSchemeHandler new] autorelease];
+ [handler setStartURLSchemeTaskHandler:^(WKWebView *, id<WKURLSchemeTask> task) {
+ NSString *responseString = nil;
+ if ([task.request.URL.absoluteString isEqualToString:@"frame://host1/"])
+ responseString = @"<iframe src=''></iframe>";
+ else if ([task.request.URL.absoluteString isEqualToString:@"frame://host2/"])
+ responseString = @"<script>function navigate() { window.location='frame://host3/' }</script><body _onload_='navigate()'></body>";
+ else if ([task.request.URL.absoluteString isEqualToString:@"frame://host3/"]) {
+ [task didFailWithError:[NSError errorWithDomain:@"testErrorDomain" code:42 userInfo:nil]];
+ return;
+ }
+
+ ASSERT(responseString);
+ auto response = adoptNS([[NSURLResponse alloc] initWithURL:task.request.URL MIMEType:@"text/html" expectedContentLength:responseString.length textEncodingName:nil]);
+ [task didReceiveResponse:response.get()];
+ [task didReceiveData:[responseString dataUsingEncoding:NSUTF8StringEncoding]];
+ [task didFinish];
+ }];
+ [configuration setURLSchemeHandler:handler forURLScheme:@"frame"];
+
+ auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration]);
+ auto delegate = adoptNS([FrameNavigationDelegate new]);
+ webView.get().navigationDelegate = delegate.get();
+ [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"frame://host1/"]]];
+ [delegate waitForNavigations:3];
+
+ struct ExpectedStrings {
+ const char* callback;
+ const char* frameRequest;
+ const char* frameSecurityOriginHost;
+ const char* request;
+ };
+
+ auto checkCallbacks = [delegate] (Vector<ExpectedStrings> expectedVector) {
+ NSArray<NSURLRequest *> *requests = delegate.get().requests;
+ NSArray<WKFrameInfo *> *frames = delegate.get().frames;
+ NSArray<NSString *> *callbacks = delegate.get().callbacks;
+ EXPECT_EQ(requests.count, expectedVector.size());
+ EXPECT_EQ(frames.count, expectedVector.size());
+ EXPECT_EQ(callbacks.count, expectedVector.size());
+
+ auto checkCallback = [] (NSString *callback, WKFrameInfo *frame, NSURLRequest *request, const ExpectedStrings& expected) {
+ EXPECT_WK_STREQ(callback, expected.callback);
+ EXPECT_WK_STREQ(frame.request.URL.absoluteString, expected.frameRequest);
+ EXPECT_WK_STREQ(frame.securityOrigin.host, expected.frameSecurityOriginHost);
+ EXPECT_WK_STREQ(request.URL.absoluteString, expected.request);
+ };
+
+ for (size_t i = 0; i < expectedVector.size(); ++i)
+ checkCallback(callbacks[i], frames[i], requests[i], expectedVector[i]);
+ };
+
+ checkCallbacks({
+ {
+ "start provisional",
+ "",
+ "",
+ "frame://host1/"
+ }, {
+ "commit",
+ "frame://host1/",
+ "host1",
+ "frame://host1/"
+ }, {
+ "start provisional",
+ "",
+ "host1",
+ "frame://host2/"
+ }, {
+ "commit",
+ "frame://host2/",
+ "host2",
+ "frame://host2/"
+ }, {
+ "finish",
+ "frame://host2/",
+ "host2",
+ "frame://host2/"
+ }, {
+ "finish",
+ "frame://host1/",
+ "host1",
+ "frame://host1/"
+ }, {
+ "start provisional",
+ "frame://host2/",
+ "host2",
+ "frame://host3/"
+ }, {
+ "fail provisional",
+ "frame://host2/",
+ "host2",
+ "frame://host3/"
+ }
+ });
+}
+
@interface DidFailProvisionalNavigationDelegate : NSObject <WKNavigationDelegate>
@end