NS_WITH_SERVICE(nsIWindowMediator, windowMediator, kWindowMediatorCID, &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr<nsISimpleEnumerator> windowEnumerator;  if (NS_SUCCEEDED(windowMediator->GetEnumerator(nsnull, getter_AddRefs(windowEnumerator)))) { PRBool more;   windowEnumerator->HasMoreElements(&more); while (more) { nsCOMPtr<nsISupports> protoWindow; rv = windowEnumerator->GetNext(getter_AddRefs(protoWindow)); if (NS_SUCCEEDED(rv) && protoWindow) { nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(protoWindow)); if (window) window->Close(); } windowEnumerator->HasMoreElements(&more); } } } #endif
nsAppShellService::Shutdown(void){  // Shutdown all components.  EnumerateComponents(&nsAppShellService::ShutdownComponent);  return NS_OK;}