summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_528776.js
blob: b488d063a007209ff2155af721bdeacf25df47db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function browserWindowsCount(expected) {
  var count = 0;
  for (let win of Services.wm.getEnumerator("navigator:browser")) {
    if (!win.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(async function() {
  browserWindowsCount(1);

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