blob: a38173305b6c1645563a1d39015d8a913c2632ef [file] [log] [blame]
<html>
<head>
<title>initial title</title>
<script>
var popup, popup2, popup3, popup4;
function WindowOpen(file, name, attr) {
// Force windows to open in a new process. See https://crbug.com/153363.
var url = 'http://example.com:' + location.port + '/' + file;
var w = window.open('', name, attr);
w.opener = null;
w.location.href = url;
return w;
}
// window.open, window.close should be synchronous
function test1() {
popup = WindowOpen('title1.html', 'name');
popup.close();
popup = WindowOpen('title2.html', 'name', 'width=200,height=200');
popup.close();
document.location = 'title2.html'
}
// Try opening/closing a few windows.
function test2() {
openPopups();
closePopups();
document.location = 'title2.html'
}
function test3() {
openPopups();
setTimeout(closePopups, 0);
setTimeout(test4, 1);
}
function test4() {
openPopups();
setTimeout(closePopupsAndDone, 250);
}
function openPopups() {
popup = WindowOpen('title1.html', 'name');
popup2 = WindowOpen('title1.html', 'name2');
popup3 = WindowOpen('title1.html', 'name3');
popup4 = WindowOpen('title1.html', 'name4');
}
function closePopups() {
popup.close();
popup2.close();
popup3.close();
popup4.close();
}
function closePopupsAndDone() {
closePopups();
document.location = 'title2.html'
}
function startTheTest() {
if (location.search == "?test1")
test1();
else if (location.search == "?test2")
test2();
else if (location.search == "?test3")
test3();
}
</script>
</head>
<body onload="setTimeout(startTheTest, 0);">
</body>
</html>