Changeset 93296 in webkit


Ignore:
Timestamp:
Aug 18, 2011 4:10:44 AM (13 years ago)
Author:
gavinp@chromium.org
Message:

Prepare frames for history navigation.

Before beginning an explicit history navigation in a newly initialized
frame, it's important to give a "previous" item to avoid crashes, and
give a state to the state machine to avoid extra validating loads.

https://bugs.webkit.org/show_bug.cgi?id=66322

Reviewed by Darin Fisher.

Source/WebCore:

No new tests, as history navigation is very difficult to test in
DumpRenderTree.

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::prepareForHistoryNavigation):

  • loader/FrameLoader.h:

Source/WebKit/chromium:

  • src/WebFrameImpl.cpp:

(WebKit::WebFrameImpl::loadHistoryItem):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r93295 r93296  
     12011-08-18  Gavin Peters  <gavinp@chromium.org>
     2
     3        Prepare frames for history navigation.
     4
     5        Before beginning an explicit history navigation in a newly initialized
     6        frame, it's important to give a "previous" item to avoid crashes, and
     7        give a state to the state machine to avoid extra validating loads.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=66322
     10
     11        Reviewed by Darin Fisher.
     12
     13        No new tests, as history navigation is very difficult to test in
     14        DumpRenderTree.
     15
     16        * loader/FrameLoader.cpp:
     17        (WebCore::FrameLoader::prepareForHistoryNavigation):
     18        * loader/FrameLoader.h:
     19
    1202011-08-18  Jing Zhao  <jingzhao@chromium.org>
    221
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r93066 r93296  
    10911091}
    10921092
     1093void FrameLoader::prepareForHistoryNavigation()
     1094{
     1095    // If there is no currentItem, but we still want to engage in
     1096    // history navigation we need to manufacture one, and update
     1097    // the state machine of this frame to impersonate having
     1098    // loaded it.
     1099    RefPtr<HistoryItem> currentItem = history()->currentItem();
     1100    if (!currentItem) {
     1101        currentItem = HistoryItem::create();
     1102        currentItem->setLastVisitWasFailure(true);
     1103        history()->setCurrentItem(currentItem.get());
     1104        frame()->page()->backForward()->setCurrentItem(currentItem.get());
     1105
     1106        ASSERT(stateMachine()->isDisplayingInitialEmptyDocument());
     1107        stateMachine()->advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit);
     1108        stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad);
     1109    }
     1110}
     1111
    10931112void FrameLoader::prepareForLoadStart()
    10941113{
  • trunk/Source/WebCore/loader/FrameLoader.h

    r93066 r93296  
    9292    IconController* icon() const { return &m_icon; }
    9393
     94    void prepareForHistoryNavigation();
    9495    void prepareForLoadStart();
    9596    void setupForReplace();
  • trunk/Source/WebKit/chromium/ChangeLog

    r93294 r93296  
     12011-08-18  Gavin Peters  <gavinp@chromium.org>
     2
     3        Prepare frames for history navigation.
     4
     5        Before beginning an explicit history navigation in a newly initialized
     6        frame, it's important to give a "previous" item to avoid crashes, and
     7        give a state to the state machine to avoid extra validating loads.
     8
     9        https://bugs.webkit.org/show_bug.cgi?id=66322
     10
     11        Reviewed by Darin Fisher.
     12
     13        * src/WebFrameImpl.cpp:
     14        (WebKit::WebFrameImpl::loadHistoryItem):
     15
    1162011-08-18  Nico Weber  <thakis@chromium.org>
    217
  • trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp

    r92893 r93296  
    890890    ASSERT(historyItem.get());
    891891
    892     // If there is no currentItem, which happens when we are navigating in
    893     // session history after a crash, we need to manufacture one otherwise WebKit
    894     // hoarks. This is probably the wrong thing to do, but it seems to work.
     892    m_frame->loader()->prepareForHistoryNavigation();
    895893    RefPtr<HistoryItem> currentItem = m_frame->loader()->history()->currentItem();
    896     if (!currentItem) {
    897         currentItem = HistoryItem::create();
    898         currentItem->setLastVisitWasFailure(true);
    899         m_frame->loader()->history()->setCurrentItem(currentItem.get());
    900         m_frame->page()->backForward()->setCurrentItem(currentItem.get());
    901     }
    902 
    903894    m_inSameDocumentHistoryLoad = currentItem->shouldDoSameDocumentNavigationTo(historyItem.get());
    904895    m_frame->page()->goToItem(historyItem.get(),
Note: See TracChangeset for help on using the changeset viewer.