[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

aroben at apple.com aroben at apple.com
Thu Feb 4 21:28:24 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit e1e00e6ba5adf25704375556554dfd8ccafb5832
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 26 22:59:44 2010 +0000

    2010-01-26  Adam Roben  <aroben at apple.com>
    
            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  <aroben at apple.com>
    
            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):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53869 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c26ad3f..4e8dea8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-01-26  Adam Roben  <aroben at apple.com>
+
+        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  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Beth Dakin.
diff --git a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt
index 0e8a11d..da3ae80 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt
@@ -5,6 +5,8 @@ ALERT: Navigating back...
 main frame - has 1 onunload handler(s)
 ALERT: Last path component of location is document-destroyed-navigate-back.html?SecondEntryWillLaterBeReactivated
 ALERT: State popped - SecondEntryWillLaterBeReactivated (type string)
+main frame - has 1 onunload handler(s)
+ALERT: Last path component of location is document-destroyed-navigate-back.html?FirstEntryWillLaterBeReactivated
 ALERT: State popped - FirstEntryWillLaterBeReactivated (type string)
 ALERT: Test complete
 This test:
diff --git a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
index 7dca361..8e6a644 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
@@ -24,6 +24,7 @@ function runFirstStageOfTest()
 function runSecondStageOfTest()
 {
     alert("Last path component of location is " + lastPathComponent());
+    history.back();
 }
 
 function runThirdStageOfTest()
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 7b41a56..db61ab1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2010-01-26  Adam Roben  <aroben at apple.com>
+
+        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):
+
 2010-01-26  Dan Bernstein  <mitz at apple.com>
 
         Reviewed by Beth Dakin.
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 272f1a0..af456b4 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -1548,6 +1548,12 @@ void Document::detach()
     if (render)
         render->destroy();
     
+    HashSet<RefPtr<HistoryItem> > associatedHistoryItems;
+    associatedHistoryItems.swap(m_associatedHistoryItems);
+    HashSet<RefPtr<HistoryItem> >::iterator end = associatedHistoryItems.end();
+    for (HashSet<RefPtr<HistoryItem> >::iterator i = associatedHistoryItems.begin(); i != end; ++i)
+        (*i)->documentDetached(this);
+    
     // This is required, as our Frame might delete itself as soon as it detaches
     // us. However, this violates Node::detach() semantics, as it's never
     // possible to re-attach. Eventually Document::detach() should be renamed,
@@ -4488,6 +4494,18 @@ void Document::statePopped(SerializedScriptValue* stateObject)
         m_pendingStateObject = stateObject;
 }
 
+void Document::registerHistoryItem(HistoryItem* item)
+{
+    ASSERT(!m_associatedHistoryItems.contains(item));
+    m_associatedHistoryItems.add(item);
+}
+
+void Document::unregisterHistoryItem(HistoryItem* item)
+{
+    ASSERT(m_associatedHistoryItems.contains(item) || m_associatedHistoryItems.isEmpty());
+    m_associatedHistoryItems.remove(item);
+}
+
 void Document::updateSandboxFlags()
 {
     if (m_frame && securityOrigin())
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 909f961..265b351 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -907,6 +907,8 @@ public:
 
     void updateURLForPushOrReplaceState(const KURL&);
     void statePopped(SerializedScriptValue*);
+    void registerHistoryItem(HistoryItem* item);
+    void unregisterHistoryItem(HistoryItem* item);
 
     void updateSandboxFlags(); // Set sandbox flags as determined by the frame.
 
diff --git a/WebCore/history/BackForwardList.cpp b/WebCore/history/BackForwardList.cpp
index 721d949..56e1b2e 100644
--- a/WebCore/history/BackForwardList.cpp
+++ b/WebCore/history/BackForwardList.cpp
@@ -239,15 +239,20 @@ HistoryItemVector& BackForwardList::entries()
 void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem)
 {
     ASSERT(newItem);
+    ASSERT(newItem->document());
     ASSERT(newItem->stateObject());
     
     RefPtr<HistoryItem> current = currentItem();
     ASSERT(current);
 
+    Document* newItemDocument = newItem->document();
+
     addItem(newItem);
     
-    if (!current->stateObject())
+    if (!current->document()) {
+        current->setDocument(newItemDocument);
         current->setStateObject(SerializedScriptValue::create());
+    }
 }
 
 void BackForwardList::close()
diff --git a/WebCore/history/BackForwardListChromium.cpp b/WebCore/history/BackForwardListChromium.cpp
index a780b7d..f539e80 100644
--- a/WebCore/history/BackForwardListChromium.cpp
+++ b/WebCore/history/BackForwardListChromium.cpp
@@ -123,12 +123,7 @@ HistoryItem* BackForwardList::itemAtIndex(int index)
 
 void BackForwardList::pushStateItem(PassRefPtr<HistoryItem> newItem)
 {
-    RefPtr<HistoryItem> current = m_client->currentItem();
-
-    addItem(newItem);
-
-    if (!current->stateObject())
-        current->setStateObject(SerializedScriptValue::create());
+  // FIXME: Need to implement state support for chromium.
 }
 
 HistoryItemVector& BackForwardList::entries()
