summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_528776.js
blob: 37b76a766d7d6388c370e336c680497cd999a5fe (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);
});