[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mihaip at chromium.org mihaip at chromium.org
Wed Dec 22 13:56:31 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 10c720c1e469754767a64c7173bc034f22e78814
Author: mihaip at chromium.org <mihaip at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 30 03:06:49 2010 +0000

    2010-09-29  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Darin Fisher.
    
            REGRESSION: page reload on back button after history.pushState with appearing/disappearing iframes
            https://bugs.webkit.org/show_bug.cgi?id=46324
    
            Add test which uses pushState to generate history entries while also
            changing the frames that are present in the document between history
            states. Add a similar test that uses fragment changes.
    
            * fast/history/same-document-iframes-changing-fragment-expected.txt: Added.
            * fast/history/same-document-iframes-changing-fragment.html: Added.
            * fast/history/same-document-iframes-changing-pushstate-expected.txt: Added.
            * fast/history/same-document-iframes-changing-pushstate.html: Added.
    2010-09-29  Mihai Parparita  <mihaip at chromium.org>
    
            Reviewed by Darin Fisher.
    
            REGRESSION: page reload on back button after history.pushState with appearing/disappearing iframes
            https://bugs.webkit.org/show_bug.cgi?id=46324
    
            Revert same document check to the way it was before r66238 for history
            entries created by pushState or fragment changes. Logic fror determining
            if same document navigation should be used is moved to HistoryItem.
    
            Tests: fast/history/same-document-iframes-changing-fragment.html
                   fast/history/same-document-iframes-changing-pushstate.html
    
            * history/HistoryItem.cpp:
            (WebCore::HistoryItem::shouldDoSameDocumentNavigationTo):
            (WebCore::HistoryItem::hasSameDocumentTree):
            (WebCore::HistoryItem::hasSameFrames):
            * history/HistoryItem.h:
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::loadItem):
    
            * loader/FrameLoader.cpp:
            (WebCore::FrameLoader::loadItem):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68742 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8653992..d5d41dd 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-29  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        REGRESSION: page reload on back button after history.pushState with appearing/disappearing iframes
+        https://bugs.webkit.org/show_bug.cgi?id=46324
+        
+        Add test which uses pushState to generate history entries while also 
+        changing the frames that are present in the document between history
+        states. Add a similar test that uses fragment changes.
+
+        * fast/history/same-document-iframes-changing-fragment-expected.txt: Added.
+        * fast/history/same-document-iframes-changing-fragment.html: Added.
+        * fast/history/same-document-iframes-changing-pushstate-expected.txt: Added.
+        * fast/history/same-document-iframes-changing-pushstate.html: Added.
+
 2010-09-29  Adam Barth  <abarth at webkit.org>
 
         This test result seems to be platform specific.
