Diff
Modified: trunk/Source/WebKit/ChangeLog (222793 => 222794)
--- trunk/Source/WebKit/ChangeLog 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/ChangeLog 2017-10-03 18:54:11 UTC (rev 222794)
@@ -1,3 +1,31 @@
+2017-10-03 Alex Christensen <[email protected]>
+
+ Add ObjC SPI equivalent to WKPageLoaderClient.willGoToBackForwardListItem
+ https://bugs.webkit.org/show_bug.cgi?id=177825
+ <rdar://problem/22387505>
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/APILoaderClient.h:
+ (API::LoaderClient::willGoToBackForwardListItem):
+ * UIProcess/API/APINavigationClient.h:
+ (API::NavigationClient::canHandleWillGoToBackForwardListItem const):
+ (API::NavigationClient::willGoToBackForwardListItem):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageLoaderClient):
+ * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h:
+ * UIProcess/Cocoa/NavigationState.h:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::setNavigationDelegate):
+ (WebKit::NavigationState::NavigationClient::canHandleWillGoToBackForwardListItem const):
+ (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::willGoToBackForwardListItem):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const):
+
2017-10-03 Michael Catanzaro <[email protected]>
REGRESSION(r222392): [WPE][GTK] Many forms tests are failing due to broken event timestamps
Modified: trunk/Source/WebKit/UIProcess/API/APILoaderClient.h (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/API/APILoaderClient.h 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/API/APILoaderClient.h 2017-10-03 18:54:11 UTC (rev 222794)
@@ -91,7 +91,7 @@
virtual void didChangeBackForwardList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, Vector<RefPtr<WebKit::WebBackForwardListItem>>) { }
virtual bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*) { return true; }
- virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, API::Object*) { }
+ virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, API::Object*) { }
virtual void didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore&, WebKit::WebFrameProxy&) { }
virtual void didPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String&, const WTF::String&, WebKit::WebFrameProxy&) { }
Modified: trunk/Source/WebKit/UIProcess/API/APINavigationClient.h (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/API/APINavigationClient.h 2017-10-03 18:54:11 UTC (rev 222794)
@@ -119,6 +119,8 @@
virtual void webGLLoadPolicy(WebKit::WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const { completionHandler(WebCore::WebGLLoadPolicy::WebGLAllowCreation); }
virtual void resolveWebGLLoadPolicy(WebKit::WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const { completionHandler(WebCore::WebGLLoadPolicy::WebGLAllowCreation); }
#endif
+
+ virtual bool willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, bool inPageCache, Object*) { return false; }
virtual void didBeginNavigationGesture(WebKit::WebPageProxy&) { }
virtual void willEndNavigationGesture(WebKit::WebPageProxy&, bool willNavigate, WebKit::WebBackForwardListItem&) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-10-03 18:54:11 UTC (rev 222794)
@@ -1230,10 +1230,10 @@
return m_client.shouldKeepCurrentBackForwardListItemInList(toAPI(&page), toAPI(item), m_client.base.clientInfo);
}
- void willGoToBackForwardListItem(WebPageProxy& page, WebBackForwardListItem* item, API::Object* userData) override
+ void willGoToBackForwardListItem(WebPageProxy& page, WebBackForwardListItem& item, API::Object* userData) override
{
if (m_client.willGoToBackForwardListItem)
- m_client.willGoToBackForwardListItem(toAPI(&page), toAPI(item), toAPI(userData), m_client.base.clientInfo);
+ m_client.willGoToBackForwardListItem(toAPI(&page), toAPI(&item), toAPI(userData), m_client.base.clientInfo);
}
void navigationGestureDidBegin(WebPageProxy& page) override
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h 2017-10-03 18:54:11 UTC (rev 222794)
@@ -87,6 +87,7 @@
#else
- (void)_webView:(WKWebView *)webView webGLLoadPolicyForURL:(NSURL *)url decisionHandler:(void (^)(_WKWebGLLoadPolicy))decisionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView resolveWebGLLoadPolicyForURL:(NSURL *)url decisionHandler:(void (^)(_WKWebGLLoadPolicy))decisionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_webView:(WKWebView *)webView willGoToBackForwardListItem:(WKBackForwardListItem *)item inPageCache:(BOOL)inPageCache WK_API_AVAILABLE(macosx(WK_MAC_TBA));
#endif
@end
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h 2017-10-03 18:54:11 UTC (rev 222794)
@@ -91,8 +91,8 @@
private:
void didStartProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
void didReceiveServerRedirectForProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
- void willPerformClientRedirect(WebKit::WebPageProxy&, const WTF::String&, double) override;
- void didCancelClientRedirect(WebKit::WebPageProxy&) override;
+ void willPerformClientRedirect(WebPageProxy&, const WTF::String&, double) override;
+ void didCancelClientRedirect(WebPageProxy&) override;
void didFailProvisionalNavigationWithError(WebPageProxy&, WebFrameProxy&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
void didFailProvisionalLoadInSubframeWithError(WebPageProxy&, WebFrameProxy&, const WebCore::SecurityOriginData&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override;
void didCommitNavigation(WebPageProxy&, API::Navigation*, API::Object*) override;
@@ -116,9 +116,10 @@
void didFinishLoadForQuickLookDocumentInMainFrame(const QuickLookDocumentData&) override;
#endif
-#if ENABLE(WEBGL) && PLATFORM(MAC)
+#if PLATFORM(MAC)
void webGLLoadPolicy(WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const final;
void resolveWebGLLoadPolicy(WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const final;
+ bool willGoToBackForwardListItem(WebPageProxy&, WebBackForwardListItem&, bool inPageCache, API::Object*) final;
#endif
void contentRuleListNotification(WebPageProxy&, WebCore::URL&&, Vector<String>&&, Vector<String>&&) final;
@@ -209,9 +210,10 @@
bool webViewDidRequestPasswordForQuickLookDocument : 1;
#endif
-#if ENABLE(WEBGL) && PLATFORM(MAC)
+#if PLATFORM(MAC)
bool webViewWebGLLoadPolicyForURL : 1;
bool webViewResolveWebGLLoadPolicyForURL : 1;
+ bool webViewWillGoToBackForwardListItemInPageCache : 1;
#endif
} m_navigationDelegateMethods;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2017-10-03 18:54:11 UTC (rev 222794)
@@ -174,9 +174,10 @@
m_navigationDelegateMethods.webViewDidFinishLoadForQuickLookDocumentInMainFrame = [delegate respondsToSelector:@selector(_webView:didFinishLoadForQuickLookDocumentInMainFrame:)];
m_navigationDelegateMethods.webViewDidRequestPasswordForQuickLookDocument = [delegate respondsToSelector:@selector(_webViewDidRequestPasswordForQuickLookDocument:)];
#endif
-#if ENABLE(WEBGL) && PLATFORM(MAC)
+#if PLATFORM(MAC)
m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL = [delegate respondsToSelector:@selector(_webView:webGLLoadPolicyForURL:decisionHandler:)];
m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL = [delegate respondsToSelector:@selector(_webView:resolveWebGLLoadPolicyForURL:decisionHandler:)];
+ m_navigationDelegateMethods.webViewWillGoToBackForwardListItemInPageCache = [delegate respondsToSelector:@selector(_webView:willGoToBackForwardListItem:inPageCache:)];
#endif
}
@@ -339,6 +340,19 @@
completionHandler(toWebCoreWebGLLoadPolicy(policy));
}).get()];
}
+
+bool NavigationState::NavigationClient::willGoToBackForwardListItem(WebPageProxy&, WebBackForwardListItem& item, bool inPageCache, API::Object*)
+{
+ if (!m_navigationState.m_navigationDelegateMethods.webViewWillGoToBackForwardListItemInPageCache)
+ return false;
+
+ auto navigationDelegate = m_navigationState.m_navigationDelegate.get();
+ if (!navigationDelegate)
+ return false;
+
+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView willGoToBackForwardListItem:wrapper(item) inPageCache:inPageCache];
+ return true;
+}
#endif
static void tryAppLink(RefPtr<API::NavigationAction>&& navigationAction, const String& currentMainFrameURL, WTF::Function<void(bool)>&& completionHandler)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-10-03 18:54:11 UTC (rev 222794)
@@ -1204,12 +1204,15 @@
m_pageLoadState.setCanGoForward(transaction, m_backForwardList->forwardItem());
}
-void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, const UserData& userData)
+void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, bool inPageCache, const UserData& userData)
{
PageClientProtector protector(m_pageClient);
- if (WebBackForwardListItem* item = m_process->webBackForwardItem(itemID))
- m_loaderClient->willGoToBackForwardListItem(*this, item, m_process->transformHandlesToObjects(userData.object()).get());
+ if (auto* item = m_process->webBackForwardItem(itemID)) {
+ if (m_navigationClient->willGoToBackForwardListItem(*this, *item, inPageCache, m_process->transformHandlesToObjects(userData.object()).get()))
+ return;
+ m_loaderClient->willGoToBackForwardListItem(*this, *item, m_process->transformHandlesToObjects(userData.object()).get());
+ }
}
bool WebPageProxy::shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem* item)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2017-10-03 18:54:11 UTC (rev 222794)
@@ -410,7 +410,7 @@
RefPtr<API::Navigation> goToBackForwardItem(WebBackForwardListItem*);
void tryRestoreScrollPosition();
void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removed);
- void willGoToBackForwardListItem(uint64_t itemID, const UserData&);
+ void willGoToBackForwardListItem(uint64_t itemID, bool inPageCache, const UserData&);
bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem*);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (222793 => 222794)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2017-10-03 18:54:11 UTC (rev 222794)
@@ -216,7 +216,7 @@
BackForwardBackListCount() -> (int32_t count)
BackForwardForwardListCount() -> (int32_t count)
BackForwardClear()
- WillGoToBackForwardListItem(uint64_t itemID, WebKit::UserData userData)
+ WillGoToBackForwardListItem(uint64_t itemID, bool inPageCache, WebKit::UserData userData)
# Undo/Redo messages
RegisterEditCommandForUndo(uint64_t commandID, uint32_t editAction)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (222793 => 222794)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2017-10-03 18:54:11 UTC (rev 222794)
@@ -1107,7 +1107,7 @@
if (!shouldGoToBackForwardListItem)
return false;
- webPage->send(Messages::WebPageProxy::WillGoToBackForwardListItem(itemID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::WillGoToBackForwardListItem(itemID, bundleItem->isInPageCache(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
return true;
}
Modified: trunk/Tools/ChangeLog (222793 => 222794)
--- trunk/Tools/ChangeLog 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Tools/ChangeLog 2017-10-03 18:54:11 UTC (rev 222794)
@@ -1,3 +1,16 @@
+2017-10-03 Alex Christensen <[email protected]>
+
+ Add ObjC SPI equivalent to WKPageLoaderClient.willGoToBackForwardListItem
+ https://bugs.webkit.org/show_bug.cgi?id=177825
+ <rdar://problem/22387505>
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm:
+ (-[BackForwardDelegate _webView:willGoToBackForwardListItem:inPageCache:]):
+ (-[BackForwardDelegate webView:didFinishNavigation:]):
+ (TEST):
+
2017-10-03 Antti Koivisto <[email protected]>
Allow assigning WeakPtr<Derived> to WeakPtr<Base>
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm (222793 => 222794)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm 2017-10-03 18:48:57 UTC (rev 222793)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm 2017-10-03 18:54:11 UTC (rev 222794)
@@ -292,4 +292,42 @@
ASSERT_TRUE(didCancelRedirect);
}
-#endif
+#if PLATFORM(MAC)
+
+static bool navigationComplete;
+
+@interface BackForwardDelegate : NSObject<WKNavigationDelegatePrivate>
+@end
+@implementation BackForwardDelegate
+- (void)_webView:(WKWebView *)webView willGoToBackForwardListItem:(WKBackForwardListItem *)item inPageCache:(BOOL)inPageCache
+{
+ const char* expectedURL = [[[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"] absoluteString] UTF8String];
+ EXPECT_STREQ(item.URL.absoluteString.UTF8String, expectedURL);
+ EXPECT_TRUE(item.title == nil);
+ EXPECT_STREQ(item.initialURL.absoluteString.UTF8String, expectedURL);
+ EXPECT_TRUE(inPageCache);
+ isDone = true;
+}
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ navigationComplete = true;
+}
+@end
+
+TEST(WKNavigation, WillGoToBackForwardListItem)
+{
+ auto webView = adoptNS([[WKWebView alloc] init]);
+ auto delegate = adoptNS([[BackForwardDelegate alloc] init]);
+ [webView setNavigationDelegate:delegate.get()];
+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ TestWebKitAPI::Util::run(&navigationComplete);
+ navigationComplete = false;
+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ TestWebKitAPI::Util::run(&navigationComplete);
+ [webView goBack];
+ TestWebKitAPI::Util::run(&isDone);
+}
+
+#endif // PLATFORM(MAC)
+
+#endif // WK_API_ENABLED