rv = observerService->AddObserver(gFontCleanupObserver, NS_LITERAL_STRING(NS_XPCOM_SHUTDOWN_OBSERVER_ID).get());
rv = observerService->AddObserver(gFontCleanupObserver, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
InitGlobals(void){  nsServiceManager::GetService(kCharsetConverterManagerCID,    NS_GET_IID(nsICharsetConverterManager2), (nsISupports**) &gCharsetManager);  if (!gCharsetManager) {    FreeGlobals();    return NS_ERROR_FAILURE;  }  nsServiceManager::GetService(kPrefCID, NS_GET_IID(nsIPref),    (nsISupports**) &gPref);  if (!gPref) {    FreeGlobals();    return NS_ERROR_FAILURE;  }  nsCOMPtr<nsILanguageAtomService> langService;  langService = do_GetService(NS_LANGUAGEATOMSERVICE_CONTRACTID);  if (langService) {    langService->GetLocaleLanguageGroup(&gUsersLocale);  }  if (!gUsersLocale) {    gUsersLocale = NS_NewAtom("x-western");  }  if (!gUsersLocale) {    FreeGlobals();    return NS_ERROR_OUT_OF_MEMORY;  }  gUserDefined = NS_NewAtom(USER_DEFINED);  if (!gUserDefined) {    FreeGlobals();    return NS_ERROR_OUT_OF_MEMORY;  }  gJA = NS_NewAtom("ja");  if (!gJA) {    FreeGlobals();    return NS_ERROR_OUT_OF_MEMORY;  }  gKO = NS_NewAtom("ko");  if (!gKO) {    FreeGlobals();    return NS_ERROR_OUT_OF_MEMORY;  }  gZHCN = NS_NewAtom("zh-CN");  if (!gZHCN) {    FreeGlobals();    return NS_ERROR_OUT_OF_MEMORY;  }  gZHTW = NS_NewAtom("zh-TW");  if (!gZHTW) {    FreeGlobals();    return NS_ERROR_OUT_OF_MEMORY;  }  //register an observer to take care of cleanup  gFontCleanupObserver = new nsFontCleanupObserver();  NS_ASSERTION(gFontCleanupObserver, "failed to create observer");  if (gFontCleanupObserver) {    // register for shutdown    nsresult rv;    nsCOMPtr<nsIObserverService> observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv));    if (NS_SUCCEEDED(rv)) {      rv = observerService->AddObserver(gFontCleanupObserver, NS_LITERAL_STRING(NS_XPCOM_SHUTDOWN_OBSERVER_ID).get());    }      }    gInitialized = 1;  return NS_OK;}