Changeset 94812 in webkit


Ignore:
Timestamp:
Sep 8, 2011 3:45:12 PM (13 years ago)
Author:
bweinstein@apple.com
Message:

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.
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r94811 r94812  
     12011-09-08  Brian Weinstein  <bweinstein@apple.com>
     2
     3        WebKit2: Assertion when calling didPerform*Redirect on null source/destination URL string
     4        https://bugs.webkit.org/show_bug.cgi?id=67794
     5        <rdar://problem/9892024>
     6       
     7        Don't call didPerformClientRedirect or didPerformServerRedirect when source or destination URL string
     8        is empty or null.
     9       
     10        If we call didPerformClientRedirect or didPerformServerRedirect when the source or destination is null,
     11        it causes an assert in WKURLCF::WKURLCopyCFURL when we try to convert the WKURLRef into a CFURLRef.
     12
     13        Reviewed by Brady Eidson.
     14
     15        * UIProcess/WebContext.cpp:
     16        (WebKit::WebContext::didPerformClientRedirect): Return early if the source or destination URL string is empty or null.
     17        (WebKit::WebContext::didPerformServerRedirect): Ditto.
     18
    1192011-09-08  Sam Weinig  <sam@webkit.org>
    220
  • trunk/Source/WebKit2/UIProcess/WebContext.cpp

    r94476 r94812  
    433433    if (!page)
    434434        return;
     435
     436    if (sourceURLString.isEmpty() || destinationURLString.isEmpty())
     437        return;
    435438   
    436439    WebFrameProxy* frame = m_process->webFrame(frameID);
     
    445448    WebPageProxy* page = m_process->webPage(pageID);
    446449    if (!page)
     450        return;
     451   
     452    if (sourceURLString.isEmpty() || destinationURLString.isEmpty())
    447453        return;
    448454   
  • trunk/Tools/ChangeLog

    r94803 r94812  
     12011-09-08  Brian Weinstein  <bweinstein@apple.com>
     2
     3        WebKit2: Assertion when calling didPerform*Redirect on null source/destination URL string
     4        https://bugs.webkit.org/show_bug.cgi?id=67794
     5        <rdar://problem/9892024>
     6       
     7        Add a test that we don't send a didPerformServerRedirect when a load is cancelled from willSendRequest.
     8
     9        Reviewed by Brady Eidson.
     10
     11        * TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback.cpp: Added.
     12        (TestWebKitAPI::didFinishLoadForFrame): Set flags on whether we've loaded the main frame, iframe, or both.
     13        (TestWebKitAPI::didPerformServerRedirect): Set a flag for whether we've performed a server redirect.
     14        (TestWebKitAPI::TEST): Set up a WKPageLoaderClient and WKContextHistoryClient, and load simple-iframe.html.
     15            Once both frames have loaded (main frame and blocked iframe), make sure that we have never called
     16            didPerformServerRedirect.
     17
     18        * TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp: Added.
     19        (TestWebKitAPI::LoadCanceledNoServerRedirectCallbackTest::LoadCanceledNoServerRedirectCallbackTest): Initialize
     20            our InjectedBundleTest.
     21        (TestWebKitAPI::LoadCanceledNoServerRedirectCallbackTest::willSendRequestForFrame): If we are dealing with a request
     22            from the main frame (the main resource in simple-iframe.html), allow it. If not (dealing with the iframe), block
     23            the request.
     24        (TestWebKitAPI::LoadCanceledNoServerRedirectCallbackTest::didCreatePage): Set up the WKBundlePageResourceLoadClient.
     25
     26        * TestWebKitAPI/Tests/WebKit2/simple-iframe.html: Added.
     27       
     28        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Add new files.
     29        * TestWebKitAPI/win/TestWebKitAPI.vcproj: Ditto.
     30        * TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj: Ditto.
     31        * TestWebKitAPI/win/copy-resources.cmd: Ditto.
     32
    1332011-09-08  David Levin  <levin@chromium.org>
    234
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r94488 r94812  
    1818                33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */; };
    1919                33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */; };
     20                33DC8911141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */; };
     21                33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33DC890E1419539300747EF7 /* simple-iframe.html */; };
     22                33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; };
    2023                33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; };
    2124                37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37200B9113A16230007A4FAD /* VectorReverse.cpp */; };
     
    109112                        dstSubfolderSpec = 7;
    110113                        files = (
     114                                33DC8912141955FE00747EF7 /* simple-iframe.html in Copy Resources */,
    111115                                1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */,
    112116                                C07E6CB213FD73930038B22B /* devicePixelRatio.html in Copy Resources */,
     
    136140                33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; };
    137141                33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash_Bundle.cpp; sourceTree = "<group>"; };
     142                33DC890E1419539300747EF7 /* simple-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-iframe.html"; sourceTree = "<group>"; };
     143                33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCanceledNoServerRedirectCallback.cpp; sourceTree = "<group>"; };
     144                33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadCanceledNoServerRedirectCallback_Bundle.cpp; sourceTree = "<group>"; };
    138145                33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "mouse-move-listener.html"; sourceTree = "<group>"; };
    139146                37200B9113A16230007A4FAD /* VectorReverse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VectorReverse.cpp; path = WTF/VectorReverse.cpp; sourceTree = "<group>"; };
     
    340347                                BC575AAC126E83B9006F0F12 /* InjectedBundleBasic.cpp */,
    341348                                BC575AAF126E83C8006F0F12 /* InjectedBundleBasic_Bundle.cpp */,
     349                                33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */,
     350                                33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */,
    342351                                33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */,
    343352                                33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */,
     
    377386                                1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */,
    378387                                C0ADBE8412FCA6B600D2C129 /* simple-form.html */,
     388                                33DC890E1419539300747EF7 /* simple-iframe.html */,
    379389                                BC909778125571AB00083756 /* simple.html */,
    380390                                C02B7882126615410026BF0F /* spacebar-scrolling.html */,
     
    571581                                939BA91714103412001A01BD /* DeviceScaleFactorOnBack.mm in Sources */,
    572582                                3799AD3A14120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm in Sources */,
     583                                33DC8911141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
    573584                        );
    574585                        runOnlyForDeploymentPostprocessing = 0;
     
    589600                                33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */,
    590601                                1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */,
     602                                33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */,
    591603                        );
    592604                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj

    r94208 r94812  
    485485                                </File>
    486486                                <File
     487                                        RelativePath="..\Tests\WebKit2\LoadCanceledNoServerRedirectCallback.cpp"
     488                                        >
     489                                </File>
     490                                <File
    487491                                        RelativePath="..\Tests\WebKit2\mouse-move-listener.html"
    488492                                        >
     
    518522                                <File
    519523                                        RelativePath="..\Tests\WebKit2\simple-form.html"
     524                                        >
     525                                </File>
     526                                <File
     527                                        RelativePath="..\Tests\WebKit2\simple-iframe.html"
    520528                                        >
    521529                                </File>
  • trunk/Tools/TestWebKitAPI/win/TestWebKitAPIInjectedBundle.vcproj

    r92128 r94812  
    421421                                </File>
    422422                                <File
     423                                        RelativePath="..\Tests\WebKit2\LoadCanceledNoServerRedirectCallback_Bundle.cpp"
     424                                        >
     425                                </File>
     426                                <File
    423427                                        RelativePath="..\Tests\WebKit2\MouseMoveAfterCrash_Bundle.cpp"
    424428                                        >
  • trunk/Tools/TestWebKitAPI/win/copy-resources.cmd

    r86945 r94812  
    1717    ..\Tests\WebKit2\simple-accelerated-compositing.html
    1818    ..\Tests\WebKit2\simple-form.html
     19    ..\Tests\WebKit2\simple-iframe.html
    1920    ..\Tests\WebKit2\spacebar-scrolling.html
    2021) do (
Note: See TracChangeset for help on using the changeset viewer.