Changeset 20878 in webkit


Ignore:
Timestamp:
Apr 13, 2007 1:28:27 PM (17 years ago)
Author:
beidson
Message:

LayoutTests:

Reviewed by Geoose

<rdar://problem/4664154> and http://bugs.webkit.org/show_bug.cgi?id=3546

Layout test that covers opening an empty new window, then starting to navigate around in it

  • history/new-window-redirect-history-expected.txt: Added.
  • history/new-window-redirect-history.html: Added.
  • history/resources/redirect-1.html: Added.
  • history/resources/redirect-2.html: Added.

WebCore:

Reviewed by Black Sheep

<rdar://problem/4664154> and http://bugs.webkit.org/show_bug.cgi?id=3546

When you click on a link that opens in a new window from within gmail, they first create a new window
with an empty URL, then immediately document.write() into the window to schedule a redirect.

Since the initial page doesn't have a URL associated with it, a history item never gets created. The
reasonable solution? To actually create the history item after the redirect (in updateHistoryForInternalLoad)

  • loader/FrameLoader.cpp: (WebCore::FrameLoader::addHistoryForCurrentLocation): Updates global and B/F history with a new history item (WebCore::FrameLoader::updateHistoryForStandardLoad): Call addHistoryForCurrentLocation (WebCore::FrameLoader::updateHistoryForInternalLoad): Call addHistoryForCurrentLocation if there is not already a current history item
  • loader/FrameLoader.h:
Location:
trunk
Files:
6 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r20876 r20878  
     12007-04-12  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Geoose
     4
     5        <rdar://problem/4664154> and http://bugs.webkit.org/show_bug.cgi?id=3546
     6
     7        Layout test that covers opening an empty new window, then starting to navigate around in it
     8
     9        * history/new-window-redirect-history-expected.txt: Added.
     10        * history/new-window-redirect-history.html: Added.
     11        * history/resources/redirect-1.html: Added.
     12        * history/resources/redirect-2.html: Added.
     13
    1142007-04-13  Anders Carlsson  <andersca@apple.com>
    215
  • trunk/WebCore/ChangeLog

    r20868 r20878  
     12007-04-12  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Black Sheep
     4
     5        <rdar://problem/4664154> and http://bugs.webkit.org/show_bug.cgi?id=3546
     6
     7        When you click on a link that opens in a new window from within gmail, they first create a new window
     8        with an empty URL, then immediately document.write() into the window to schedule a redirect.
     9
     10        Since the initial page doesn't have a URL associated with it, a history item never gets created.  The
     11        reasonable solution?  To actually create the history item after the redirect (in updateHistoryForInternalLoad)
     12
     13        * loader/FrameLoader.cpp:
     14        (WebCore::FrameLoader::addHistoryForCurrentLocation): Updates global and B/F history with a new history item
     15        (WebCore::FrameLoader::updateHistoryForStandardLoad): Call addHistoryForCurrentLocation
     16        (WebCore::FrameLoader::updateHistoryForInternalLoad): Call addHistoryForCurrentLocation if there is not already
     17          a current history item
     18        * loader/FrameLoader.h:
     19
    1202007-04-12  Oliver Hunt  <oliver@apple.com>
    221
  • trunk/WebCore/loader/FrameLoader.cpp

    r20856 r20878  
    39553955}
    39563956
     3957void FrameLoader::addHistoryForCurrentLocation()
     3958{
     3959    if (!privateBrowsingEnabled()) {
     3960        // FIXME: <rdar://problem/4880065> - This will be a hook into the WebCore global history, and this loader/client call will be removed
     3961        updateGlobalHistoryForStandardLoad(documentLoader()->urlForHistory());
     3962    }
     3963    addBackForwardItemClippedAtTarget(true);
     3964}
     3965
    39573966void FrameLoader::updateHistoryForStandardLoad()
    39583967{
     
    39603969
    39613970    if (!documentLoader()->isClientRedirect()) {
    3962         KURL url = documentLoader()->urlForHistory();
    3963         if (!url.isEmpty()) {
    3964             if (!privateBrowsingEnabled()) {
    3965                 // FIXME: <rdar://problem/4880065> - This will be a hook into the WebCore global history, and this loader/client call will be removed
    3966                 updateGlobalHistoryForStandardLoad(url);
    3967             }
    3968             addBackForwardItemClippedAtTarget(true);
    3969         }
     3971        if (!documentLoader()->urlForHistory().isEmpty())
     3972            addHistoryForCurrentLocation();
    39703973    } else if (documentLoader()->unreachableURL().isEmpty() && m_currentHistoryItem) {
    39713974        m_currentHistoryItem->setURL(documentLoader()->URL());
     
    40314034   
    40324035    if (documentLoader()->isClientRedirect()) {
    4033         if (m_currentHistoryItem) {
    4034             m_currentHistoryItem->setURL(documentLoader()->URL());
    4035             m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request());
    4036         }
     4036        if (!m_currentHistoryItem)
     4037            addHistoryForCurrentLocation();
     4038           
     4039        m_currentHistoryItem->setURL(documentLoader()->URL());
     4040        m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request());
    40374041    } else {
    40384042        // Add an item to the item tree for this frame
  • trunk/WebCore/loader/FrameLoader.h

    r20837 r20878  
    430430        bool childFramesMatchItem(HistoryItem*) const;
    431431
     432        void addHistoryForCurrentLocation();
    432433        void updateHistoryForBackForwardNavigation();
    433434        void updateHistoryForReload();
Note: See TracChangeset for help on using the changeset viewer.