Bug 607639 - Check for any window left open after a browser-chrome test; r=gavin

This commit is contained in:
Ehsan Akhgari 2011-03-28 16:29:09 -04:00
parent c9eeb28036
commit 47e2b07627

View File

@ -90,11 +90,21 @@ Tester.prototype = {
}
this.dumper.dump("TEST-INFO | checking window state\n");
let windowsEnum = this._wm.getEnumerator("navigator:browser");
let windowsEnum = this._wm.getEnumerator(null);
while (windowsEnum.hasMoreElements()) {
let win = windowsEnum.getNext();
if (win != window && !win.closed) {
let msg = baseMsg.replace("{elt}", "browser window");
if (win != window && !win.closed &&
win.document.documentElement.getAttribute("id") != "browserTestHarness") {
let type = win.document.documentElement.getAttribute("windowtype");
switch (type) {
case "navigator:browser":
type = "browser window";
break;
case null:
type = "unknown window";
break;
}
let msg = baseMsg.replace("{elt}", type);
if (this.currentTest)
this.currentTest.addResult(new testResult(false, msg, "", false));
else