From 4725048bd997201bc36be93ebda0186550153ab1 Mon Sep 17 00:00:00 2001 From: Dan Witte Date: Tue, 16 Nov 2010 09:37:09 -0800 Subject: [PATCH] Bug 599253 - TEST-UNEXPECTED-FAIL | browser_586068-cascaded_restore.js | Test timed out. Possible fix for intermittent orange. r=zpao, a=test-only --- .../browser/browser_586068-cascaded_restore.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js b/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js index 3d6432aefe8..b2c8a7f6436 100644 --- a/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js +++ b/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js @@ -69,10 +69,20 @@ function runNextTest() { // set an empty state & run the next test, or finish if (tests.length) { + // Enumerate windows and close everything but our primary window. We can't + // use waitForFocus() because apparently it's buggy. See bug 599253. + var windowsEnum = Services.wm.getEnumerator("navigator:browser"); + while (windowsEnum.hasMoreElements()) { + var currentWindow = windowsEnum.getNext(); + if (currentWindow != window) { + currentWindow.close(); + } + } + ss.setBrowserState(JSON.stringify({ windows: [{ tabs: [{ url: 'about:blank' }] }] })); - let test = tests.shift(); - info("running " + test.name); - executeSoon(test); + let currentTest = tests.shift(); + info("running " + currentTest.name); + executeSoon(currentTest); } else { ss.setBrowserState(stateBackup);