Skip to content
  • beidson@apple.com's avatar
    <rdar://problem/11176921> and https://bugs.webkit.org/show_bug.cgi?id=83600... · 325a6089
    beidson@apple.com authored
    <rdar://problem/11176921> and https://bugs.webkit.org/show_bug.cgi?id=83600 Need WebKit2 API to notify whether history loads are in the page cache
    
    Source/WebKit2:
    
    - Add a new WKBundlePageLoaderClient callback allowing the bundle to be notified
      of back/forward navigations (and deny them if it chooses)
    - Add a new API to WKBundleBackForwardListItem to probe if the item is in the page cache.
    
    Reviewed by Darin Adler.
    
    Add the new WKBundleBackForwardListItem API:
    * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp:
    (WKBundleBackForwardListItemIsInPageCache):
    * WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h:
    * WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h:
    (WebKit::InjectedBundleBackForwardListItem::isInPageCache):
    
    Update the UI page loader client to allow for a user data object to be passed from the bundle:
    * UIProcess/API/C/WKPage.h:
    * UIProcess/WebLoaderClient.cpp:
    (WebKit::WebLoaderClient::shouldGoToBackForwardListItem): Update a comment typo.
    (WebKit::WebLoaderClient::willGoToBackForwardListItem): Update for the user data field.
    * UIProcess/WebLoaderClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::willGoToBackForwardListItem):
    * UIProcess/WebPageProxy.h:
    * UIProcess/WebPageProxy.messages.in:
    
    Add the new callback to the bundle loader client:
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp:
    (WebKit::InjectedBundlePageLoaderClient::shouldGoToBackForwardListItem):
    * WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h:
    (InjectedBundlePageLoaderClient):
    
    Call the bundle client before doing anything else, possibly canceling the navigation:
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::shouldGoToHistoryItem):
    
    * WebProcess/qt/QtBuiltinBundlePage.cpp:
    (WebKit::QtBuiltinBundlePage::QtBuiltinBundlePage) Adopt new bundle client interface.
    
    Tools:
    
    Add a test ShouldGoToBackForwardListItem that exercises the new BundlePageLoaderClient
    callback as well as the new WKBundleBackForwardListItemIsInPageCache() API.
    
    Reviewed by Darin Adler.
    
    * TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp: Added.
    (TestWebKitAPI::didFinishLoadForFrame):
    (TestWebKitAPI::willGoToBackForwardListItem):
    (TestWebKitAPI::setPageLoaderClient):
    (TestWebKitAPI::TEST):
    * TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp: Added.
    (ShouldGoToBackForwardListItemTest):
    (TestWebKitAPI::shouldGoToBackForwardListItemCallback):
    (TestWebKitAPI::ShouldGoToBackForwardListItemTest::ShouldGoToBackForwardListItemTest):
    (TestWebKitAPI::ShouldGoToBackForwardListItemTest::didCreatePage):
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
    (WTR::InjectedBundlePage::InjectedBundlePage): Update for the new client.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    325a6089