Changeset 53869 in webkit


Ignore:
Timestamp:
Jan 26, 2010 2:59:44 PM (14 years ago)
Author:
Adam Roben
Message:

2010-01-26 Adam Roben <Adam Roben>

No review, rolling out r53861.
http://trac.webkit.org/changeset/53861
https://bugs.webkit.org/show_bug.cgi?id=33224

Caused 2 regression tests to fail.

  • fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt:
  • fast/loader/stateobjects/document-destroyed-navigate-back.html:

2010-01-26 Adam Roben <Adam Roben>

No review, rolling out r53861.
http://trac.webkit.org/changeset/53861
https://bugs.webkit.org/show_bug.cgi?id=33224

Caused 2 regression tests to fail.

  • dom/Document.cpp: (WebCore::Document::detach): (WebCore::Document::registerHistoryItem): (WebCore::Document::unregisterHistoryItem):
  • dom/Document.h:
  • history/BackForwardList.cpp: (WebCore::BackForwardList::pushStateItem):
  • history/BackForwardListChromium.cpp: (WebCore::BackForwardList::pushStateItem):
  • history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem): (WebCore::HistoryItem::~HistoryItem): (WebCore::HistoryItem::setStateObject): (WebCore::HistoryItem::setDocument): (WebCore::HistoryItem::documentDetached):
  • history/HistoryItem.h: (WebCore::HistoryItem::document):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::navigateWithinDocument): (WebCore::FrameLoader::loadItem):
  • loader/HistoryController.cpp: (WebCore::HistoryController::updateBackForwardListForFragmentScroll): (WebCore::HistoryController::pushState): (WebCore::HistoryController::replaceState):
  • loader/RedirectScheduler.cpp: (WebCore::RedirectScheduler::scheduleHistoryNavigation):
  • page/History.cpp: (WebCore::History::stateObjectAdded):
  • page/Page.cpp: (WebCore::Page::goToItem):
