/
iframe_history.html
75 lines (65 loc) · 2.38 KB
/
iframe_history.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!doctype html>
<html>
<head>
<title>Repo iframe history.pushState bug in iOS</title>
<script type="text/javascript">
function hackLog(message) {
var div = document.getElementById("output");
div.innerHTML += ("<p>" + message + "</p>");
}
function logHistoryLength() {
var msg = "history.length = " + history.length;
console.log(msg);
hackLog(msg);
}
var num_tests = 0;
function runtest() {
hackLog("<hr><p>Running test #" + num_tests + "</p>");
var iframe = document.getElementsByTagName("iframe")[0];
iframe.contentWindow.location.hash = 'test' + (num_tests++);
setTimeout(logHistoryLength, 100);
}
function changeIFrameLocation() {
var url = document.getElementById("new_url").value;
hackLog("<hr><p>Change IFrame Location To " + url + "</p>");
var iframe = document.getElementsByTagName("iframe")[0];
iframe.contentWindow.location.href = "https://" + url;
setTimeout(logHistoryLength, 100);
}
function changePageLocation() {
var url = document.getElementById("new_url").value;
hackLog("<hr><p>Change page Location To " + url + "</p>");
var iframe = document.getElementsByTagName("iframe")[0];
window.location.href = "https://" + url;
}
</script>
</head>
<body>
<pre>
This is a repo test for crbug.com/685644.
Steps to reproduce:
- Open this page in a new tab
- Tab on "runtest"
- Long tab on Back button
- Repeat a few times
Expected behavior:
- history.length increments by 1 each time you tab on "runtest"
- Back navigation history should contain (history.length - 1) entries
Actual behavior:
- history.length is incremented
- But back navigation history does not grow
</pre>
<p><input type="button" onclick="runtest();" value="runtest"></p>
<div id="output"></div>
<!-- what is <noscript>? -->
<p><iframe src="blank.html"></iframe></p>
<hr>
<p>Debug</p>
<p><input type="button" onclick="logHistoryLength();" value="Init"></p>
<p>
https://<input type="text" id="new_url" value="" width="50em">
<input type="button" onclick="changeIFrameLocation();" value="Change iframe Location">
<input type="button" onclick="changePageLocation();" value="Change Page Location">
</p>
</body>
</html>