Changeset 76357 in webkit


Ignore:
Timestamp:
Jan 21, 2011 10:26:42 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-01-21 Charlie Reis <creis@chromium.org>

Reviewed by Darin Fisher.

FrameLoader::checkLoadCompleteForThisFrame uses wrong history item
https://bugs.webkit.org/show_bug.cgi?id=48812

Test that we avoid updating back/forward list on a canceled navigation
if a new navigation is already in process. Also update forward-and-cancel
to go forward, ensuring back/forward state is reset if user clicks stop.

  • http/tests/navigation/back-twice-without-commit-expected.txt: Added.
  • http/tests/navigation/back-twice-without-commit.html: Added.
  • http/tests/navigation/forward-and-cancel-expected.txt:
  • http/tests/navigation/forward-and-cancel.html: Go forward after stop, not back.
  • http/tests/navigation/resources/back-twice-page-2.html: Added.
  • http/tests/navigation/resources/back-twice-page-3.html: Added.
  • http/tests/navigation/resources/forward-and-cancel-frames.html: Reduced delay.

2011-01-21 Charlie Reis <creis@chromium.org>

Reviewed by Darin Fisher.

FrameLoader::checkLoadCompleteForThisFrame uses wrong history item
https://bugs.webkit.org/show_bug.cgi?id=48812

Most calls to stopAllLoaders now clear the history's provisional item(s).
We can now avoid resetting the back/forward state if a new navigation
is in progress.

