rv = windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator));
mWindowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator)); if (windowEnumerator) windowEnumerator->HasMoreElements(&windowsRemain); } if (!windowsRemain) { aFerocity = eAttemptQuit;
nsAppShellService::Quit(){  // Quit the application. We will asynchronously call the appshell's  // Exit() method via the ExitCallback() to allow one last pass  // through any events in the queue. This guarantees a tidy cleanup.  if (! mShutdownTimer) {    // Only set the shutdown timer if it hasn't already been set.    nsresult rv;    rv = NS_NewTimer(getter_AddRefs(mShutdownTimer));    if (NS_FAILED(rv)) return rv;    // Enumerate through each open window and close it    NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv);    if (NS_SUCCEEDED(rv)) {      nsCOMPtr<nsISimpleEnumerator> windowEnumerator;      rv = windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator));      if (NS_SUCCEEDED(rv)) {        PRBool more;        while (1) {          rv = windowEnumerator->HasMoreElements(&more);          if (NS_FAILED(rv) || !more)            break;          nsCOMPtr<nsISupports> isupports;          rv = windowEnumerator->GetNext(getter_AddRefs(isupports));          if (NS_FAILED(rv))            break;          nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(isupports);          NS_ASSERTION(window != nsnull, "not an nsIDOMWindow");          if (! window)            continue;          window->Close();        }      }    }    // Note that we don't allow any premature returns from the above    // loop: no matter what, make sure we set the callback timer.  If    // worst comes to worst, we'll do a leaky shutdown but we WILL    // shut down.    rv = mShutdownTimer->Init(ExitCallback, this, 0);    if (NS_FAILED(rv)) return rv;  }  return NS_OK;}