Skip to content
  • bweinstein@apple.com's avatar
    Source/WebKit2: WebKit2: Assertion when calling didPerform*Redirect on null... · da7434ad
    bweinstein@apple.com authored
    Source/WebKit2: WebKit2: Assertion when calling didPerform*Redirect on null source/destination URL string
    https://bugs.webkit.org/show_bug.cgi?id=67794
    <rdar://problem/9892024>
            
    Don't call didPerformClientRedirect or didPerformServerRedirect when source or destination URL string
    is empty or null.
            
    If we call didPerformClientRedirect or didPerformServerRedirect when the source or destination is null,
    it causes an assert in WKURLCF::WKURLCopyCFURL when we try to convert the WKURLRef into a CFURLRef.
    
    Reviewed by Brady Eidson.
    
    * UIProcess/WebContext.cpp:
    (WebKit::WebContext::didPerformClientRedirect): Return early if the source or destination URL string is empty or null.
    (WebKit::WebContext::didPerformServerRedirect): Ditto.
    
    Tools: WebKit2: Assertion when calling didPerform*Redirect on null source/destination URL string
    https://bugs.webkit.org/show_bug.cgi?id=67794
    <rdar://problem/9892024>
            
    Add a test that we don't send a didPerformServerRedirect when a load is cancelled from willSendRequest.
    
    Reviewed by Brady Eidson.
    
    * TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback.cpp: Added.
    (TestWebKitAPI::didFinishLoadForFrame): Set flags on whether we've loaded the main frame, iframe, or both.
    (TestWebKitAPI::didPerformServerRedirect): Set a flag for whether we've performed a server redirect.
    (TestWebKitAPI::TEST): Set up a WKPageLoaderClient and WKContextHistoryClient, and load simple-iframe.html.
        Once both frames have loaded (main frame and blocked iframe), make sure that we have never called
        didPerformServerRedirect.
    
    * TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp: Added.
    (TestWebKitAPI::LoadCanceledNoServerRedirectCallbackTest::LoadCanceledNoServerRedirectCallbackTest): Initialize
        our InjectedBundleTest.
    (TestWebKitAPI::LoadCanceledNoServerRedirectCallbackTest::willSendRequestForFrame): If we are dealing with a request
        from the main frame (the main resource in simple-iframe.html), allow it. If not (dealing with the iframe), block
        the request.
    (TestWebKitAPI::LoadCanceledNoServerRedirectCallbackTest::didCreatePage): Set up the WKBundlePageResourceLoadClient.
    
    * TestWebKitAPI/Tests/WebKit2/simple-iframe.html: Added.
            
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add new files.
    * TestWebKitAPI/win/TestWebKitAPI.vcproj: Ditto.
    * TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj: Ditto.
    * TestWebKitAPI/win/copy-resources.cmd: Ditto.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    da7434ad