mirror of
				https://github.com/mozilla/gecko-dev.git
				synced 2025-11-04 10:18:41 +02:00 
			
		
		
		
	# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D36042 --HG-- extra : source : d3afcafdce650a6f36cebbc126ee93b17f13cf52
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			638 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			638 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
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);
 | 
						|
});
 |