Changeset 25410 in webkit


Ignore:
Timestamp:
Sep 6, 2007 8:48:39 PM (17 years ago)
Author:
tristan
Message:

WebCore:

Reviewed by Maciej Stachowiak.


<rdar://problem/5333496> Back button stopped working on sfgate.com (14957)


This fix is specifically targted to address sfgate.com and reuters.com with minimal
impact to other areas of the frameloader. It does not cause any regression tests to fail.
I've added two layout tests: One to detect this particular bug, and one to address
a secondary issue: if an iframe navigation occurs during onload by a timeout an
additional history item is added, similarly to firefox. We tried to match firefox
more than IE with this fix but did gain a little bit of IE compatability.

Tests: http/tests/navigation/onload-navigation-iframe-timeout.html

http/tests/navigation/onload-navigation-iframe.html

  • dom/Document.h: (WebCore::Document::processingLoadEvent): Return the m_processingLoadEvent boolean so FrameLoader knows that the document is in the middle of calling <body onload>


  • html/HTMLFrameOwnerElement.cpp: (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement):
  • html/HTMLFrameOwnerElement.h: (WebCore::HTMLFrameOwnerElement::createdByParser): (WebCore::HTMLFrameOwnerElement::setCreatedByParser): Added support for a new member variable of frame elements: m_createdByParser. This lets us specifically target the fix to only iframes created via JS and not in-document.


  • loader/FrameLoader.cpp: (WebCore::FrameLoader::FrameLoader): Initialize m_navigationDuringLoad to false


(WebCore::FrameLoader::provisionalLoadStarted):
Determine if the load we're about to start is occuring during
an onload.


(WebCore::FrameLoader::updateHistoryForStandardLoad):
If the current frameloader is for a child frame, and the navigation is occuring
during an onload update the current history item rather than adding a new one.


  • loader/FrameLoader.h: Added a new member variable, m_navigationDuringLoad to track the navigation status during the on load, rather than trying to determine the status after (which is nearly impossible due to a new runloop spin).

LayoutTests:

