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

Unified Diff: LayoutTests/fast/history/history-length-append-subframe-with-hash.html

Issue 201773002: Do not trigger new history entry if iframe URL doesn't change (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests. Somehow getting different iframe dump on some bots. Created 6 years, 9 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/history/history-length-append-subframe-with-hash.html
diff --git a/LayoutTests/fast/history/history-length-append-subframe-with-hash.html b/LayoutTests/fast/history/history-length-append-subframe-with-hash.html
new file mode 100644
index 0000000000000000000000000000000000000000..dc5c74ab7386d82c30be0b2bb43425d300a6ca4f
--- /dev/null
+++ b/LayoutTests/fast/history/history-length-append-subframe-with-hash.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../resources/js-test.js"></script>
+</head>
+<body>
+ <p id="description"></p>
+ <pre id="console"></pre>
+
+ <script>
+ var jsTestIsAsync = true;
+
+ description('Tests that appending iframe with with no URL and setting its URL later (including hash part) does not overwrite current history entry.');
+
+ if (window.testRunner)
+ testRunner.clearBackForwardList();
+
+ onload = beginTest;
+
+ function beginTest() {
+ // The frame must be appened both on initial load and after navigating
+ // back. On first load we must set the same SRC as after navigating away.
+ var iframe = document.createElement('iframe');
+ document.body.appendChild(iframe);
+
+ if (location.hash.indexOf('wentBack') == -1) {
+ // Run else code path after going back.
+ location.hash = 'wentBack';
+
+ setFrameSrc();
+
+ // Navigate forward and back to create forward navigation entry.
+ // Must be done outside the load handler to generate history entry.
+ window.setTimeout(function() {
+ location.href = 'data:text/html,<body onload="history.back()">Must not see this text!!!</body>';
+ }, 0);
+ } else {
+ window.setTimeout(setFrameSrcAndfinishTest, 100);
+ }
+ }
+
+ function setFrameSrc() {
+ document.querySelector('iframe').src = 'about:blank/#identifier';
+ }
+
+ function setFrameSrcAndfinishTest() {
+ document.querySelector('iframe').src = 'about:blank/#identifier';
+ testRunner.dumpBackForwardList();
+ finishJSTest();
+ }
+ </script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698