• aroben@apple.com's avatar
    Make WKBundlePageCanHandleRequest return true for empty document URLs · ec43bb1b
    aroben@apple.com authored
    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: svn://svn.chromium.org/blink/trunk@81105 bbb929c8-8fbe-4397-9dbb-9b2b20218538
    ec43bb1b
WebPage.cpp 69.3 KB