rem: var windowManager = Components. classes['@mozilla.org/appshell/window-mediator;1'].getService();  var windowManagerInterface = windowManager. QueryInterface(Components.interfaces.nsIWindowMediator);  var enumerator = windowManagerInterface.getEnumerator(null);  while (enumerator.hasMoreElements()) { var domWindow = enumerator.getNext(); if (("tryToClose" in domWindow) && !domWindow.tryToClose()) { return false; } domWindow.close(); }  
context: function goQuitApplication(){  const privs = 'UniversalXPConnect';  try  {    netscape.security.PrivilegeManager.enablePrivilege(privs);  }  catch(ex)  {    throw('goQuitApplication: privilege failure ' + ex);  }  if (!canQuitApplication())  {    return false;  }    // shut down cross-domain mapping (really reverts preference values)  if (typeof crossDomain != "undefined")    crossDomain.disable();  const kAppStartup = '@mozilla.org/toolkit/app-startup;1';  const kAppShell   = '@mozilla.org/appshell/appShellService;1';  var   appService;  var   forceQuit;  if (kAppStartup in Components.classes)  {    appService = Components.classes[kAppStartup].      getService(Components.interfaces.nsIAppStartup);    forceQuit  = Components.interfaces.nsIAppStartup.eForceQuit;  }  else if (kAppShell in Components.classes)  {    appService = Components.classes[kAppShell].      getService(Components.interfaces.nsIAppShellService);    forceQuit = Components.interfaces.nsIAppShellService.eForceQuit;  }  else  {    throw 'goQuitApplication: no AppStartup/appShell';  }  var windowManager = Components.    classes['@mozilla.org/appshell/window-mediator;1'].getService();  var windowManagerInterface = windowManager.    QueryInterface(Components.interfaces.nsIWindowMediator);  var enumerator = windowManagerInterface.getEnumerator(null);  while (enumerator.hasMoreElements())  {    var domWindow = enumerator.getNext();    if (("tryToClose" in domWindow) && !domWindow.tryToClose())    {      return false;    }    domWindow.close();  }  try  {    appService.quit(forceQuit);  }  catch(ex)  {    throw('goQuitApplication: ' + ex);  }  return true;}
meta: 8395	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/8395/09aeed6d3936774d55ecb969a7d76e81306e995d/quit.js/clean/testing/mochitest/tests/SimpleTest/quit.js