res = InitStaticMenu(rdfServ, ccMan, pref, decs, kNC_MailviewCharsetMenuRoot, kMailviewStaticPrefKey, &mMailviewMenu); NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview static charset menu");
res = InitCacheMenu(mailviewDecoderList, kNC_MailviewCharsetMenuRoot, kMailviewCachePrefKey, &mMailviewMenu); NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview cache charset menu"); }
nsresult nsCharsetMenu::InitMailviewMenu() {  nsresult res = NS_OK;  NS_WITH_SERVICE(nsIRDFService, rdfServ, kRDFServiceCID, &res);  if (NS_FAILED(res)) return res;  NS_WITH_SERVICE(nsICharsetConverterManager2, ccMan, kCharsetConverterManagerCID, &res);  if (NS_FAILED(res)) return res;  nsCOMPtr<nsISupportsArray> decs;  res = ccMan->GetDecoderList(getter_AddRefs(decs));  if (NS_FAILED(res)) return res;  NS_WITH_SERVICE(nsIPref, pref, NS_PREF_PROGID, &res);  if (NS_FAILED(res)) return res;  nsCOMPtr<nsIRDFContainer> container;  res = NewRDFContainer(mInner, kNC_MailviewCharsetMenuRoot, getter_AddRefs(container));  if (NS_FAILED(res)) return res;  // even if we fail, the show must go on  res = InitStaticMenu(rdfServ, ccMan, pref, decs,       kNC_MailviewCharsetMenuRoot, kMailviewStaticPrefKey, &mMailviewMenu);  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview static charset menu");  // mark the end of the static area, the rest is cache  mMailviewCacheStart = mMailviewMenu.Count();  pref->GetIntPref(kMailviewCacheSizePrefKey, &mMailviewCacheSize);  // compute the position of the menu in the RDF container  res = container->GetCount(&mMailviewMenuRDFPosition);  if (NS_FAILED(res)) return res;  // this "1" here is a correction necessary because the RDF container   // elements are numbered from 1 (why god, WHY?!?!?!)  mMailviewMenuRDFPosition -= mMailviewCacheStart - 1;  res = InitCacheMenu(rdfServ, ccMan, pref, decs, kNC_MailviewCharsetMenuRoot,     kMailviewCachePrefKey, &mMailviewMenu);  NS_ASSERTION(NS_SUCCEEDED(res), "error initializing mailview cache charset menu");  // register prefs callback  pref->RegisterCallback(kMailviewStaticPrefKey, MailviewStaticChanged, this);  return res;}