Make WKBundlePageCanHandleRequest return true for empty document URLs
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 04:30:44 +0000 (04:30 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 04:30:44 +0000 (04:30 +0000)
commit66abed3aa04a49d0ab1611aa7717bac999344c31
treefea1c984e4e9e41e9920b96a4fba07d310def752
parent52e9f0a71a7880754aa2f31bb88f40040194f839
Make WKBundlePageCanHandleRequest return true for empty document URLs

Reviewed by Sam Weinig.

Source/WebKit2:

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::canHandleRequest): Return true for any URL schemes that are handled as
empty documents, and defer to the platform for everything else.

* WebProcess/WebPage/WebPage.h: Added platformCanHandleRequest.

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformCanHandleRequest):
* WebProcess/WebPage/qt/WebPageQt.cpp:
(WebKit::WebPage::platformCanHandleRequest):
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::platformCanHandleRequest):
Renamed from canHandleRequest.

Tools:

Test that WKBundlePageCanHandleRequest returns true for empty document URLs

* TestWebKitAPI/Tests/WebKit2/CanHandleRequest.cpp: Added.
(TestWebKitAPI::didReceiveMessageFromInjectedBundle): Store the result of the test.
(TestWebKitAPI::setInjectedBundleClient): Hook up our callback.
(TestWebKitAPI::TEST): Register "emptyscheme" as an empty document scheme, load a page to
ensure the web process is initialized, then ask the bundle to run the test and assert that
it succeeded.

* TestWebKitAPI/Tests/WebKit2/CanHandleRequest_Bundle.cpp: Added.
(TestWebKitAPI::CanHandleRequestTest::CanHandleRequestTest): Just call up to the base class.
(TestWebKitAPI::canHandleURL): Helper function to test whether WebKit2 claims to be able to
handle a given URL.
(TestWebKitAPI::runTest): Check that empty document URLs can be handled (and that an unknown
URL type cannot be handled).
(TestWebKitAPI::CanHandleRequestTest::didReceiveMessage): Run the test and return the
result.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/win/TestWebKitAPI.vcproj:
* TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj:
Added new files to the project.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/CanHandleRequest.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2/CanHandleRequest_Bundle.cpp [new file with mode: 0644]
Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj
Tools/TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj