53 lines
1.2 KiB
HTML
53 lines
1.2 KiB
HTML
<!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>
|