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

Unified Diff: LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.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
« no previous file with comments | « no previous file | LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
diff --git a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
index 02937d2d36c670b52327c18e6bbe89173a41200e..d812aa2a447565697dcceb7d29f297a67afbf368 100644
--- a/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
+++ b/LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back.html
@@ -15,45 +15,32 @@ function lastPathComponent()
}
function runFirstStageOfTest()
-{
+{
history.replaceState("FirstEntry", null, "?FirstEntry");
history.pushState("SecondEntry", null, "?SecondEntry");
history.back();
}
-function runSecondStageOfTest()
-{
- alert("Last path component of location is " + lastPathComponent());
-}
-
-function runThirdStageOfTest()
-{
- alert("Final stage of test loaded");
-}
-
function runTest()
{
if (!sessionStorage.stage) {
// Location changes need to happen outside the onload handler to generate history entries.
setTimeout(runFirstStageOfTest, 0);
} else if (sessionStorage.stage == 2)
- runSecondStageOfTest();
- else if (sessionStorage.stage == 3)
- runThirdStageOfTest();
+ alert("Last path component of location is " + lastPathComponent());
}
-function statePopped()
+function continueTest(state)
{
- alert("State popped - " + event.state + " (type " + typeof event.state + ")");
- if (event.state == "FirstEntry") {
+ if (state == "FirstEntry") {
history.replaceState("FirstEntryWillLaterBeReactivated", null, "?FirstEntryWillLaterBeReactivated");
history.forward();
- } else if (event.state == "SecondEntry") {
+ } else if (state == "SecondEntry") {
history.replaceState("SecondEntryWillLaterBeReactivated", null, "?SecondEntryWillLaterBeReactivated");
window.location = "resources/navigate-back.html";
- } else if (event.state == "SecondEntryWillLaterBeReactivated")
+ } else if (state == "SecondEntryWillLaterBeReactivated")
history.back();
- else if (event.state == "FirstEntryWillLaterBeReactivated") {
+ else if (state == "FirstEntryWillLaterBeReactivated") {
alert("Test complete");
sessionStorage.clear();
if (window.testRunner)
@@ -61,14 +48,30 @@ function statePopped()
}
}
+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);
+ }
+}
+
</script>
-<body onload="runTest();" onpopstate="statePopped();" onunload="/* disable page cache */">
+<body onload="runTest();" onunload="/* disable page cache */">
<pre>
This test:
-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 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><br>
<pre id="logger"></pre>
</body>
« no previous file with comments | « no previous file | LayoutTests/fast/loader/stateobjects/document-destroyed-navigate-back-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698