<rdar://problem/11176921> and https://bugs.webkit.org/show_bug.cgi?id=83600 Need...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 17:46:05 +0000 (17:46 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 17:46:05 +0000 (17:46 +0000)
commit325a608939db15b834c2bc1cf33d80c377a86c5d
treebf8c98e37eb456a47394f6105cbd8e4648bc53f1
parente78e37b271131b30b28fecd71f68c3869f076a55
<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
20 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/WebLoaderClient.cpp
Source/WebKit2/UIProcess/WebLoaderClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.cpp
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBackForwardListItem.h
Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardListItem.h
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.cpp
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageLoaderClient.h
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/qt/QtBuiltinBundlePage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp