Changeset 60608 in webkit


Ignore:
Timestamp:
Jun 2, 2010 10:38:18 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-06-02 Darin Fisher <darin@chromium.org>

Reviewed by Brady Eidson.

location.href and outgoing referrer not updated properly by
pushState/replaceState
https://bugs.webkit.org/show_bug.cgi?id=40027

  • fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html: Updated this test to account for location being modified by replaceState.
  • fast/loader/stateobjects/pushstate-updates-location-expected.txt: Added.
  • fast/loader/stateobjects/pushstate-updates-location.html: Added.
  • fast/loader/stateobjects/replacestate-updates-location-expected.txt: Added.
  • fast/loader/stateobjects/replacestate-updates-location.html: Added.
  • http/tests/navigation/pushstate-updates-referrer-expected.txt: Added.
  • http/tests/navigation/pushstate-updates-referrer.html: Added.
  • http/tests/navigation/replacestate-updates-referrer-expected.txt: Added.
  • http/tests/navigation/replacestate-updates-referrer.html: Added.
  • http/tests/navigation/resources/check-referrer.html: Added.

2010-06-02 Darin Fisher <darin@chromium.org>

Reviewed by Brady Eidson.

location.href and outgoing referrer not updated properly by
pushState/replaceState
https://bugs.webkit.org/show_bug.cgi?id=40027

Tests: fast/loader/stateobjects/pushstate-updates-location.html

fast/loader/stateobjects/replacestate-updates-location.html
http/tests/navigation/pushstate-updates-referrer.html
http/tests/navigation/replacestate-updates-referrer.html

  • dom/Document.cpp: (WebCore::Document::updateURLForPushOrReplaceState): Update the FrameLoader's notion of the current URL as well!
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::loadInSameDocument): Use the 'url' parameter instead of m_URL since m_URL might have changed during the handling of the PopState event. Eventually, this will become irrelevant since the PopState event should be dispatched asynchronously, but just in case we patch HashChange to be asynchronous before PopState, this change would be needed.
Location:
trunk
Files:
9 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r60600 r60608  
     12010-06-02  Darin Fisher  <darin@chromium.org>
     2
     3        Reviewed by Brady Eidson.
     4
     5        location.href and outgoing referrer not updated properly by
     6        pushState/replaceState
     7        https://bugs.webkit.org/show_bug.cgi?id=40027
     8
     9        * fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html:
     10        Updated this test to account for location being modified by replaceState.
     11
     12        * fast/loader/stateobjects/pushstate-updates-location-expected.txt: Added.
     13        * fast/loader/stateobjects/pushstate-updates-location.html: Added.
     14        * fast/loader/stateobjects/replacestate-updates-location-expected.txt: Added.
     15        * fast/loader/stateobjects/replacestate-updates-location.html: Added.
     16        * http/tests/navigation/pushstate-updates-referrer-expected.txt: Added.
     17        * http/tests/navigation/pushstate-updates-referrer.html: Added.
     18        * http/tests/navigation/replacestate-updates-referrer-expected.txt: Added.
     19        * http/tests/navigation/replacestate-updates-referrer.html: Added.
     20        * http/tests/navigation/resources/check-referrer.html: Added.
     21
    1222010-06-02  Kent Tamura  <tkent@chromium.org>
    223
  • trunk/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html

    r53672 r60608  
    4747{
    4848    alert("State popped - " + event.state + " (type " + typeof event.state + ")");
    49     if (event.state == "FirstEntry") {
    50         history.replaceState("FirstEntryWillLaterBeReactivated", null, "#FirstEntryWillLaterBeReactivated");
    51         setTimeout("history.forward();", 0);
    52     } else if (event.state == "SecondEntry") {
    53         history.replaceState("SecondEntryWillLaterBeReactivated", null, "#SecondEntryWillLaterBeReactivated");
    54         window.location = "resources/navigate-back.html";
    55     } else if (event.state == "SecondEntryWillLaterBeReactivated")
    56         history.back();
     49
     50    // FIXME: Once the popstate and hashchange events fire asynchronously, we
     51    // can eliminate this setTimeout hack.  The hashchange event currently runs
     52    // synchronously following the popstate event, but the calls to
     53    // replaceState cause the location to change immediately.  That confuses
     54    // our hashchange handler, which expects to see the "old" value of the
     55    // location.
     56
     57    var state = event.state;
     58    setTimeout(function() {
     59        if (state == "FirstEntry") {
     60            history.replaceState("FirstEntryWillLaterBeReactivated", null, "#FirstEntryWillLaterBeReactivated");
     61            history.forward();
     62        } else if (state == "SecondEntry") {
     63            history.replaceState("SecondEntryWillLaterBeReactivated", null, "#SecondEntryWillLaterBeReactivated");
     64            window.location = "resources/navigate-back.html";
     65        } else if (state == "SecondEntryWillLaterBeReactivated")
     66            history.back();
     67    }, 0);
    5768}
    5869
     
    6071{
    6172    alert("hashChanged - Last path component of location is " + lastPathComponent());
    62    if (window.location.hash == "#FirstEntryWillLaterBeReactivated") {
     73    if (window.location.hash == "#FirstEntryWillLaterBeReactivated") {
    6374        alert("Test complete");
    6475        sessionStorage.clear();
  • trunk/WebCore/ChangeLog

    r60606 r60608  
     12010-06-02  Darin Fisher  <darin@chromium.org>
     2
     3        Reviewed by Brady Eidson.
     4
     5        location.href and outgoing referrer not updated properly by
     6        pushState/replaceState
     7        https://bugs.webkit.org/show_bug.cgi?id=40027
     8
     9        Tests: fast/loader/stateobjects/pushstate-updates-location.html
     10               fast/loader/stateobjects/replacestate-updates-location.html
     11               http/tests/navigation/pushstate-updates-referrer.html
     12               http/tests/navigation/replacestate-updates-referrer.html
     13
     14        * dom/Document.cpp:
     15        (WebCore::Document::updateURLForPushOrReplaceState):
     16        Update the FrameLoader's notion of the current URL as well!
     17
     18        * loader/FrameLoader.cpp:
     19        (WebCore::FrameLoader::loadInSameDocument):
     20        Use the 'url' parameter instead of m_URL since m_URL might have
     21        changed during the handling of the PopState event.  Eventually,
     22        this will become irrelevant since the PopState event should be
     23        dispatched asynchronously, but just in case we patch HashChange
     24        to be asynchronous before PopState, this change would be needed.
     25
    1262010-06-02  Eric Seidel  <eric@webkit.org>
    227
  • trunk/WebCore/dom/Document.cpp

    r60418 r60608  
    46574657        return;
    46584658
     4659    // FIXME: Eliminate this redundancy.
    46594660    setURL(url);
     4661    f->loader()->setURL(url);
    46604662    f->loader()->documentLoader()->replaceRequestURLForSameDocumentNavigation(url);
    46614663}
  • trunk/WebCore/loader/FrameLoader.cpp

    r60441 r60608  
    16941694   
    16951695    if (hashChange) {
    1696         m_frame->document()->enqueueHashchangeEvent(oldURL, m_URL);
     1696        m_frame->document()->enqueueHashchangeEvent(oldURL, url);
    16971697        m_client->dispatchDidChangeLocationWithinPage();
    16981698    }
Note: See TracChangeset for help on using the changeset viewer.