diff --git a/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt b/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt
new file mode 100755
index 0000000..7dafabe
--- /dev/null
+++ b/LayoutTests/fast/history/same-document-iframes-changing-fragment-expected.txt
@@ -0,0 +1,30 @@
+Tests that we trigger same-document navigation when history entries are generated via fragment changes, even if the frames present in the document change between history entries.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+popstate to state: null filename: same-document-iframes-changing-fragment.html
+removing iframe2
+navigating to #newState
+popstate to state: null filename: same-document-iframes-changing-fragment.html#newState
+going back
+popstate to state: null filename: same-document-iframes-changing-fragment.html
+going forward
+popstate to state: null filename: same-document-iframes-changing-fragment.html#newState
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: 'iframe1'
+--------
+iframe1
+
+============== Back Forward List ==============
+        (file test):fast/history/same-document-iframes-changing-fragment.html  **nav target**
+            data:text/plain,iframe1 (in frame "iframe1")
+            data:text/plain,iframe2 (in frame "iframe2")
+curr->  (file test):fast/history/same-document-iframes-changing-fragment.html#newState  **nav target**
+            data:text/plain,iframe1 (in frame "iframe1")
+===============================================
diff --git a/LayoutTests/fast/history/same-document-iframes-changing-fragment.html b/LayoutTests/fast/history/same-document-iframes-changing-fragment.html
new file mode 100755
index 0000000..2a169a7
--- /dev/null
+++ b/LayoutTests/fast/history/same-document-iframes-changing-fragment.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html> 
+<html> 
+<head> 
+  <link rel="stylesheet" href="../js/resources/js-test-style.css">
+  <script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<pre id="console"></pre>
+
+<iframe src="data:text/plain,iframe1" id="iframe1"></iframe> 
+<iframe src="data:text/plain,iframe2" id="iframe2"></iframe> 
+
+<script>
+var wentBack = false;
+
+description('Tests that we trigger same-document navigation when history entries are generated via fragment changes, even if the frames present in the document change between history entries.');
+
+if (window.layoutTestController) {
+    layoutTestController.dumpChildFramesAsText();
+    layoutTestController.clearBackForwardList();
+    layoutTestController.dumpBackForwardList();
+}
+
+onload = function()
+{
+    // Run afer onload, to make sure that we can generate history entries.
+    setTimeout(beginTest, 0);
+}
+
+onpopstate = function(event) {
+    var loc = location.href;
+    var filenameAndQuery = loc.substring(loc.lastIndexOf('/') + 1);
+    debug('popstate to state: ' + event.state + ' filename: ' + filenameAndQuery);
+    
+    if (!location.hash) {
+        if (wentBack) {
+            debug('going forward');
+            history.forward();
+        }
+    } else if (location.hash == '#newState') {
+        if (!wentBack) {
+            wentBack = true;
+            debug('going back');
+            history.back();
+        } else {
+            finishJSTest();
+        }
+    } else {
+        testFailed('Unexpected state');
+    }
+};
+
+
+function beginTest() 
+{
+    debug('removing iframe2');
+    document.body.removeChild(document.getElementById('iframe2'));
+
+    debug('navigating to #newState');
+    window.location.href = '#newState';
+}
+
+var successfullyParsed = true;
+var jsTestIsAsync = true;
+</script>  
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt b/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt
new file mode 100755
index 0000000..45d215e
--- /dev/null
+++ b/LayoutTests/fast/history/same-document-iframes-changing-pushstate-expected.txt
@@ -0,0 +1,29 @@
+Tests that we trigger same-document navigation when history entries are generated via pushState, even if the frames present in the document change between history entries.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+popstate to state: null filename: same-document-iframes-changing-pushstate.html
+removing iframe2
+pushState to newState
+going back
+popstate to state: null filename: same-document-iframes-changing-pushstate.html
+going forward
+popstate to state: newState filename: same-document-iframes-changing-pushstate.html?newState
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+
+--------
+Frame: 'iframe1'
+--------
+iframe1
+
+============== Back Forward List ==============
+        (file test):fast/history/same-document-iframes-changing-pushstate.html  **nav target**
+            data:text/plain,iframe1 (in frame "iframe1")
+            data:text/plain,iframe2 (in frame "iframe2")
+curr->  (file test):fast/history/same-document-iframes-changing-pushstate.html?newState  **nav target**
+            data:text/plain,iframe1 (in frame "iframe1")
+===============================================
diff --git a/LayoutTests/fast/history/same-document-iframes-changing-pushstate.html b/LayoutTests/fast/history/same-document-iframes-changing-pushstate.html
new file mode 100755
index 0000000..73d90ac
--- /dev/null
+++ b/LayoutTests/fast/history/same-document-iframes-changing-pushstate.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html> 
+<html> 
+<head> 
+  <link rel="stylesheet" href="../js/resources/js-test-style.css">
+  <script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<pre id="console"></pre>
+
+<iframe src="data:text/plain,iframe1" id="iframe1"></iframe> 
+<iframe src="data:text/plain,iframe2" id="iframe2"></iframe> 
+
+<script>
+var wentBack = false;
+
+description('Tests that we trigger same-document navigation when history entries are generated via pushState, even if the frames present in the document change between history entries.');
+
+if (window.layoutTestController) {
+    layoutTestController.dumpChildFramesAsText();
+    layoutTestController.clearBackForwardList();
+    layoutTestController.dumpBackForwardList();
+}
+
+onload = function()
+{
+    // Run afer onload, to make sure that we can generate history entries.
+    setTimeout(beginTest, 0);
+}
+
+onpopstate = function(event) {
+    var loc = location.href;
+    var filenameAndQuery = loc.substring(loc.lastIndexOf('/') + 1);
+    debug('popstate to state: ' + event.state + ' filename: ' + filenameAndQuery);
+    
+    if (!event.state) {
+        if (wentBack) {
+            debug('going forward');
+            history.forward();
+        }
+    } else if (event.state == 'newState') {
+        finishJSTest();
+    } else {
+        testFailed('Unexpected state');
+    }
+};
+
+
+function beginTest() 
+{
+    debug('removing iframe2');
+    document.body.removeChild(document.getElementById('iframe2'));
+
+    debug('pushState to newState');
+    history.pushState('newState', null, '?newState');
+
+    window.setTimeout(function() {
+        wentBack = true;
+        debug('going back');
+        history.back();
+    }, 0);
+}
+
+var successfullyParsed = true;
+var jsTestIsAsync = true;
+</script>  
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1cb5c6f..b7a599d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-09-29  Mihai Parparita  <mihaip at chromium.org>
+
+        Reviewed by Darin Fisher.
+
+        REGRESSION: page reload on back button after history.pushState with appearing/disappearing iframes
+        https://bugs.webkit.org/show_bug.cgi?id=46324
+        
+        Revert same document check to the way it was before r66238 for history
+        entries created by pushState or fragment changes. Logic fror determining
+        if same document navigation should be used is moved to HistoryItem.
+
+        Tests: fast/history/same-document-iframes-changing-fragment.html
+               fast/history/same-document-iframes-changing-pushstate.html
+
+        * history/HistoryItem.cpp:
+        (WebCore::HistoryItem::shouldDoSameDocumentNavigationTo):
+        (WebCore::HistoryItem::hasSameDocumentTree):
+        (WebCore::HistoryItem::hasSameFrames):
+        * history/HistoryItem.h:
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadItem):
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadItem):
+
 2010-09-29  MORITA Hajime  <morrita at google.com>
 
         Unreviewed build fix.