diff --git a/WebCore/history/HistoryItem.cpp b/WebCore/history/HistoryItem.cpp
index d641d4e..4c9eabe 100644
--- a/WebCore/history/HistoryItem.cpp
+++ b/WebCore/history/HistoryItem.cpp
@@ -33,18 +33,9 @@
 #include "PageCache.h"
 #include "ResourceRequest.h"
 #include <stdio.h>
-#include <wtf/CurrentTime.h>
 
 namespace WebCore {
 
-static long long generateDocumentSequenceNumber()
-{
-    // Initialize to the current time to reduce the likelihood of generating
-    // identifiers that overlap with those from past/future browser sessions.
-    static long long next = static_cast<long long>(currentTime() * 1000000.0);
-    return ++next;
-}
-
 static void defaultNotifyHistoryItemChanged(HistoryItem*)
 {
 }
@@ -57,7 +48,7 @@ HistoryItem::HistoryItem()
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
     , m_visitCount(0)
-    , m_documentSequenceNumber(generateDocumentSequenceNumber())
+    , m_document(0)
 {
 }
 
@@ -70,7 +61,7 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, double ti
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
     , m_visitCount(0)
-    , m_documentSequenceNumber(generateDocumentSequenceNumber())
+    , m_document(0)
 {    
     iconDatabase()->retainIconForPageURL(m_urlString);
 }
@@ -85,7 +76,7 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, const Str
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
     , m_visitCount(0)
-    , m_documentSequenceNumber(generateDocumentSequenceNumber())
+    , m_document(0)
 {
     iconDatabase()->retainIconForPageURL(m_urlString);
 }
@@ -101,7 +92,7 @@ HistoryItem::HistoryItem(const KURL& url, const String& target, const String& pa
     , m_lastVisitWasFailure(false)
     , m_isTargetItem(false)
     , m_visitCount(0)
-    , m_documentSequenceNumber(generateDocumentSequenceNumber())
+    , m_document(0)
 {    
     iconDatabase()->retainIconForPageURL(m_urlString);
 }
@@ -109,6 +100,7 @@ HistoryItem::HistoryItem(const KURL& url, const String& target, const String& pa
 HistoryItem::~HistoryItem()
 {
     ASSERT(!m_cachedPage);
+    ASSERT(!m_document);
     iconDatabase()->releaseIconForPageURL(m_urlString);
 #if PLATFORM(ANDROID)
     if (m_bridge)
@@ -133,7 +125,7 @@ inline HistoryItem::HistoryItem(const HistoryItem& item)
     , m_visitCount(item.m_visitCount)
     , m_dailyVisitCounts(item.m_dailyVisitCounts)
     , m_weeklyVisitCounts(item.m_weeklyVisitCounts)
-    , m_documentSequenceNumber(generateDocumentSequenceNumber())
+    , m_document(0)
     , m_formContentType(item.m_formContentType)
 {
     if (item.m_formData)
@@ -405,9 +397,29 @@ void HistoryItem::setIsTargetItem(bool flag)
 
 void HistoryItem::setStateObject(PassRefPtr<SerializedScriptValue> object)
 {
+    ASSERT(m_document);
     m_stateObject = object;
 }
 
+void HistoryItem::setDocument(Document* document)
+{
+    if (m_document == document)
+        return;
+    
+    if (m_document)
+        m_document->unregisterHistoryItem(this);
+    if (document)
+        document->registerHistoryItem(this);
+        
+    m_document = document;
+}
+
+void HistoryItem::documentDetached(Document* document)
+{
+    ASSERT_UNUSED(document, m_document == document);
+    m_document = 0;
+}
+
 void HistoryItem::addChildItem(PassRefPtr<HistoryItem> child)
 {
     ASSERT(!childItemWithTarget(child->target()));
diff --git a/WebCore/history/HistoryItem.h b/WebCore/history/HistoryItem.h
index ee8c0c8..4c91e76 100644
--- a/WebCore/history/HistoryItem.h
+++ b/WebCore/history/HistoryItem.h
@@ -135,9 +135,9 @@ public:
     
     void setStateObject(PassRefPtr<SerializedScriptValue> object);
     SerializedScriptValue* stateObject() const { return m_stateObject.get(); }
-
-    void setDocumentSequenceNumber(long long number) { m_documentSequenceNumber = number; }
-    long long documentSequenceNumber() const { return m_documentSequenceNumber; }
+    void setDocument(Document* document);
+    Document* document() const { return m_document; }
+    void documentDetached(Document*);
     
     void setFormInfoFromRequest(const ResourceRequest&);
     void setFormData(PassRefPtr<FormData>);
@@ -244,7 +244,7 @@ private:
 
     // Support for HTML5 History
     RefPtr<SerializedScriptValue> m_stateObject;
-    long long m_documentSequenceNumber;
+    Document* m_document;
     
     // info used to repost form data
     RefPtr<FormData> m_formData;
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 24fa19a..c5475e8 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -3693,7 +3693,7 @@ Frame* FrameLoader::findFrameForNavigation(const AtomicString& name)
 
 void FrameLoader::navigateWithinDocument(HistoryItem* item)
 {
-    ASSERT(item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber());
+    ASSERT(!item->document() || item->document() == m_frame->document());
 
     // Save user view state to the current history item here since we don't do a normal load.
     // FIXME: Does form state need to be saved here too?
@@ -3814,7 +3814,7 @@ void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType)
     // - The HistoryItem has a history state object
     // - Navigating to an anchor within the page, with no form data stored on the target item or the current history entry,
     //   and the URLs in the frame tree match the history item for fragment scrolling.
-    bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber();
+    bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->document() == m_frame->document();
 
 #if ENABLE(WML)
     // All WML decks should go through the real load mechanism, not the scroll-to-anchor code
diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp
index 43c9979..90bd60b 100644
--- a/WebCore/loader/HistoryController.cpp
+++ b/WebCore/loader/HistoryController.cpp
@@ -106,10 +106,6 @@ void HistoryController::restoreScrollPositionAndViewState()
 void HistoryController::updateBackForwardListForFragmentScroll()
 {
     updateBackForwardListClippedAtTarget(false);
-    
-    // Since the document isn't changed as a result of a fragment scroll, we should
-    // preserve the DocumentSequenceNumber of the previous item.
-    m_currentItem->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber());
 }
 
 void HistoryController::saveDocumentState()
@@ -639,13 +635,10 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject,
     ASSERT(item->isTargetItem());
     
     // Override data in the target item to reflect the pushState() arguments.
+    item->setDocument(m_frame->document());
     item->setTitle(title);
     item->setStateObject(stateObject);
     item->setURLString(urlString);
-
-    // Since the document isn't changed as a result of a pushState call, we
-    // should preserve the DocumentSequenceNumber of the previous item.
-    item->setDocumentSequenceNumber(m_previousItem->documentSequenceNumber());
     
     page->backForwardList()->pushStateItem(item.release());
 }
@@ -656,7 +649,10 @@ void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObje
     ASSERT(page);
     HistoryItem* current = page->backForwardList()->currentItem();
     ASSERT(current);
-
+    
+    ASSERT(!current->document() || current->document() == m_frame->document());
+    current->setDocument(m_frame->document());
+    
     if (!urlString.isEmpty())
         current->setURLString(urlString);
     current->setTitle(title);
diff --git a/WebCore/loader/RedirectScheduler.cpp b/WebCore/loader/RedirectScheduler.cpp
index 4b44422..04e9642 100644
--- a/WebCore/loader/RedirectScheduler.cpp
+++ b/WebCore/loader/RedirectScheduler.cpp
@@ -277,7 +277,7 @@ void RedirectScheduler::scheduleHistoryNavigation(int steps)
     // If the specified entry and the current entry have the same document, this is either a state object traversal or a fragment 
     // traversal (or both) and should be performed synchronously.
     HistoryItem* currentEntry = m_frame->loader()->history()->currentItem();
-    if (currentEntry != specifiedEntry && currentEntry->documentSequenceNumber() == specifiedEntry->documentSequenceNumber()) {
+    if (currentEntry != specifiedEntry && specifiedEntry->document() && currentEntry->document() == specifiedEntry->document()) {
         m_frame->loader()->history()->goToItem(specifiedEntry, FrameLoadTypeIndexedBackForward);
         return;
     }
diff --git a/WebCore/page/History.cpp b/WebCore/page/History.cpp
index 78e8ea6..f352bc9 100644
--- a/WebCore/page/History.cpp
+++ b/WebCore/page/History.cpp
@@ -112,13 +112,13 @@ void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const Str
     else if (stateObjectType == StateObjectReplace)
         m_frame->loader()->history()->replaceState(data, title, fullURL.string());
             
-    if (!urlString.isEmpty())
+    if (!urlString.isEmpty()) {
         m_frame->document()->updateURLForPushOrReplaceState(fullURL);
-
-    if (stateObjectType == StateObjectPush)
-        m_frame->loader()->client()->dispatchDidPushStateWithinPage();
-    else if (stateObjectType == StateObjectReplace)
-        m_frame->loader()->client()->dispatchDidReplaceStateWithinPage();
+        if (stateObjectType == StateObjectPush)
+            m_frame->loader()->client()->dispatchDidPushStateWithinPage();
+        else if (stateObjectType == StateObjectReplace)
+            m_frame->loader()->client()->dispatchDidReplaceStateWithinPage();
+    }
 }
 
 } // namespace WebCore
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 643da9d..dee120a 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -290,7 +290,7 @@ void Page::goBackOrForward(int distance)
 void Page::goToItem(HistoryItem* item, FrameLoadType type)
 {
     // Abort any current load unless we're navigating the current document to a new state object
-    if (!item->stateObject() || item->documentSequenceNumber() != m_mainFrame->loader()->history()->currentItem()->documentSequenceNumber()) {
+    if (!item->stateObject() || item->document() != m_mainFrame->document()) {
         // Define what to do with any open database connections. By default we stop them and terminate the database thread.
         DatabasePolicy databasePolicy = DatabasePolicyStop;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list