From 8e9bf77329c53134b10b50bfbf28cb3cc66b3dc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 28 Nov 2009 09:57:51 +0100 Subject: [PATCH] additional output in browser_526613.js --- .../test/browser/browser_526613.js | 30 ++++++++----------- 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/browser/components/sessionstore/test/browser/browser_526613.js b/browser/components/sessionstore/test/browser/browser_526613.js index 79c2eedee565..3ec0295c89fb 100644 --- a/browser/components/sessionstore/test/browser/browser_526613.js +++ b/browser/components/sessionstore/test/browser/browser_526613.js @@ -47,28 +47,22 @@ function test() { getService(Ci.nsIWindowMediator); waitForExplicitFinish(); - function browserWindowsCount() { + function browserWindowsCount(expected) { let count = 0; let e = wm.getEnumerator("navigator:browser"); while (e.hasMoreElements()) { - let win = e.getNext(); - if (!win.closed) { + if (!e.getNext().closed) ++count; - if (win != window) { - try { - var tabs = win.gBrowser.mTabs.length; - } catch (e) { - info(e); - } - info("secondary window: " + [win.document.readyState, win.content.location, tabs]); - } - } } - - return count; + is(count, expected, + "number of open browser windows according to nsIWindowMediator"); + let state = ss.getBrowserState(); + info(state); + is(JSON.parse(state).windows.length, expected, + "number of open browser windows according to getBrowserState"); } - is(browserWindowsCount(), 1, "Only one browser window should be open initially"); + browserWindowsCount(1); // backup old state let oldState = ss.getBrowserState(); @@ -89,8 +83,8 @@ function test() { is(aTopic, "sessionstore-browser-state-restored", "The sessionstore-browser-state-restored notification was observed"); - if (this.pass++ == 1) { - is(browserWindowsCount(), 2, "Two windows should exist at this point"); + if (this.pass++ == 1) { + browserWindowsCount(2); // let the first window be focused (see above) function pollMostRecentWindow() { @@ -105,7 +99,7 @@ function test() { pollMostRecentWindow(); } else { - is(browserWindowsCount(), 1, "Only one window should exist after cleanup"); + browserWindowsCount(1); ok(!window.closed, "Restoring the old state should have left this window open"); os.removeObserver(this, "sessionstore-browser-state-restored"); finish();