diff --git a/WebCore/history/HistoryItem.cpp b/WebCore/history/HistoryItem.cpp
index 8a84e2e..2d6ca58 100644
--- a/WebCore/history/HistoryItem.cpp
+++ b/WebCore/history/HistoryItem.cpp
@@ -490,9 +490,26 @@ void HistoryItem::clearChildren()
     m_children.clear();
 }
 
+// We do same-document navigation if going to a different item and if either of the following is true:
+// - The other item corresponds to the same document (for history entries created via pushState or fragment changes).
+// - The other item corresponds to the same set of documents, including frames (for history entries created via regular navigation)
+bool HistoryItem::shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const
+{
+    if (this == otherItem)
+        return false;
+
+    if (stateObject() || otherItem->stateObject())
+        return documentSequenceNumber() == otherItem->documentSequenceNumber();
+    
+    if ((url().hasFragmentIdentifier() || otherItem->url().hasFragmentIdentifier()) && equalIgnoringFragmentIdentifier(url(), otherItem->url()))
+        return documentSequenceNumber() == otherItem->documentSequenceNumber();        
+    
+    return hasSameDocumentTree(otherItem);
+}
+
 // Does a recursive check that this item and its descendants have the same
 // document sequence numbers as the other item.
-bool HistoryItem::hasSameDocuments(HistoryItem* otherItem)
+bool HistoryItem::hasSameDocumentTree(HistoryItem* otherItem) const
 {
     if (documentSequenceNumber() != otherItem->documentSequenceNumber())
         return false;
@@ -503,7 +520,7 @@ bool HistoryItem::hasSameDocuments(HistoryItem* otherItem)
     for (size_t i = 0; i < children().size(); i++) {
         HistoryItem* child = children()[i].get();
         HistoryItem* otherChild = otherItem->childItemWithDocumentSequenceNumber(child->documentSequenceNumber());
-        if (!otherChild || !child->hasSameDocuments(otherChild))
+        if (!otherChild || !child->hasSameDocumentTree(otherChild))
             return false;
     }
 
@@ -512,7 +529,7 @@ bool HistoryItem::hasSameDocuments(HistoryItem* otherItem)
 
 // Does a non-recursive check that this item and its immediate children have the
 // same frames as the other item.
-bool HistoryItem::hasSameFrames(HistoryItem* otherItem)
+bool HistoryItem::hasSameFrames(HistoryItem* otherItem) const
 {
     if (target() != otherItem->target())
         return false;
diff --git a/WebCore/history/HistoryItem.h b/WebCore/history/HistoryItem.h
index b11a92e..ef9ac23 100644
--- a/WebCore/history/HistoryItem.h
+++ b/WebCore/history/HistoryItem.h
@@ -161,8 +161,8 @@ public:
     bool hasChildren() const;
     void clearChildren();
     
-    bool hasSameDocuments(HistoryItem* otherItem);
-    bool hasSameFrames(HistoryItem* otherItem);
+    bool shouldDoSameDocumentNavigationTo(HistoryItem* otherItem) const;
+    bool hasSameFrames(HistoryItem* otherItem) const;
 
     // This should not be called directly for HistoryItems that are already included
     // in GlobalHistory. The WebKit api for this is to use -[WebHistory setLastVisitedTimeInterval:forItem:] instead.
@@ -218,6 +218,8 @@ private:
     void padDailyCountsForNewVisit(double time);
     void collapseDailyVisitsToWeekly();
     void recordVisitAtTime(double, VisitCountBehavior = IncreaseVisitCount);
+    
+    bool hasSameDocumentTree(HistoryItem* otherItem) const;
 
     HistoryItem* findTargetItem();
 
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 973aab7..e030122 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -3228,12 +3228,8 @@ void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType l
 // Loads content into this frame, as specified by history item
 void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType)
 {
-    // We do same-document navigation in the following cases:
-    // - The HistoryItem corresponds to the same document (or documents in the case of frames).
-    // - The HistoryItem is not the same as the current item.
     HistoryItem* currentItem = history()->currentItem();
-    bool sameDocumentNavigation = currentItem && item != currentItem
-        && item->hasSameDocuments(currentItem);
+    bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavigationTo(currentItem);
 
 #if ENABLE(WML)
     // All WML decks should go through the real load mechanism, not the scroll-to-anchor code

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list