additional output in browser_526613.js

This commit is contained in:
Dão Gottwald 2009-11-28 09:57:51 +01:00
Родитель 9719008462
Коммит 26f7468ca6
1 изменённых файлов: 12 добавлений и 18 удалений

Просмотреть файл

@ -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();