Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html

Issue 680273004: Never fire popstate event when navigating between documents (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-with-fragment-scroll.html
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 eb9e3ee58859b5f54920a6e4173c06cecced14f5..0a533a812417a7e0766ea5f2d5cb58b9c30d646d 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
@@ -33,10 +33,8 @@ function runTest()
runFirstStageOfTest();
}
-onpopstate = function()
+function continueTest(state)
{
- alert("State popped - " + event.state + " (type " + typeof event.state + ")");
-
// FIXME: Once the popstate and hashchange events fire asynchronously, we
// can eliminate this setTimeout hack. The hashchange event currently runs
// synchronously following the popstate event, but the calls to
@@ -44,7 +42,6 @@ onpopstate = function()
// our hashchange handler, which expects to see the "old" value of the
// location.
- var state = event.state;
setTimeout(function() {
if (state == "FirstEntry") {
history.replaceState("FirstEntryWillLaterBeReactivated", null, "#FirstEntryWillLaterBeReactivated");
@@ -57,7 +54,23 @@ onpopstate = function()
}, 0);
}
-onhashchange = function(event)
+window.onpopstate = function statePopped()
+{
+ var state = event.state;
+ alert("State popped - " + state + " (type " + typeof state + ")");
+ continueTest(state);
+}
+
+window.onpageshow = function pageShown()
+{
+ if (sessionStorage.stage == 2) {
+ var state = history.state;
+ alert("Page shown - " + state + " (type " + typeof state + ")");
+ continueTest(state);
+ }
+}
+
+window.onhashchange = function hashChanged(event)
{
alert("hashChanged - Last path component of location is " + lastPathComponent(event.newURL));
if (hashOf(event.newURL) == "#FirstEntryWillLaterBeReactivated") {
@@ -75,7 +88,7 @@ This test:
-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 fired even on the new documents.
+-Navigates back to the state object entries and verifies the pageshow or popstate events are fired on the new documents.
</pre>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698