summaryrefslogtreecommitdiffstats
path: root/chrome/test/data/window.close.html
blob: ebe1686817266eef3069d92b35342597ef55dedb (plain)
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
<script>
var popup, popup2, popup3, popup4;

// window.open, window.close should be synchronous
function test1() {
  popup = window.open('title1.html', 'name');
  popup.close();

  popup = window.open('title2.html', 'name', 'width=200,height=200');
  popup.close();
}

// Try opening/closing a few windows.
function test2() {
  openPopups();
  closePopups();
}

function test3() {
  openPopups();
  setTimeout(closePopups, 0);
  setTimeout(test4, 1);
}

function test4() {
  openPopups();
  setTimeout(closePopupsAndDone, 250);
}

function openPopups() {
  popup = window.open('title1.html', 'name');
  popup2 = window.open('title1.html', 'name2');
  popup3 = window.open('title1.html', 'name3');
  popup4 = window.open('title1.html', 'name4');
}

function closePopups() {
  popup.close();
  popup2.close();
  popup3.close();
  popup4.close();
}

function closePopupsAndDone() {
  closePopups();
  document.title = "PASSED";
}

test1();
test2();
test3();

</script>