From 395e5a8864e65664069d59611752eaa741f2a39d Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Mon, 28 Mar 2011 16:29:09 -0400 Subject: [PATCH] Bug 607639 - Check for any window left open after a browser-chrome test; r=gavin --- testing/mochitest/browser-test.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js index 9c18c17a25bf..d50e8d4a66ac 100644 --- a/testing/mochitest/browser-test.js +++ b/testing/mochitest/browser-test.js @@ -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