Test: http/tests/navigation/back-twice-without-commit.html
Test: http/tests/navigation/forward-and-cancel.html

  • loader/FrameLoader.cpp:
  • loader/FrameLoader.h:
  • loader/FrameLoaderTypes.h:
  • WebCore.exp.in: Update stopAllLoaders signature.
Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76356 r76357  
     12011-01-21  Charlie Reis  <creis@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        FrameLoader::checkLoadCompleteForThisFrame uses wrong history item
     6        https://bugs.webkit.org/show_bug.cgi?id=48812
     7
     8        Test that we avoid updating back/forward list on a canceled navigation
     9        if a new navigation is already in process.  Also update forward-and-cancel
     10        to go forward, ensuring back/forward state is reset if user clicks stop.
     11
     12        * http/tests/navigation/back-twice-without-commit-expected.txt: Added.
     13        * http/tests/navigation/back-twice-without-commit.html: Added.
     14        * http/tests/navigation/forward-and-cancel-expected.txt:
     15        * http/tests/navigation/forward-and-cancel.html: Go forward after stop, not back.
     16        * http/tests/navigation/resources/back-twice-page-2.html: Added.
     17        * http/tests/navigation/resources/back-twice-page-3.html: Added.
     18        * http/tests/navigation/resources/forward-and-cancel-frames.html: Reduced delay.
     19
    1202011-01-20  Mihai Parparita  <mihaip@chromium.org>
    221
  • trunk/LayoutTests/http/tests/navigation/forward-and-cancel-expected.txt

    r75336 r76357  
    1 This test checks that the backForward list is not corrupted when a frame load is canceled.
    2 
    3 If testing manually, click here.
     1 
    42
    53============== Back Forward List ==============
    6 curr->  http://127.0.0.1:8000/navigation/forward-and-cancel.html  **nav target**
     4        http://127.0.0.1:8000/navigation/forward-and-cancel.html  **nav target**
    75        http://127.0.0.1:8000/navigation/resources/forward-and-cancel-frames-container.html  **nav target**
    86            http://127.0.0.1:8000/navigation/resources/forward-and-cancel-frames.html (in frame "<!--framePath //<!--frame0-->-->")
    97                about:blank (in frame "frame1")
    108            http://127.0.0.1:8000/navigation/resources/otherpage.html (in frame "<!--framePath //<!--frame1-->-->")
    11         http://127.0.0.1:8000/navigation/resources/forward-and-cancel-frames-container.html
     9curr->  http://127.0.0.1:8000/navigation/resources/forward-and-cancel-frames-container.html
    1210            http://127.0.0.1:8000/navigation/resources/forward-and-cancel-frames.html (in frame "<!--framePath //<!--frame0-->-->")
    13                 http://127.0.0.1:8000/navigation/resources/slow-resource-1-sec.pl (in frame "frame1")  **nav target**
     11                http://127.0.0.1:8000/navigation/resources/slow-resource.pl?delay=250 (in frame "frame1")  **nav target**
    1412            http://127.0.0.1:8000/navigation/resources/otherpage.html (in frame "<!--framePath //<!--frame1-->-->")
    1513===============================================
  • trunk/LayoutTests/http/tests/navigation/forward-and-cancel.html

    r75336 r76357  
    88// 5. Go forward to slow URL, but stop before the navigation commits.
    99//    Important to cancel the load and ensure the history is not corrupted.
    10 // 6. Go back to start page with no frames.
    11 //    Important for testing that subframes can be removed.
     10// 6. Go forward and let slow URL load.
     11//    Important for testing that navigation state is reset after stopping.
    1212if (window.layoutTestController) {
     13    layoutTestController.clearBackForwardList();
    1314    layoutTestController.dumpBackForwardList();
    1415    layoutTestController.dumpAsText();
     
    2223
    2324    // Now go back to make sure the backForwardList is not corrupted.
    24     layoutTestController.queueNonLoadingScript("setTimeout('history.back();',50);");
     25    layoutTestController.queueNonLoadingScript("setTimeout('history.forward();',50);");
     26    layoutTestController.queueNonLoadingScript("setTimeout('layoutTestController.notifyDone();',100);");
    2527
    2628    // Wait until we get back to this page.
     
    3032<p>This test checks that the backForward list is not corrupted when a frame load is canceled.
    3133<p>If testing manually, <a href="resources/forward-and-cancel-frames-container.html">click here</a>.
    32 
    33 <script>
    34 if (window.layoutTestController) {
    35     // Only notify done when we return to this page a second time.
    36     if (!window.localStorage.started) {
    37         window.localStorage.started = true;
    38     } else {
    39         delete window.localStorage.started;
    40         layoutTestController.notifyDone();
    41     }
    42 }
    43 </script>
  • trunk/LayoutTests/http/tests/navigation/resources/forward-and-cancel-frames.html

    r75336 r76357  
    1313<br>
    1414<p>This test checks that the backForward list is not corrupted when a frame load is canceled.
    15 <p>If testing manually, <a id="link" href="slow-resource-1-sec.pl" target="frame1">click here</a> and then Back.  Then click Forward and quickly click Stop.  Ensure that Back and Forward still work.
     15<p>If testing manually, <a id="link" href="slow-resource.pl?delay=250" target="frame1">click here</a> and then Back.  Then click Forward and quickly click Stop.  Ensure that Back and Forward still work.
  • trunk/Source/WebCore/ChangeLog

    r76351 r76357  
     12011-01-21  Charlie Reis  <creis@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        FrameLoader::checkLoadCompleteForThisFrame uses wrong history item
     6        https://bugs.webkit.org/show_bug.cgi?id=48812
     7
     8        Most calls to stopAllLoaders now clear the history's provisional item(s).
     9        We can now avoid resetting the back/forward state if a new navigation
     10        is in progress.
     11
     12        Test: http/tests/navigation/back-twice-without-commit.html
     13        Test: http/tests/navigation/forward-and-cancel.html
     14
     15        * loader/FrameLoader.cpp:
     16        * loader/FrameLoader.h:
     17        * loader/FrameLoaderTypes.h:
     18        * WebCore.exp.in: Update stopAllLoaders signature.
     19
    1202011-01-21  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebCore/WebCore.exp.in

    r76292 r76357  
    164164__ZN7WebCore11FrameLoader12shouldReloadERKNS_4KURLES3_
    165165__ZN7WebCore11FrameLoader14detachChildrenEv
    166 __ZN7WebCore11FrameLoader14stopAllLoadersENS_14DatabasePolicyE
     166__ZN7WebCore11FrameLoader14stopAllLoadersENS_14DatabasePolicyENS_26ClearProvisionalItemPolicyE
    167167__ZN7WebCore11FrameLoader16detachFromParentEv
    168168__ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestEbbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEENS_14ReferrerPolicyE
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r76173 r76357  
    16831683}
    16841684
    1685 void FrameLoader::stopLoadingSubframes()
     1685void FrameLoader::stopLoadingSubframes(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy)
    16861686{
    16871687    for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling())
    1688         child->loader()->stopAllLoaders();
    1689 }
    1690 
    1691 void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy)
     1688        child->loader()->stopAllLoaders(databasePolicy, clearProvisionalItemPolicy);
     1689}
     1690
     1691void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy)
    16921692{
    16931693    ASSERT(!m_frame->document() || !m_frame->document()->inPageCache());
     
    17031703    policyChecker()->stopCheck();
    17041704
    1705     stopLoadingSubframes();
     1705    // If no new load is in progress, we should clear the provisional item from history
     1706    // before we call stopLoading.
     1707    if (clearProvisionalItemPolicy == ShouldClearProvisionalItem)
     1708        history()->setProvisionalItem(0);
     1709
     1710    stopLoadingSubframes(databasePolicy, clearProvisionalItemPolicy);
    17061711    if (m_provisionalDocumentLoader)
    17071712        m_provisionalDocumentLoader->stopLoading(databasePolicy);
     
    23542359                    item = page->mainFrame()->loader()->history()->currentItem();
    23552360               
    2356             bool shouldReset = true;
     2361            // Only reset if we aren't already going to a new provisional item.
     2362            bool shouldReset = !history()->provisionalItem();
    23572363            if (!(pdl->isLoadingInAPISense() && !pdl->isStopping())) {
    23582364                m_delegateIsHandlingProvisionalLoadError = true;
     
    23632369                // which it must be to be in this branch of the if? And is it OK to just do a full-on
    23642370                // stopAllLoaders instead of stopLoadingSubframes?
    2365                 stopLoadingSubframes();
     2371                stopLoadingSubframes(DatabasePolicyStop, ShouldNotClearProvisionalItem);
    23662372                pdl->stopLoading();
    23672373
     
    29652971
    29662972    FrameLoadType type = policyChecker()->loadType();
    2967     stopAllLoaders();
     2973    // A new navigation is in progress, so don't clear the history's provisional item.
     2974    stopAllLoaders(DatabasePolicyStop, ShouldNotClearProvisionalItem);
    29682975   
    29692976    // <rdar://problem/6250856> - In certain circumstances on pages with multiple frames, stopAllLoaders()
  • trunk/Source/WebCore/loader/FrameLoader.h

    r76248 r76357  
    129129
    130130    // Also not cool.
    131     void stopAllLoaders(DatabasePolicy = DatabasePolicyStop);
     131    void stopAllLoaders(DatabasePolicy = DatabasePolicyStop, ClearProvisionalItemPolicy = ShouldClearProvisionalItem);
    132132    void stopForUserCancel(bool deferCheckLoadComplete = false);
    133133
     
    356356
    357357    // Also not cool.
    358     void stopLoadingSubframes();
     358    void stopLoadingSubframes(DatabasePolicy, ClearProvisionalItemPolicy);
    359359
    360360    void clearProvisionalLoad();
  • trunk/Source/WebCore/loader/FrameLoaderTypes.h

    r64051 r76357  
    7474        DatabasePolicyContinue
    7575    };
     76   
     77    enum ClearProvisionalItemPolicy {
     78        ShouldClearProvisionalItem,
     79        ShouldNotClearProvisionalItem
     80    };
    7681
    7782    enum ObjectContentType {
Note: See TracChangeset for help on using the changeset viewer.