summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_528776.js
blob: d799c9740143ce8cc7077f4cbee9822f0488d624 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function browserWindowsCount(expected) {
  var count = 0;
  var e = Services.wm.getEnumerator("navigator:browser");
  while (e.hasMoreElements()) {
    if (!e.getNext().closed)
      ++count;
  }
  is(count, expected,
     "number of open browser windows according to nsIWindowMediator");
  is(JSON.parse(ss.getBrowserState()).windows.length, expected,
     "number of open browser windows according to getBrowserState");
}

add_task(function() {
  browserWindowsCount(1);

  let win = yield BrowserTestUtils.openNewBrowserWindow();
  browserWindowsCount(2);
  yield BrowserTestUtils.closeWindow(win);
  browserWindowsCount(1);
});