browser_528776.js (639B)
1 function browserWindowsCount(expected) { 2 var count = 0; 3 for (let win of Services.wm.getEnumerator("navigator:browser")) { 4 if (!win.closed) { 5 ++count; 6 } 7 } 8 is( 9 count, 10 expected, 11 "number of open browser windows according to nsIWindowMediator" 12 ); 13 is( 14 JSON.parse(ss.getBrowserState()).windows.length, 15 expected, 16 "number of open browser windows according to getBrowserState" 17 ); 18 } 19 20 add_task(async function () { 21 browserWindowsCount(1); 22 23 let win = await BrowserTestUtils.openNewBrowserWindow(); 24 browserWindowsCount(2); 25 await BrowserTestUtils.closeWindow(win); 26 browserWindowsCount(1); 27 });