[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 16:23:25 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 3c9be217df2749d47b7b001a7f2d97ea163ccb99
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 22 23:01:28 2010 +0000
2010-11-22 Charlie Reis <creis at chromium.org>
Reviewed by Darin Fisher.
Update correct content state during back/forward navigations
https://bugs.webkit.org/show_bug.cgi?id=48809
Test that we update content state when leaving a form in a subframe.
* fast/history/saves-state-after-frame-nav.html:
* fast/history/saves-state-after-frame-nav-expected.txt:
* fast/history/resources/subframe-with-form.html:
2010-11-22 Charlie Reis <creis at chromium.org>
Reviewed by Darin Fisher.
Update correct content state during back/forward navigations
https://bugs.webkit.org/show_bug.cgi?id=48809
Ensures that history's previousItem is non-null when clients try to
update content state (e.g., Chromium's UpdateSessionHistory). We now
track load completions with a boolean field rather than by clearing
previousItem.
Test: fast/history/saves-state-after-frame-nav.html
* loader/HistoryController.cpp:
* loader/HistoryController.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72566 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 446650d..9174dbb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-11-22 Charlie Reis <creis at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Update correct content state during back/forward navigations
+ https://bugs.webkit.org/show_bug.cgi?id=48809
+
+ Test that we update content state when leaving a form in a subframe.
+
+ * fast/history/saves-state-after-frame-nav.html:
+ * fast/history/saves-state-after-frame-nav-expected.txt:
+ * fast/history/resources/subframe-with-form.html:
+
2010-11-22 Julie Parent <jparent at chromium.org>
Unreviewed. Add flaky crash expectation for fast/files/revoke-blob-url.html on mac debug.
diff --git a/LayoutTests/fast/history/resources/subframe-with-form.html b/LayoutTests/fast/history/resources/subframe-with-form.html
new file mode 100644
index 0000000..7da7f9b
--- /dev/null
+++ b/LayoutTests/fast/history/resources/subframe-with-form.html
@@ -0,0 +1,6 @@
+<html>
+<body>
+Frame with form.
+<input id="textInput" type="text"></input>
+</body>
+</html>
diff --git a/LayoutTests/fast/history/saves-state-after-frame-nav-expected.txt b/LayoutTests/fast/history/saves-state-after-frame-nav-expected.txt
new file mode 100644
index 0000000..9ebdbbf
--- /dev/null
+++ b/LayoutTests/fast/history/saves-state-after-frame-nav-expected.txt
@@ -0,0 +1,4 @@
+Navigates a subframe and edits a field, then goes back and forward to test if the field state is restored.
+PASS
+Link
+
diff --git a/LayoutTests/fast/history/saves-state-after-frame-nav.html b/LayoutTests/fast/history/saves-state-after-frame-nav.html
new file mode 100644
index 0000000..8202a54
--- /dev/null
+++ b/LayoutTests/fast/history/saves-state-after-frame-nav.html
@@ -0,0 +1,66 @@
+<html>
+<head>
+</head>
+<body>
+Navigates a subframe and edits a field, then goes back and forward
+to test if the field state is restored.
+<pre id="result">FAIL</pre>
+
+<script>
+
+function clickLink() {
+ // Simulate a mouse click on a link targeting the frame.
+ var evt = document.createEvent("MouseEvents");
+ evt.initMouseEvent("click", true, true, window,
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ document.getElementById("link").dispatchEvent(evt);
+}
+
+function getTextInput() {
+ var frame = document.getElementById("frame");
+ return frame.contentDocument.getElementById("textInput");
+}
+
+var stage = "before edit";
+var textInputValue;
+
+function frameLoaded() {
+ if (stage == "before edit") {
+ var textInput = getTextInput();
+ if (textInput != null) {
+ // Edit the form and go back.
+ textInput.value = "test";
+ stage = "after edit";
+ history.back();
+ }
+ } else if (stage == "after edit") {
+ // Go forward.
+ stage = "after forward";
+ history.forward();
+ } else if (stage == "after forward") {
+ // Check that the value is still in the form.
+ if (getTextInput().value == "test")
+ document.getElementById("result").innerHTML = "PASS";
+
+ if (window.layoutTestController) {
+ layoutTestController.notifyDone();
+ }
+ }
+}
+
+onload = function () {
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+ clickLink();
+}
+
+</script>
+
+<a href="resources/subframe-with-form.html" id="link" target="frame">Link</a>
+<br>
+<iframe id="frame" src="resources/subframe.html" onload="frameLoaded()"></iframe>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ec89496..2a35ae5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-22 Charlie Reis <creis at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Update correct content state during back/forward navigations
+ https://bugs.webkit.org/show_bug.cgi?id=48809
+
+ Ensures that history's previousItem is non-null when clients try to
+ update content state (e.g., Chromium's UpdateSessionHistory). We now
+ track load completions with a boolean field rather than by clearing
+ previousItem.
+
+ Test: fast/history/saves-state-after-frame-nav.html
+
+ * loader/HistoryController.cpp:
+ * loader/HistoryController.h:
+
2010-11-22 Luiz Agostini <luiz.agostini at openbossa.org>
Unreviewed, Windows build fix.
diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp
index 07bece7..ff733a9 100644
--- a/WebCore/loader/HistoryController.cpp
+++ b/WebCore/loader/HistoryController.cpp
@@ -66,6 +66,7 @@ static inline void addVisitedLink(Page* page, const KURL& url)
HistoryController::HistoryController(Frame* frame)
: m_frame(frame)
+ , m_frameLoadComplete(true)
{
}
@@ -138,10 +139,10 @@ void HistoryController::saveDocumentState()
// target of the current navigation (if we even decide to save with that granularity).
// Because of previousItem's "masking" of currentItem for this purpose, it's important
- // that previousItem be cleared at the end of a page transition. We leverage the
- // checkLoadComplete recursion to achieve this goal.
+ // that we keep track of the end of a page transition with m_frameLoadComplete. We
+ // leverage the checkLoadComplete recursion to achieve this goal.
- HistoryItem* item = m_previousItem ? m_previousItem.get() : m_currentItem.get();
+ HistoryItem* item = m_frameLoadComplete ? m_currentItem.get() : m_previousItem.get();
if (!item)
return;
@@ -245,7 +246,8 @@ void HistoryController::updateForBackForwardNavigation()
#endif
// Must grab the current scroll position before disturbing it
- saveScrollPositionAndViewStateToItem(m_previousItem.get());
+ if (!m_frameLoadComplete)
+ saveScrollPositionAndViewStateToItem(m_previousItem.get());
}
void HistoryController::updateForReload()
@@ -392,6 +394,7 @@ void HistoryController::updateForCommit()
// the provisional item for restoring state.
// Note previousItem must be set before we close the URL, which will
// happen when the data source is made non-provisional below
+ m_frameLoadComplete = false;
m_previousItem = m_currentItem;
ASSERT(m_provisionalItem);
m_currentItem = m_provisionalItem;
@@ -418,12 +421,15 @@ void HistoryController::updateForSameDocumentNavigation()
void HistoryController::updateForFrameLoadCompleted()
{
// Even if already complete, we might have set a previous item on a frame that
- // didn't do any data loading on the past transaction. Make sure to clear these out.
- m_previousItem = 0;
+ // didn't do any data loading on the past transaction. Make sure to track that
+ // the load is complete so that we use the current item instead.
+ m_frameLoadComplete = true;
}
void HistoryController::setCurrentItem(HistoryItem* item)
{
+ m_frameLoadComplete = false;
+ m_previousItem = m_currentItem;
m_currentItem = item;
}
@@ -498,6 +504,7 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal)
}
// Set the item for which we will save document state
+ m_frameLoadComplete = false;
m_previousItem = m_currentItem;
m_currentItem = item;
@@ -507,7 +514,7 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal)
PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bool clipAtTarget)
{
RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false);
- if (m_previousItem)
+ if (!m_frameLoadComplete)
saveScrollPositionAndViewStateToItem(m_previousItem.get());
if (!clipAtTarget || m_frame != targetFrame) {
@@ -563,14 +570,15 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt
&& fromItem->hasSameFrames(item))
{
// This content is good, so leave it alone and look for children that need reloading
- // Save form state (works from currentItem, since prevItem is nil)
- ASSERT(!m_previousItem);
+ // Save form state (works from currentItem, since m_frameLoadComplete is true)
+ ASSERT(m_frameLoadComplete);
saveDocumentState();
saveScrollPositionAndViewStateToItem(m_currentItem.get());
if (FrameView* view = m_frame->view())
view->setWasScrolledByUser(false);
+ m_previousItem = m_currentItem;
m_currentItem = item;
// Restore form state (works from currentItem)
diff --git a/WebCore/loader/HistoryController.h b/WebCore/loader/HistoryController.h
index 1002dbc..1bf5072 100644
--- a/WebCore/loader/HistoryController.h
+++ b/WebCore/loader/HistoryController.h
@@ -96,6 +96,8 @@ private:
RefPtr<HistoryItem> m_currentItem;
RefPtr<HistoryItem> m_previousItem;
RefPtr<HistoryItem> m_provisionalItem;
+
+ bool m_frameLoadComplete;
};
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list