[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
beidson at apple.com
beidson at apple.com
Wed Jan 20 22:26:36 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 7491b89437d0680c49eb6587b7e82e4964426fff
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jan 16 19:18:14 2010 +0000
<rdar://problem/7536748> and https://bugs.webkit.org/show_bug.cgi?id=33571
History traversals to a new document do not get the popstate event
Reviewed by Darin Adler.
WebCore:
State objects now live-on in their HistoryItem indefinitely.
This means any back/forward navigation might result in a popstate event, not just to
pre-existing documents as was previously the case.
* history/HistoryItem.cpp:
(WebCore::HistoryItem::documentDetached): State objects are held beyond Document lifetime.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::begin): If there is a pending state object for this Frame load, pass it
on to the Document after the Document is created.
(WebCore::FrameLoader::transitionToCommitted): If the current history item has a state object,
set it as the FrameLoad's pending state object.
* loader/FrameLoader.h:
* page/Page.cpp:
(WebCore::Page::goToItem): Remove a now-invalid ASSERT.
LayoutTests:
Updated existing tests to match new correct behavior.
* fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt:
* fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll-expected.txt:
* fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html:
* fast/loader/stateobjects/document-destroyed-navigate-back.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53361 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 1f4de17..26d7f3a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-16 Brady Eidson <beidson at apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7536748> and https://bugs.webkit.org/show_bug.cgi?id=33571
+ History traversals to a new document do not get the popstate event
+
+ Updated existing tests to match new correct behavior.
+
+ * fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt:
+ * fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll-expected.txt:
+ * fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html:
+ * fast/loader/stateobjects/document-destroyed-navigate-back.html:
+
2010-01-15 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein and Adele Peterson.
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 12dc44e..da3ae80 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt
@@ -1,22 +1,18 @@
main frame - has 1 onunload handler(s)
-ALERT: History length is 2
ALERT: State popped - FirstEntry (type string)
ALERT: State popped - SecondEntry (type string)
ALERT: Navigating back...
main frame - has 1 onunload handler(s)
-ALERT: History length is 3
-ALERT: Last path component of location is document-destroyed-navigate-back.html?SecondEntryShouldNeverBeReactivated
+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: History length is 3
-ALERT: Last path component of location is document-destroyed-navigate-back.html?FirstEntryShouldNeverBeReactivated
-ALERT: Test completed
+ALERT: Last path component of location is document-destroyed-navigate-back.html?FirstEntryWillLaterBeReactivated
+ALERT: State popped - FirstEntryWillLaterBeReactivated (type string)
+ALERT: Test complete
This test:
--Builds up a list of state object entries.
+-Builds up a list of state object entries with fragment URLs.
-Navigates through them to verify that the popstate event is fired.
-Navigates away to a new document, with the old document being destroyed.
--Navigates back to the state object entries and verifies the popstate event is not fired.
+-Navigates back to the state object entries and verifies the popstate event is fired even on the new documents.
-History length is 3
-Last path component of location is document-destroyed-navigate-back.html?FirstEntryShouldNeverBeReactivated
-Test completed
diff --git a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll-expected.txt b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll-expected.txt
index 6e67259..3f38371 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll-expected.txt
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll-expected.txt
@@ -1,23 +1,20 @@
main frame - has 1 onunload handler(s)
-ALERT: History length is 2
+ALERT: LOADED
ALERT: State popped - FirstEntry (type string)
ALERT: hashChanged - Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#FirstEntry
ALERT: State popped - SecondEntry (type string)
ALERT: hashChanged - Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#SecondEntry
ALERT: Navigating back...
main frame - has 1 onunload handler(s)
-ALERT: History length is 3
-ALERT: Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#SecondEntryShouldNeverBeReactivated
-ALERT: hashChanged - Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#FirstEntryShouldNeverBeReactivated
-ALERT: Test completed
+ALERT: LOADED
+ALERT: Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#SecondEntryWillLaterBeReactivated
+ALERT: State popped - SecondEntryWillLaterBeReactivated (type string)
+ALERT: State popped - FirstEntryWillLaterBeReactivated (type string)
+ALERT: hashChanged - Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#FirstEntryWillLaterBeReactivated
+ALERT: Test complete
This test:
--Builds up a list of state object entries with fragment URL.
+-Builds up a list of state object entries with fragment URLs.
-Navigates through them to verify that the popstate and hashchanged events are fired.
-Navigates away to a new document, with the old document being destroyed.
--Navigates back to the state object entries and verifies the popstate event is not fired.
-
-History length is 3
-Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#SecondEntryShouldNeverBeReactivated
-hashChanged - Last path component of location is document-destroyed-navigate-back-with-fragment-scroll.html#FirstEntryShouldNeverBeReactivated
-Test completed
+-Navigates back to the state object entries and verifies the popstate event is fired even on the new documents.
diff --git a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
index ee49914..a552739 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
@@ -9,93 +9,72 @@ if (window.layoutTestController) {
layoutTestController.waitUntilDone();
}
-function log(txt)
-{
- document.getElementById("logger").innerText += txt + "\n";
- // alert the messages also so DumpRenderTree can capture and log messages across multiple documents.
- alert(txt);
-}
-
-function endTest(msg)
-{
- log(msg);
- sessionStorage.clear();
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
-
function lastPathComponent()
{
return window.location.href.split('/').pop();
}
+function runFirstStageOfTest()
+{
+ history.replaceState("FirstEntry", null, "#FirstEntry");
+ history.pushState("SecondEntry", null, "#SecondEntry");
+ history.back();
+}
+
function runSecondStageOfTest()
{
- log("History length is " + history.length);
- log("Last path component of location is " + lastPathComponent());
- sessionStorage.stage = 3;
+ alert("Last path component of location is " + lastPathComponent());
history.back();
}
function runThirdStageOfTest()
{
- log("History length is " + history.length);
- log("Last path component of location is " + lastPathComponent());
- endTest("Test completed");
+ alert("Final stage of test loaded");
}
function loaded()
{
- if (sessionStorage.stage) {
- if (sessionStorage.stage == 2)
- runSecondStageOfTest();
- else if (sessionStorage.stage == 3)
- endTest("Shouldn't reach this case when doing fragment scrolls");
- else
- endTest("Unexpected stage value");
- } else
+ alert("LOADED");
+ if (!sessionStorage.stage)
runFirstStageOfTest();
-}
-
-function runFirstStageOfTest()
-{
- history.replaceState("FirstEntry", null, "#FirstEntry");
- history.pushState("SecondEntry", null, "#SecondEntry");
-
- log("History length is " + history.length);
- history.back();
+ else if (sessionStorage.stage == 2)
+ runSecondStageOfTest();
+ else if (sessionStorage.stage == 3)
+ runThirdStageOfTest();
}
function statePopped()
{
- log("State popped - " + event.state + " (type " + typeof event.state + ")");
+ alert("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == "FirstEntry") {
- history.replaceState("FirstEntryShouldNeverBeReactivated", null, "#FirstEntryShouldNeverBeReactivated");
+ history.replaceState("FirstEntryWillLaterBeReactivated", null, "#FirstEntryWillLaterBeReactivated");
history.forward();
} else if (event.state == "SecondEntry") {
- history.replaceState("SecondEntryShouldNeverBeReactivated", null, "#SecondEntryShouldNeverBeReactivated");
+ history.replaceState("SecondEntryWillLaterBeReactivated", null, "#SecondEntryWillLaterBeReactivated");
window.location = "resources/navigate-back.html";
- } else
- endTest("Unexpected state popped - " + event.state);
+ } else if (event.state == "SecondEntryWillLaterBeReactivated")
+ history.back();
}
function hashChanged()
{
- log("hashChanged - Last path component of location is " + lastPathComponent());
-
- if (window.location.hash == "#FirstEntryShouldNeverBeReactivated")
- endTest("Test completed");
+ alert("hashChanged - Last path component of location is " + lastPathComponent());
+ if (window.location.hash == "#FirstEntryWillLaterBeReactivated") {
+ alert("Test complete");
+ sessionStorage.clear();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
}
</script>
<body onload="loaded();" onpopstate="statePopped();" onhashchange="hashChanged();" onunload="/* disable page cache */">
<pre>
This test:
--Builds up a list of state object entries with fragment URL.
+-Builds up a list of state object entries with fragment URLs.
-Navigates through them to verify that the popstate and hashchanged events are fired.
-Navigates away to a new document, with the old document being destroyed.
--Navigates back to the state object entries and verifies the popstate event is not fired.
-</pre><br>
-<pre id="logger"></pre>
+-Navigates back to the state object entries and verifies the popstate event is fired even on the new documents.
+</pre>
</body>
</html>
diff --git a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
index 13277de..8e6a644 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
@@ -9,84 +9,66 @@ if (window.layoutTestController) {
layoutTestController.waitUntilDone();
}
-function log(txt)
-{
- document.getElementById("logger").innerText += txt + "\n";
- // alert the messages also so DumpRenderTree can capture and log messages across multiple documents.
- alert(txt);
-}
-
-function endTest(msg)
-{
- log(msg);
- sessionStorage.clear();
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
-
function lastPathComponent()
{
return window.location.href.split('/').pop();
}
+function runFirstStageOfTest()
+{
+ history.replaceState("FirstEntry", null, "?FirstEntry");
+ history.pushState("SecondEntry", null, "?SecondEntry");
+ history.back();
+}
+
function runSecondStageOfTest()
{
- log("History length is " + history.length);
- log("Last path component of location is " + lastPathComponent());
- sessionStorage.stage = 3;
+ alert("Last path component of location is " + lastPathComponent());
history.back();
}
function runThirdStageOfTest()
{
- log("History length is " + history.length);
- log("Last path component of location is " + lastPathComponent());
- endTest("Test completed");
+ alert("Final stage of test loaded");
}
function loaded()
{
- if (sessionStorage.stage) {
- if (sessionStorage.stage == 2)
- runSecondStageOfTest();
- else if (sessionStorage.stage == 3)
- runThirdStageOfTest();
- else
- endTest("Unexpected stage value");
- } else
+ if (!sessionStorage.stage)
runFirstStageOfTest();
-}
-
-function runFirstStageOfTest()
-{
- history.replaceState("FirstEntry", null, "?FirstEntry");
- history.pushState("SecondEntry", null, "?SecondEntry");
-
- log("History length is " + history.length);
- history.back();
+ else if (sessionStorage.stage == 2)
+ runSecondStageOfTest();
+ else if (sessionStorage.stage == 3)
+ runThirdStageOfTest();
}
function statePopped()
{
- log("State popped - " + event.state + " (type " + typeof event.state + ")");
+ alert("State popped - " + event.state + " (type " + typeof event.state + ")");
if (event.state == "FirstEntry") {
- history.replaceState("FirstEntryShouldNeverBeReactivated", null, "?FirstEntryShouldNeverBeReactivated");
+ history.replaceState("FirstEntryWillLaterBeReactivated", null, "?FirstEntryWillLaterBeReactivated");
history.forward();
} else if (event.state == "SecondEntry") {
- history.replaceState("SecondEntryShouldNeverBeReactivated", null, "?SecondEntryShouldNeverBeReactivated");
+ history.replaceState("SecondEntryWillLaterBeReactivated", null, "?SecondEntryWillLaterBeReactivated");
window.location = "resources/navigate-back.html";
- } else
- endTest("Unexpected state popped - " + event.state);
+ } else if (event.state == "SecondEntryWillLaterBeReactivated")
+ history.back();
+ else if (event.state == "FirstEntryWillLaterBeReactivated") {
+ alert("Test complete");
+ sessionStorage.clear();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }
}
</script>
<body onload="loaded();" onpopstate="statePopped();" onunload="/* disable page cache */">
<pre>
This test:
--Builds up a list of state object entries.
+-Builds up a list of state object entries with fragment URLs.
-Navigates through them to verify that the popstate event is fired.
-Navigates away to a new document, with the old document being destroyed.
--Navigates back to the state object entries and verifies the popstate event is not fired.
+-Navigates back to the state object entries and verifies the popstate event is fired even on the new documents.
</pre><br>
<pre id="logger"></pre>
</body>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 028b869..5804959 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-01-16 Brady Eidson <beidson at apple.com>
+
+ Reviewed by Darin Adler.
+
+ <rdar://problem/7536748> and https://bugs.webkit.org/show_bug.cgi?id=33571
+ History traversals to a new document do not get the popstate event
+
+ State objects now live-on in their HistoryItem indefinitely.
+ This means any back/forward navigation might result in a popstate event, not just to
+ pre-existing documents as was previously the case.
+
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::documentDetached): State objects are held beyond Document lifetime.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::begin): If there is a pending state object for this Frame load, pass it
+ on to the Document after the Document is created.
+ (WebCore::FrameLoader::transitionToCommitted): If the current history item has a state object,
+ set it as the FrameLoad's pending state object.
+ * loader/FrameLoader.h:
+
+ * page/Page.cpp:
+ (WebCore::Page::goToItem): Remove a now-invalid ASSERT.
+
2010-01-15 Simon Fraser <simon.fraser at apple.com>
Reviewed by Dan Bernstein and Adele Peterson.
diff --git a/WebCore/history/HistoryItem.cpp b/WebCore/history/HistoryItem.cpp
index 21e67ca..4c9eabe 100644
--- a/WebCore/history/HistoryItem.cpp
+++ b/WebCore/history/HistoryItem.cpp
@@ -418,7 +418,6 @@ void HistoryItem::documentDetached(Document* document)
{
ASSERT_UNUSED(document, m_document == document);
m_document = 0;
- m_stateObject = 0;
}
void HistoryItem::addChildItem(PassRefPtr<HistoryItem> child)
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 26545f4..8770f5c 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -837,6 +837,11 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin)
document->setURL(m_URL);
m_frame->setDocument(document);
+ if (m_pendingStateObject) {
+ document->statePopped(m_pendingStateObject.get());
+ m_pendingStateObject.clear();
+ }
+
if (m_decoder)
document->setDecoder(m_decoder.get());
if (forcedSecurityOrigin)
@@ -2528,10 +2533,13 @@ void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
case FrameLoadTypeBack:
case FrameLoadTypeBackWMLDeckNotAccessible:
case FrameLoadTypeIndexedBackForward:
- if (Page* page = m_frame->page())
+ if (Page* page = m_frame->page()) {
if (page->backForwardList()) {
history()->updateForBackForwardNavigation();
+ if (history()->currentItem())
+ m_pendingStateObject = history()->currentItem()->stateObject();
+
// Create a document view for this document, or used the cached view.
if (cachedPage) {
DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader();
@@ -2542,6 +2550,7 @@ void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
} else
m_client->transitionToCommittedForNewPage();
}
+ }
break;
case FrameLoadTypeReload:
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index ef5bb41..87dd7a0 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -483,6 +483,8 @@ private:
bool m_isComplete;
bool m_isLoadingMainResource;
+ RefPtr<SerializedScriptValue> m_pendingStateObject;
+
KURL m_URL;
KURL m_workingURL;
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index ac13104..dee120a 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -289,13 +289,6 @@ void Page::goBackOrForward(int distance)
void Page::goToItem(HistoryItem* item, FrameLoadType type)
{
-#if !ASSERT_DISABLED
- // If we're navigating to an item with history state for a Document other than the
- // current Document, the new Document had better be in the page cache.
- if (item->stateObject() && item->document() != m_mainFrame->document())
- ASSERT(item->document()->inPageCache());
-#endif
-
// Abort any current load unless we're navigating the current document to a new state object
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.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list