gecko/docshell/test/navigation/file_bug754029.html

85 lines
2.1 KiB
HTML

<html>
<head>
<meta http-equiv="content-type" Content="text/html; charset=utf-8">
</head>
<body>
<script>
// inline <script> tag redirection.
function test1() {
location.href = "blank.html?result1";
}
// onload() handler redirection.
function test2() {
addEventListener("load",
function(aEvent) {
location.href = "blank.html?result2";
},
false);
}
// setTimeout() 100 milisec redirection.
function test3() {
setTimeout(function() {
location.href = "blank.html?result3";
},
100);
}
// setTimeout() 100 milisec + inline <script> tag redirection.
function test4() {
setTimeout(function() {
var ns = document.createElement("script");
var nt = document.createTextNode(
"location = 'blank.html?result4'"
);
ns.appendChild(nt);
document.documentElement.appendChild(ns);
},
100);
}
// DOMContentLoaded
function testDOMContentLoaded() {
addEventListener("DOMContentLoaded",
function(aEvent) {
location.href = "blank.html?resultDOMContentLoaded";
},
false);
}
// pageshow
function testPageshow() {
addEventListener("pageshow",
function(aEvent) {
location.href = "blank.html?resultPageshow";
},
false);
}
// readystatechange for "complete"
function testReadystatechange() {
document.onreadystatechange =
function() {
if ("complete" == document.readyState) {
location.href = "blank.html?resultReadystatechange";
}
};
}
switch(location.search) {
case "?test1": test1(); break;
case "?test2": test2(); break;
case "?test3": test3(); break;
case "?test4": test4(); break;
case "?testDOMContentLoaded": testDOMContentLoaded(); break;
case "?testPageshow" : testPageshow(); break;
case "?testReadystatechange": testReadystatechange(); break;
default: throw "Unexpected!";
}
</script>
</body>
</html>