blob: b0315efc173f05953d1c609c24a2e3933d9c4547 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<pre id="console"></pre>
<iframe src="resources/subframe.html" id="iframe1"></iframe>
<script>
description('Ensures that repeated back and forward work for frame hash navigations.');
var frame = document.getElementById("iframe1").contentWindow;
onload = function()
{
// Make sure that we can generate history entries
setTimeout(runTest, 0);
}
// 1. Navigate to hash "#foo".
// 2. Go back to hash "".
// 3. Go forward to hash "#foo".
function runTest()
{
frame.location.hash = "#foo";
}
frame.onhashchange = function()
{
if (frame.location.hash == "#foo") {
if (!window.localStorage.beenHere) {
window.localStorage.beenHere = true;
debug("First visit to foo.");
history.back();
} else {
delete window.localStorage.beenHere;
debug("Gone forward.");
finishJSTest();
}
}
if (frame.location.hash == "") {
debug("Gone back.");
history.forward();
}
}
var jsTestIsAsync = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>