profileMgr->ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST);
profileMgr->ShutDownCurrentProfile(0);
static nsresult DoOnShutdown(){  nsresult rv;  // save the prefs, in case they weren't saved  {    // scoping this in a block to force release    nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv));    NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get prefs, so unable to save them");    if (NS_SUCCEEDED(rv))      prefs->SavePrefFile(nsnull);  }  // call ShutDownCurrentProfile() so we update the last modified time of the profile  {    // scoping this in a block to force release    nsCOMPtr<nsIProfile> profileMgr(do_GetService(NS_PROFILE_CONTRACTID, &rv));    NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get profile manager, so unable to update last modified time");    if (NS_SUCCEEDED(rv)) {      profileMgr->ShutDownCurrentProfile(nsIProfile::SHUTDOWN_PERSIST);    }  }  // at this point, all that is on the clipboard is a proxy object, but that object  // won't be valid once the app goes away. As a result, we need to force the data  // out of that proxy and properly onto the clipboard. This can't be done in the  // clipboard service's shutdown routine because it requires the parser/etc which  // has already been shutdown by the time the clipboard is shut down.  {    // scoping this in a block to force release    nsCOMPtr<nsIClipboard> clipService(do_GetService("@mozilla.org/widget/clipboard;1", &rv));    if (NS_SUCCEEDED(rv))      clipService->ForceDataToClipboard(nsIClipboard::kGlobalClipboard);  }  return rv;}