Reviewed by Maciej Stachowiak.

  • http/tests/navigation/onload-navigation-iframe-expected.txt: Added.
  • http/tests/navigation/onload-navigation-iframe-timeout-expected.txt: Added.
  • http/tests/navigation/onload-navigation-iframe-timeout.html: Added.
  • http/tests/navigation/onload-navigation-iframe.html: Added.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r25408 r25410  
     12007-09-06  Tristan O'Tierney  <tristan@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4
     5        * http/tests/navigation/onload-navigation-iframe-expected.txt: Added.
     6        * http/tests/navigation/onload-navigation-iframe-timeout-expected.txt: Added.
     7        * http/tests/navigation/onload-navigation-iframe-timeout.html: Added.
     8        * http/tests/navigation/onload-navigation-iframe.html: Added.
     9
    1102007-09-06  Sam Weinig  <sam@webkit.org>
    211
  • trunk/WebCore/ChangeLog

    r25405 r25410  
     12007-09-06  Tristan O'Tierney  <tristan@apple.com>
     2
     3        Reviewed by Maciej Stachowiak.
     4       
     5        <rdar://problem/5333496> Back button stopped working on sfgate.com (14957)
     6       
     7        This fix is specifically targted to address sfgate.com and reuters.com with minimal
     8        impact to other areas of the frameloader.  It does not cause any regression tests to fail.
     9        I've added two layout tests: One to detect this particular bug, and one to address
     10        a secondary issue: if an iframe navigation occurs during onload by a timeout an
     11        additional history item is added, similarly to firefox.  We tried to match firefox
     12        more than IE with this fix but did gain a little bit of IE compatability.
     13
     14        Tests: http/tests/navigation/onload-navigation-iframe-timeout.html
     15               http/tests/navigation/onload-navigation-iframe.html
     16
     17        * dom/Document.h:
     18        (WebCore::Document::processingLoadEvent):
     19        Return the m_processingLoadEvent boolean so FrameLoader knows
     20        that the document is in the middle of calling <body onload>
     21       
     22        * html/HTMLFrameOwnerElement.cpp:
     23        (WebCore::HTMLFrameOwnerElement::HTMLFrameOwnerElement):
     24        * html/HTMLFrameOwnerElement.h:
     25        (WebCore::HTMLFrameOwnerElement::createdByParser):
     26        (WebCore::HTMLFrameOwnerElement::setCreatedByParser):
     27        Added support for a new member variable of frame elements: m_createdByParser.
     28        This lets us specifically target the fix to only iframes created via JS
     29        and not in-document.
     30       
     31        * loader/FrameLoader.cpp:
     32        (WebCore::FrameLoader::FrameLoader):
     33        Initialize m_navigationDuringLoad to false
     34       
     35        (WebCore::FrameLoader::provisionalLoadStarted):
     36        Determine if the load we're about to start is occuring during
     37        an onload.
     38       
     39        (WebCore::FrameLoader::updateHistoryForStandardLoad):
     40        If the current frameloader is for a child frame, and the navigation is occuring
     41        during an onload update the current history item rather than adding a new one.
     42       
     43        * loader/FrameLoader.h:
     44        Added a new member variable, m_navigationDuringLoad to track
     45        the navigation status during the on load, rather than trying to determine
     46        the status after (which is nearly impossible due to a new runloop spin).
     47
    1482007-09-06  David Kilzer  <ddkilzer@apple.com>
    249
  • trunk/WebCore/dom/Document.h

    r25308 r25410  
    838838    void initSecurityPolicyURL();
    839839    const KURL& securityPolicyURL() const { return m_securityPolicyURL; }
     840   
     841    bool processingLoadEvent() const { return m_processingLoadEvent; }
    840842
    841843protected:
  • trunk/WebCore/html/HTMLFrameOwnerElement.cpp

    r24362 r25410  
    3030    : HTMLElement(tagName, document)
    3131    , m_contentFrame(0)
     32    , m_createdByParser(false)
    3233{
    3334}
  • trunk/WebCore/html/HTMLFrameOwnerElement.h

    r24362 r25410  
    4343    virtual bool isFrameOwnerElement() const { return true; }
    4444    virtual bool isKeyboardFocusable(KeyboardEvent*) const { return m_contentFrame; }
     45   
     46    bool createdByParser() const { return m_createdByParser; }
     47    void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
    4548
    4649private:
    4750    friend class Frame;
    4851    Frame* m_contentFrame;
     52    bool m_createdByParser;
    4953};
    5054
  • trunk/WebCore/loader/FrameLoader.cpp

    r25397 r25410  
    218218    , m_sentRedirectNotification(false)
    219219    , m_inStopAllLoaders(false)
     220    , m_navigationDuringLoad(false)
    220221    , m_cachePolicy(CachePolicyVerify)
    221222    , m_isExecutingJavaScriptFormAction(false)
     
    16031604void FrameLoader::provisionalLoadStarted()
    16041605{
     1606    Page* page = m_frame->page();
     1607   
     1608    // this is used to update the current history item
     1609    // in the event of a navigation aytime during loading
     1610    m_navigationDuringLoad = false;
     1611    if (page) {
     1612        Document *document = page->mainFrame()->document();
     1613        m_navigationDuringLoad = !page->mainFrame()->loader()->isComplete() || (document && document->processingLoadEvent());
     1614    }
     1615   
    16051616    m_firstLayoutDone = false;
    16061617    cancelRedirection(true);
     
    41154126{
    41164127    LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", documentLoader()->URL().url().ascii());
    4117 
    4118     if (!documentLoader()->isClientRedirect()) {
    4119         if (!documentLoader()->urlForHistory().isEmpty())
     4128   
     4129    bool frameNavigationOnLoad = false;
     4130   
     4131    // if the navigation occured during on load and this is a subframe
     4132    // update the current history item rather than adding a new one
     4133    // <rdar://problem/5333496>
     4134    if (m_navigationDuringLoad) {
     4135        HTMLFrameOwnerElement* owner = m_frame->ownerElement();
     4136        frameNavigationOnLoad = owner && !owner->createdByParser();
     4137    }
     4138   
     4139    if (!frameNavigationOnLoad && !documentLoader()->isClientRedirect()) {
     4140        if (!documentLoader()->urlForHistory().isEmpty())
    41204141            addHistoryForCurrentLocation();
    41214142    } else if (documentLoader()->unreachableURL().isEmpty() && m_currentHistoryItem) {
     
    41234144        m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request());
    41244145    }
     4146   
     4147    // reset navigation during on load since we no longer
     4148    // need it past thsi point
     4149    m_navigationDuringLoad = false;
    41254150}
    41264151
  • trunk/WebCore/loader/FrameLoader.h

    r25270 r25410  
    585585        bool m_sentRedirectNotification;
    586586        bool m_inStopAllLoaders;
     587        bool m_navigationDuringLoad;
    587588
    588589        String m_outgoingReferrer;
Note: See TracChangeset for help on using the changeset viewer.