|
1 function browserWindowsCount(expected) { |
|
2 var count = 0; |
|
3 var e = Services.wm.getEnumerator("navigator:browser"); |
|
4 while (e.hasMoreElements()) { |
|
5 if (!e.getNext().closed) |
|
6 ++count; |
|
7 } |
|
8 is(count, expected, |
|
9 "number of open browser windows according to nsIWindowMediator"); |
|
10 is(JSON.parse(ss.getBrowserState()).windows.length, expected, |
|
11 "number of open browser windows according to getBrowserState"); |
|
12 } |
|
13 |
|
14 function test() { |
|
15 waitForExplicitFinish(); |
|
16 |
|
17 browserWindowsCount(1); |
|
18 |
|
19 var win = openDialog(location, "", "chrome,all,dialog=no"); |
|
20 win.addEventListener("load", function () { |
|
21 win.removeEventListener("load", arguments.callee, false); |
|
22 browserWindowsCount(2); |
|
23 win.close(); |
|
24 browserWindowsCount(1); |
|
25 finish(); |
|
26 }, false); |
|
27 } |