Changeset 222794 in webkit
- Timestamp:
- Oct 3, 2017 11:54:11 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r222776 r222794 1 2017-10-03 Alex Christensen <achristensen@webkit.org> 2 3 Add ObjC SPI equivalent to WKPageLoaderClient.willGoToBackForwardListItem 4 https://bugs.webkit.org/show_bug.cgi?id=177825 5 <rdar://problem/22387505> 6 7 Reviewed by Tim Horton. 8 9 * UIProcess/API/APILoaderClient.h: 10 (API::LoaderClient::willGoToBackForwardListItem): 11 * UIProcess/API/APINavigationClient.h: 12 (API::NavigationClient::canHandleWillGoToBackForwardListItem const): 13 (API::NavigationClient::willGoToBackForwardListItem): 14 * UIProcess/API/C/WKPage.cpp: 15 (WKPageSetPageLoaderClient): 16 * UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h: 17 * UIProcess/Cocoa/NavigationState.h: 18 * UIProcess/Cocoa/NavigationState.mm: 19 (WebKit::NavigationState::setNavigationDelegate): 20 (WebKit::NavigationState::NavigationClient::canHandleWillGoToBackForwardListItem const): 21 (WebKit::NavigationState::NavigationClient::willGoToBackForwardListItem): 22 * UIProcess/WebPageProxy.cpp: 23 (WebKit::WebPageProxy::willGoToBackForwardListItem): 24 * UIProcess/WebPageProxy.h: 25 * UIProcess/WebPageProxy.messages.in: 26 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 27 (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem const): 28 1 29 2017-10-03 Michael Catanzaro <mcatanzaro@igalia.com> 2 30 -
trunk/Source/WebKit/UIProcess/API/APILoaderClient.h
r206684 r222794 92 92 virtual void didChangeBackForwardList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*, Vector<RefPtr<WebKit::WebBackForwardListItem>>) { } 93 93 virtual bool shouldKeepCurrentBackForwardListItemInList(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem*) { return true; } 94 virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem *, API::Object*) { }94 virtual void willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, API::Object*) { } 95 95 96 96 virtual void didNavigateWithNavigationData(WebKit::WebPageProxy&, const WebKit::WebNavigationDataStore&, WebKit::WebFrameProxy&) { } -
trunk/Source/WebKit/UIProcess/API/APINavigationClient.h
r222602 r222794 120 120 virtual void resolveWebGLLoadPolicy(WebKit::WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const { completionHandler(WebCore::WebGLLoadPolicy::WebGLAllowCreation); } 121 121 #endif 122 123 virtual bool willGoToBackForwardListItem(WebKit::WebPageProxy&, WebKit::WebBackForwardListItem&, bool inPageCache, Object*) { return false; } 122 124 123 125 virtual void didBeginNavigationGesture(WebKit::WebPageProxy&) { } -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r222736 r222794 1231 1231 } 1232 1232 1233 void willGoToBackForwardListItem(WebPageProxy& page, WebBackForwardListItem *item, API::Object* userData) override1233 void willGoToBackForwardListItem(WebPageProxy& page, WebBackForwardListItem& item, API::Object* userData) override 1234 1234 { 1235 1235 if (m_client.willGoToBackForwardListItem) 1236 m_client.willGoToBackForwardListItem(toAPI(&page), toAPI( item), toAPI(userData), m_client.base.clientInfo);1236 m_client.willGoToBackForwardListItem(toAPI(&page), toAPI(&item), toAPI(userData), m_client.base.clientInfo); 1237 1237 } 1238 1238 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKNavigationDelegatePrivate.h
r222602 r222794 88 88 - (void)_webView:(WKWebView *)webView webGLLoadPolicyForURL:(NSURL *)url decisionHandler:(void (^)(_WKWebGLLoadPolicy))decisionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 89 89 - (void)_webView:(WKWebView *)webView resolveWebGLLoadPolicyForURL:(NSURL *)url decisionHandler:(void (^)(_WKWebGLLoadPolicy))decisionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 90 - (void)_webView:(WKWebView *)webView willGoToBackForwardListItem:(WKBackForwardListItem *)item inPageCache:(BOOL)inPageCache WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 90 91 #endif 91 92 -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.h
r222602 r222794 92 92 void didStartProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object*) override; 93 93 void didReceiveServerRedirectForProvisionalNavigation(WebPageProxy&, API::Navigation*, API::Object*) override; 94 void willPerformClientRedirect(Web Kit::WebPageProxy&, const WTF::String&, double) override;95 void didCancelClientRedirect(Web Kit::WebPageProxy&) override;94 void willPerformClientRedirect(WebPageProxy&, const WTF::String&, double) override; 95 void didCancelClientRedirect(WebPageProxy&) override; 96 96 void didFailProvisionalNavigationWithError(WebPageProxy&, WebFrameProxy&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override; 97 97 void didFailProvisionalLoadInSubframeWithError(WebPageProxy&, WebFrameProxy&, const WebCore::SecurityOriginData&, API::Navigation*, const WebCore::ResourceError&, API::Object*) override; … … 117 117 #endif 118 118 119 #if ENABLE(WEBGL) &&PLATFORM(MAC)119 #if PLATFORM(MAC) 120 120 void webGLLoadPolicy(WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const final; 121 121 void resolveWebGLLoadPolicy(WebPageProxy&, const WebCore::URL&, WTF::Function<void(WebCore::WebGLLoadPolicy)>&& completionHandler) const final; 122 bool willGoToBackForwardListItem(WebPageProxy&, WebBackForwardListItem&, bool inPageCache, API::Object*) final; 122 123 #endif 123 124 … … 210 211 #endif 211 212 212 #if ENABLE(WEBGL) &&PLATFORM(MAC)213 #if PLATFORM(MAC) 213 214 bool webViewWebGLLoadPolicyForURL : 1; 214 215 bool webViewResolveWebGLLoadPolicyForURL : 1; 216 bool webViewWillGoToBackForwardListItemInPageCache : 1; 215 217 #endif 216 218 } m_navigationDelegateMethods; -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r222602 r222794 175 175 m_navigationDelegateMethods.webViewDidRequestPasswordForQuickLookDocument = [delegate respondsToSelector:@selector(_webViewDidRequestPasswordForQuickLookDocument:)]; 176 176 #endif 177 #if ENABLE(WEBGL) &&PLATFORM(MAC)177 #if PLATFORM(MAC) 178 178 m_navigationDelegateMethods.webViewWebGLLoadPolicyForURL = [delegate respondsToSelector:@selector(_webView:webGLLoadPolicyForURL:decisionHandler:)]; 179 179 m_navigationDelegateMethods.webViewResolveWebGLLoadPolicyForURL = [delegate respondsToSelector:@selector(_webView:resolveWebGLLoadPolicyForURL:decisionHandler:)]; 180 m_navigationDelegateMethods.webViewWillGoToBackForwardListItemInPageCache = [delegate respondsToSelector:@selector(_webView:willGoToBackForwardListItem:inPageCache:)]; 180 181 #endif 181 182 } … … 339 340 completionHandler(toWebCoreWebGLLoadPolicy(policy)); 340 341 }).get()]; 342 } 343 344 bool NavigationState::NavigationClient::willGoToBackForwardListItem(WebPageProxy&, WebBackForwardListItem& item, bool inPageCache, API::Object*) 345 { 346 if (!m_navigationState.m_navigationDelegateMethods.webViewWillGoToBackForwardListItemInPageCache) 347 return false; 348 349 auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); 350 if (!navigationDelegate) 351 return false; 352 353 [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView willGoToBackForwardListItem:wrapper(item) inPageCache:inPageCache]; 354 return true; 341 355 } 342 356 #endif -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r222714 r222794 1205 1205 } 1206 1206 1207 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, const UserData& userData)1207 void WebPageProxy::willGoToBackForwardListItem(uint64_t itemID, bool inPageCache, const UserData& userData) 1208 1208 { 1209 1209 PageClientProtector protector(m_pageClient); 1210 1210 1211 if (WebBackForwardListItem* item = m_process->webBackForwardItem(itemID)) 1212 m_loaderClient->willGoToBackForwardListItem(*this, item, m_process->transformHandlesToObjects(userData.object()).get()); 1211 if (auto* item = m_process->webBackForwardItem(itemID)) { 1212 if (m_navigationClient->willGoToBackForwardListItem(*this, *item, inPageCache, m_process->transformHandlesToObjects(userData.object()).get())) 1213 return; 1214 m_loaderClient->willGoToBackForwardListItem(*this, *item, m_process->transformHandlesToObjects(userData.object()).get()); 1215 } 1213 1216 } 1214 1217 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r222714 r222794 411 411 void tryRestoreScrollPosition(); 412 412 void didChangeBackForwardList(WebBackForwardListItem* addedItem, Vector<RefPtr<WebBackForwardListItem>> removed); 413 void willGoToBackForwardListItem(uint64_t itemID, const UserData&);413 void willGoToBackForwardListItem(uint64_t itemID, bool inPageCache, const UserData&); 414 414 415 415 bool shouldKeepCurrentBackForwardListItemInList(WebBackForwardListItem*); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r222714 r222794 217 217 BackForwardForwardListCount() -> (int32_t count) 218 218 BackForwardClear() 219 WillGoToBackForwardListItem(uint64_t itemID, WebKit::UserData userData)219 WillGoToBackForwardListItem(uint64_t itemID, bool inPageCache, WebKit::UserData userData) 220 220 221 221 # Undo/Redo messages -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r222714 r222794 1108 1108 return false; 1109 1109 1110 webPage->send(Messages::WebPageProxy::WillGoToBackForwardListItem(itemID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));1110 webPage->send(Messages::WebPageProxy::WillGoToBackForwardListItem(itemID, bundleItem->isInPageCache(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); 1111 1111 return true; 1112 1112 } -
trunk/Tools/ChangeLog
r222793 r222794 1 2017-10-03 Alex Christensen <achristensen@webkit.org> 2 3 Add ObjC SPI equivalent to WKPageLoaderClient.willGoToBackForwardListItem 4 https://bugs.webkit.org/show_bug.cgi?id=177825 5 <rdar://problem/22387505> 6 7 Reviewed by Tim Horton. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm: 10 (-[BackForwardDelegate _webView:willGoToBackForwardListItem:inPageCache:]): 11 (-[BackForwardDelegate webView:didFinishNavigation:]): 12 (TEST): 13 1 14 2017-10-03 Antti Koivisto <antti@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/Navigation.mm
r221444 r222794 293 293 } 294 294 295 #endif 295 #if PLATFORM(MAC) 296 297 static bool navigationComplete; 298 299 @interface BackForwardDelegate : NSObject<WKNavigationDelegatePrivate> 300 @end 301 @implementation BackForwardDelegate 302 - (void)_webView:(WKWebView *)webView willGoToBackForwardListItem:(WKBackForwardListItem *)item inPageCache:(BOOL)inPageCache 303 { 304 const char* expectedURL = [[[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"] absoluteString] UTF8String]; 305 EXPECT_STREQ(item.URL.absoluteString.UTF8String, expectedURL); 306 EXPECT_TRUE(item.title == nil); 307 EXPECT_STREQ(item.initialURL.absoluteString.UTF8String, expectedURL); 308 EXPECT_TRUE(inPageCache); 309 isDone = true; 310 } 311 - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation 312 { 313 navigationComplete = true; 314 } 315 @end 316 317 TEST(WKNavigation, WillGoToBackForwardListItem) 318 { 319 auto webView = adoptNS([[WKWebView alloc] init]); 320 auto delegate = adoptNS([[BackForwardDelegate alloc] init]); 321 [webView setNavigationDelegate:delegate.get()]; 322 [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; 323 TestWebKitAPI::Util::run(&navigationComplete); 324 navigationComplete = false; 325 [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple2" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; 326 TestWebKitAPI::Util::run(&navigationComplete); 327 [webView goBack]; 328 TestWebKitAPI::Util::run(&isDone); 329 } 330 331 #endif // PLATFORM(MAC) 332 333 #endif // WK_API_ENABLED
Note: See TracChangeset
for help on using the changeset viewer.