Count open windows in browser_514751.js for bug 528776

This commit is contained in:
Dão Gottwald 2009-11-16 17:33:56 +01:00
parent 1d7590ae69
commit 00ff1dc6e1

View File

@ -34,8 +34,21 @@
*
* ***** END LICENSE BLOCK ***** */
function browserWindowsCount() {
let count = 0;
let e = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator)
.getEnumerator("navigator:browser");
while (e.hasMoreElements()) {
if (!e.getNext().closed)
++count;
}
return count;
}
function test() {
/** Test for Bug 514751 (Wallpaper) **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
@ -81,6 +94,7 @@ function test() {
case "domwindowclosed":
ww.unregisterNotification(this);
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
break;
}