Location:
trunk
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53868 r53869  
     12010-01-26  Adam Roben  <aroben@apple.com>
     2
     3        No review, rolling out r53861.
     4        http://trac.webkit.org/changeset/53861
     5        https://bugs.webkit.org/show_bug.cgi?id=33224
     6
     7        Caused 2 regression tests to fail.
     8
     9        * fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt:
     10        * fast/loader/stateobjects/document-destroyed-navigate-back.html:
     11
    1122010-01-26  Dan Bernstein  <mitz@apple.com>
    213
  • trunk/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt

    r53861 r53869  
    66ALERT: Last path component of location is document-destroyed-navigate-back.html?SecondEntryWillLaterBeReactivated
    77ALERT: State popped - SecondEntryWillLaterBeReactivated (type string)
     8main frame - has 1 onunload handler(s)
     9ALERT: Last path component of location is document-destroyed-navigate-back.html?FirstEntryWillLaterBeReactivated
    810ALERT: State popped - FirstEntryWillLaterBeReactivated (type string)
    911ALERT: Test complete
  • trunk/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html

    r53861 r53869  
    2525{
    2626    alert("Last path component of location is " + lastPathComponent());
     27    history.back();
    2728}
    2829
  • trunk/WebCore/ChangeLog

    r53868 r53869  
     12010-01-26  Adam Roben  <aroben@apple.com>
     2
     3        No review, rolling out r53861.
     4        http://trac.webkit.org/changeset/53861
     5        https://bugs.webkit.org/show_bug.cgi?id=33224
     6
     7        Caused 2 regression tests to fail.
     8
     9        * dom/Document.cpp:
     10        (WebCore::Document::detach):
     11        (WebCore::Document::registerHistoryItem):
     12        (WebCore::Document::unregisterHistoryItem):
     13        * dom/Document.h:
     14        * history/BackForwardList.cpp:
     15        (WebCore::BackForwardList::pushStateItem):
     16        * history/BackForwardListChromium.cpp:
     17        (WebCore::BackForwardList::pushStateItem):
     18        * history/HistoryItem.cpp:
     19        (WebCore::HistoryItem::HistoryItem):
     20        (WebCore::HistoryItem::~HistoryItem):
     21        (WebCore::HistoryItem::setStateObject):
     22        (WebCore::HistoryItem::setDocument):
     23        (WebCore::HistoryItem::documentDetached):
     24        * history/HistoryItem.h:
     25        (WebCore::HistoryItem::document):
     26        * loader/FrameLoader.cpp:
     27        (WebCore::FrameLoader::navigateWithinDocument):
     28        (WebCore::FrameLoader::loadItem):
     29        * loader/HistoryController.cpp:
     30        (WebCore::HistoryController::updateBackForwardListForFragmentScroll):
     31        (WebCore::HistoryController::pushState):
     32        (WebCore::HistoryController::replaceState):
     33        * loader/RedirectScheduler.cpp:
     34        (WebCore::RedirectScheduler::scheduleHistoryNavigation):
     35        * page/History.cpp:
     36        (WebCore::History::stateObjectAdded):
     37        * page/Page.cpp:
     38        (WebCore::Page::goToItem):
     39
    1402010-01-26  Dan Bernstein  <mitz@apple.com>
    241
  • trunk/WebCore/dom/Document.cpp

    r53861 r53869  
    15491549        render->destroy();
    15501550   
     1551    HashSet<RefPtr<HistoryItem> > associatedHistoryItems;
     1552    associatedHistoryItems.swap(m_associatedHistoryItems);
     1553    HashSet<RefPtr<HistoryItem> >::iterator end = associatedHistoryItems.end();
     1554    for (HashSet<RefPtr<HistoryItem> >::iterator i = associatedHistoryItems.begin(); i != end; ++i)
     1555        (*i)->documentDetached(this);
     1556   
    15511557    // This is required, as our Frame might delete itself as soon as it detaches
    15521558    // us. However, this violates Node::detach() semantics, as it's never
     
    44894495}
    44904496
     4497void Document::registerHistoryItem(HistoryItem* item)
     4498{
     4499    ASSERT(!m_associatedHistoryItems.contains(item));
     4500    m_associatedHistoryItems.add(item);
     4501}
     4502
     4503void Document::unregisterHistoryItem(HistoryItem* item)
     4504{
     4505    ASSERT(m_associatedHistoryItems.contains(item) || m_associatedHistoryItems.isEmpty());
     4506    m_associatedHistoryItems.remove(item);
     4507}
     4508
    44914509void Document::updateSandboxFlags()
    44924510{
  • trunk/WebCore/dom/Document.h

    r53861 r53869  
    908908    void updateURLForPushOrReplaceState(const KURL&);
    909909    void statePopped(SerializedScriptValue*);
     910    void registerHistoryItem(HistoryItem* item);
     911    void unregisterHistoryItem(HistoryItem* item);
    910912
    911913    void updateSandboxFlags(); // Set sandbox flags as determined by the frame.
  • trunk/WebCore/history/BackForwardList.cpp

    r53861 r53869  
    240240{
    241241    ASSERT(newItem);
     242    ASSERT(newItem->document());
    242243    ASSERT(newItem->stateObject());
    243244   
     
    245246    ASSERT(current);
    246247
     248    Document* newItemDocument = newItem->document();
     249
    247250    addItem(newItem);
    248251   
    249     if (!current->stateObject())
     252    if (!current->document()) {
     253        current->setDocument(newItemDocument);
    250254        current->setStateObject(SerializedScriptValue::create());
     255    }
    251256}
    252257
  • trunk/WebCore/history/BackForwardListChromium.cpp

    r53861 r53869  
    124124void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem)
    125125{
    126     RefPtr<HistoryItem> current = m_client->currentItem();
    127 
    128     addItem(newItem);
    129 
    130     if (!current->stateObject())
    131         current->setStateObject(SerializedScriptValue::create());
     126  // FIXME: Need to implement state support for chromium.
    132127}
    133128
  • trunk/WebCore/history/HistoryItem.cpp

    r53861 r53869  
    3434#include "ResourceRequest.h"
    3535#include <stdio.h>
    36 #include <wtf/CurrentTime.h>
    3736
    3837namespace WebCore {
    39 
    40 static long long generateDocumentSequenceNumber()
    41 {
    42     // Initialize to the current time to reduce the likelihood of generating
    43     // identifiers that overlap with those from past/future browser sessions.
    44     static long long next = static_cast<long long>(currentTime() * 1000000.0);
    45     return ++next;
    46 }
    4738
    4839static void defaultNotifyHistoryItemChanged(HistoryItem*)
     
    5849    , m_isTargetItem(false)
    5950    , m_visitCount(0)
    60     , m_documentSequenceNumber(generateDocumentSequenceNumber())
     51    , m_document(0)
    6152{
    6253}
     
    7162    , m_isTargetItem(false)
    7263    , m_visitCount(0)
    73     , m_documentSequenceNumber(generateDocumentSequenceNumber())
     64    , m_document(0)
    7465{   
    7566    iconDatabase()->retainIconForPageURL(m_urlString);
     
    8677    , m_isTargetItem(false)
    8778    , m_visitCount(0)
    88     , m_documentSequenceNumber(generateDocumentSequenceNumber())
     79    , m_document(0)
    8980{
    9081    iconDatabase()->retainIconForPageURL(m_urlString);
     
    10293    , m_isTargetItem(false)
    10394    , m_visitCount(0)
    104     , m_documentSequenceNumber(generateDocumentSequenceNumber())
     95    , m_document(0)
    10596{   
    10697    iconDatabase()->retainIconForPageURL(m_urlString);
     
    110101{
    111102    ASSERT(!m_cachedPage);
     103    ASSERT(!m_document);
    112104    iconDatabase()->releaseIconForPageURL(m_urlString);
    113105#if PLATFORM(ANDROID)
     
    134126    , m_dailyVisitCounts(item.m_dailyVisitCounts)
    135127    , m_weeklyVisitCounts(item.m_weeklyVisitCounts)
    136     , m_documentSequenceNumber(generateDocumentSequenceNumber())
     128    , m_document(0)
    137129    , m_formContentType(item.m_formContentType)
    138130{
     
    406398void HistoryItem::setStateObject(PassRefPtr<SerializedScriptValue> object)
    407399{
     400    ASSERT(m_document);
    408401    m_stateObject = object;
     402}
     403
     404void HistoryItem::setDocument(Document* document)
     405{
     406    if (m_document == document)
     407        return;
     408   
     409    if (m_document)
     410        m_document->unregisterHistoryItem(this);
     411    if (document)
     412        document->registerHistoryItem(this);
     413       
     414    m_document = document;
     415}
     416
     417void HistoryItem::documentDetached(Document* document)
     418{
     419    ASSERT_UNUSED(document, m_document == document);
     420    m_document = 0;
    409421}
    410422
  • trunk/WebCore/history/HistoryItem.h

    r53861 r53869  
    136136    void setStateObject(PassRefPtr<SerializedScriptValue> object);
    137137    SerializedScriptValue* stateObject() const { return m_stateObject.get(); }
    138 
    139     void setDocumentSequenceNumber(long long number) { m_documentSequenceNumber = number; }
    140     long long documentSequenceNumber() const { return m_documentSequenceNumber; }
     138    void setDocument(Document* document);
     139    Document* document() const { return m_document; }
     140    void documentDetached(Document*);
    141141   
    142142    void setFormInfoFromRequest(const ResourceRequest&);
     
    245245    // Support for HTML5 History
    246246    RefPtr<SerializedScriptValue> m_stateObject;
    247     long long m_documentSequenceNumber;
     247    Document* m_document;
    248248   
    249249    // info used to repost form data
  • trunk/WebCore/loader/FrameLoader.cpp

    r53861 r53869  
    36943694void FrameLoader::navigateWithinDocument(HistoryItem* item)
    36953695{
    3696     ASSERT(item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber());
     3696    ASSERT(!item->document() || item->document() == m_frame->document());
    36973697
    36983698    // Save user view state to the current history item here since we don't do a normal load.
     
    38153815    // - Navigating to an anchor within the page, with no form data stored on the target item or the current history entry,
    38163816    //   and the URLs in the frame tree match the history item for fragment scrolling.
    3817     bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber();
     3817    bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->document() == m_frame->document();
    38183818
    38193819#if ENABLE(WML)
  • trunk/WebCore/loader/HistoryController.cpp

    r53861 r53869  
    107107{
    108108    updateBackForwardListClippedAtTarget(false);
    109    
    110     // Since the document isn't changed as a result of a fragment scroll, we should
    111     // preserve the DocumentSequenceNumber of the previous item.
    112     m_currentItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber());
    113109}
    114110
     
    640636   
    641637    // Override data in the target item to reflect the pushState() arguments.
     638    item->setDocument(m_frame->document());
    642639    item->setTitle(title);
    643640    item->setStateObject(stateObject);
    644641    item->setURLString(urlString);
    645 
    646     // Since the document isn't changed as a result of a pushState call, we
    647     // should preserve the DocumentSequenceNumber of the previous item.
    648     item->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber());
    649642   
    650643    page->backForwardList()->pushStateItem(item.release());
     
    657650    HistoryItem* current = page->backForwardList()->currentItem();
    658651    ASSERT(current);
    659 
     652   
     653    ASSERT(!current->document() || current->document() == m_frame->document());
     654    current->setDocument(m_frame->document());
     655   
    660656    if (!urlString.isEmpty())
    661657        current->setURLString(urlString);
  • trunk/WebCore/loader/RedirectScheduler.cpp

    r53861 r53869  
    278278    // traversal (or both) and should be performed synchronously.
    279279    HistoryItem* currentEntry = m_frame->loader()->history()->currentItem();
    280     if (currentEntry != specifiedEntry && currentEntry->documentSequenceNumber() == specifiedEntry->documentSequenceNumber()) {
     280    if (currentEntry != specifiedEntry && specifiedEntry->document() && currentEntry->document() == specifiedEntry->document()) {
    281281        m_frame->loader()->history()->goToItem(specifiedEntry, FrameLoadTypeIndexedBackForward);
    282282        return;
  • trunk/WebCore/page/History.cpp

    r53861 r53869  
    113113        m_frame->loader()->history()->replaceState(data, title, fullURL.string());
    114114           
    115     if (!urlString.isEmpty())
     115    if (!urlString.isEmpty()) {
    116116        m_frame->document()->updateURLForPushOrReplaceState(fullURL);
    117 
    118     if (stateObjectType == StateObjectPush)
    119         m_frame->loader()->client()->dispatchDidPushStateWithinPage();
    120     else if (stateObjectType == StateObjectReplace)
    121         m_frame->loader()->client()->dispatchDidReplaceStateWithinPage();
     117        if (stateObjectType == StateObjectPush)
     118            m_frame->loader()->client()->dispatchDidPushStateWithinPage();
     119        else if (stateObjectType == StateObjectReplace)
     120            m_frame->loader()->client()->dispatchDidReplaceStateWithinPage();
     121    }
    122122}
    123123
  • trunk/WebCore/page/Page.cpp

    r53861 r53869  
    291291{
    292292    // Abort any current load unless we're navigating the current document to a new state object
    293     if (!item->stateObject() || item->documentSequenceNumber() != m_mainFrame->loader()->history()->currentItem()->documentSequenceNumber()) {
     293    if (!item->stateObject() || item->document() != m_mainFrame->document()) {
    294294        // Define what to do with any open database connections. By default we stop them and terminate the database thread.
    295295        DatabasePolicy databasePolicy = DatabasePolicyStop;
Note: See TracChangeset for help on using the changeset viewer.