Changeset 109480 in webkit


Ignore:
Timestamp:
Mar 1, 2012 6:29:59 PM (12 years ago)
Author:
tkent@chromium.org
Message:

REGRESSION(r106388): Form state is restored to a wrong document.
https://bugs.webkit.org/show_bug.cgi?id=79206

Reviewed by Brady Eidson.

Source/WebCore:

In some cases, the URL of the current HistoryItem and the document
URL are mismatched.
A form state should be restored only if the document was loaded
with a HistoryItem and the document is not loaded as a
redirection.

Test: fast/loader/form-state-restore-with-locked-back-forward-list.html

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::checkCompleted): Clear m_requestedHistoryItem.
(WebCore::FrameLoader::loadItem):
Save the requested HistoryItem for didLoadWithLodItem().

  • loader/FrameLoader.h:

(WebCore::FrameLoader::requestedHistoryItem):
Added. Accessor for m_requestedHistoryItem.

  • loader/HistoryController.cpp:

(WebCore::HistoryController::restoreDocumentState):
Restore a form state only if the current document was loaded with
FrameLoader::loadItem() and not redirection.

LayoutTests:

  • fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt: Added.
  • fast/loader/form-state-restore-with-locked-back-forward-list.html: Added.
  • fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html: Added.
  • fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r109468 r109480  
     12012-03-01  Kent Tamura  <tkent@chromium.org>
     2
     3        REGRESSION(r106388): Form state is restored to a wrong document.
     4        https://bugs.webkit.org/show_bug.cgi?id=79206
     5
     6        Reviewed by Brady Eidson.
     7
     8        * fast/loader/form-state-restore-with-locked-back-forward-list-expected.txt: Added.
     9        * fast/loader/form-state-restore-with-locked-back-forward-list.html: Added.
     10        * fast/loader/resources/form-state-restore-with-locked-back-forward-list-2.html: Added.
     11        * fast/loader/resources/form-state-restore-with-locked-back-forward-list-3.html: Added.
     12
    1132012-03-01  Adam Klein  <adamk@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r109476 r109480  
     12012-03-01  Kent Tamura  <tkent@chromium.org>
     2
     3        REGRESSION(r106388): Form state is restored to a wrong document.
     4        https://bugs.webkit.org/show_bug.cgi?id=79206
     5
     6        Reviewed by Brady Eidson.
     7
     8        In some cases, the URL of the current HistoryItem and the document
     9        URL are mismatched.
     10        A form state should be restored only if the document was loaded
     11        with a HistoryItem and the document is not loaded as a
     12        redirection.
     13
     14        Test: fast/loader/form-state-restore-with-locked-back-forward-list.html
     15
     16        * loader/FrameLoader.cpp:
     17        (WebCore::FrameLoader::checkCompleted): Clear m_requestedHistoryItem.
     18        (WebCore::FrameLoader::loadItem):
     19        Save the requested HistoryItem for didLoadWithLodItem().
     20        * loader/FrameLoader.h:
     21        (WebCore::FrameLoader::requestedHistoryItem):
     22        Added. Accessor for m_requestedHistoryItem.
     23        * loader/HistoryController.cpp:
     24        (WebCore::HistoryController::restoreDocumentState):
     25        Restore a form state only if the current document was loaded with
     26        FrameLoader::loadItem() and not redirection.
     27
    1282012-03-01  Xingnan Wang  <xingnan.wang@intel.com>
    229
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r109369 r109480  
    739739    // OK, completed.
    740740    m_isComplete = true;
     741    m_requestedHistoryItem = 0;
    741742    m_frame->document()->setReadyState(Document::Complete);
    742743
     
    31743175void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType)
    31753176{
     3177    m_requestedHistoryItem = item;
    31763178    HistoryItem* currentItem = history()->currentItem();
    31773179    bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavigationTo(currentItem);
  • trunk/Source/WebCore/loader/FrameLoader.h

    r106492 r109480  
    120120    void open(CachedFrameBase&);
    121121    void loadItem(HistoryItem*, FrameLoadType);
     122    HistoryItem* requestedHistoryItem() const { return m_requestedHistoryItem.get(); }
    122123
    123124    static void reportLocalLoadFailed(Frame*, const String& url);
     
    438439
    439440    KURL m_previousUrl;
     441    RefPtr<HistoryItem> m_requestedHistoryItem;
    440442};
    441443
  • trunk/Source/WebCore/loader/HistoryController.cpp

    r105574 r109480  
    201201    if (!itemToRestore)
    202202        return;
    203 
    204     LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), itemToRestore);
    205     doc->setStateForNewFormElements(itemToRestore->documentState());
     203    if (m_frame->loader()->requestedHistoryItem() == m_currentItem.get() && !m_frame->loader()->documentLoader()->isClientRedirect()) {
     204        LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tree()->uniqueName().string().utf8().data(), itemToRestore);
     205        doc->setStateForNewFormElements(itemToRestore->documentState());
     206    }
    206207}
    207208
Note: See TracChangeset for help on using the changeset viewer.