res = registry->GetSubtree(nsIRegistry::Common, aRegistryKey, &uconvKey); if (NS_FAILED(res)) return res;   res = registry->EnumerateSubtrees(uconvKey, getter_AddRefs(components)); if (NS_FAILED(res)) return res; res = components->First(); if (NS_FAILED(res)) return res;   res = NS_NewISupportsArray(&mBundle); if (NS_FAILED(res)) return res;  while (NS_OK != components->IsDone()) { nsCOMPtr<nsISupports> base; nsCOMPtr<nsIRegistryNode> node; nsXPIDLCString name; nsCOMPtr<nsIStringBundle> bundle;  res = components->CurrentItem(getter_AddRefs(base)); if (NS_FAILED(res)) return res;  node = do_QueryInterface(base, &res); if (NS_FAILED(res)) { res = components->Next(); if (NS_FAILED(res)) return res; continue; }  res = node->GetKey(&key); if (NS_FAILED(res)) return res;  res = registry->GetStringUTF8(key, "name", getter_Copies(name)); if (NS_FAILED(res)) return res;  res = sbServ->CreateBundle(name, getter_AddRefs(bundle)); if (NS_FAILED(res)) { res = components->Next(); if (NS_FAILED(res)) return res; continue; }  res = mBundle->AppendElement(bundle); if (NS_FAILED(res)) return res;  res = components->Next(); if (NS_FAILED(res)) return res; }  return res;
return rv;
nsExtensibleStringBundle::Init(const char * aRegistryKey) {  nsresult res = NS_OK;  nsCOMPtr<nsIEnumerator> components;  nsRegistryKey uconvKey, key;  PRBool regOpen = PR_FALSE;  // get the Bundle Service  nsCOMPtr<nsIStringBundleService> sbServ(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &res));  if (NS_FAILED(res)) return res;  // get the registry  nsCOMPtr<nsIRegistry> registry(do_GetService(NS_REGISTRY_CONTRACTID, &res));  if (NS_FAILED(res)) return res;  // open registry if necessary  registry->IsOpen(&regOpen);  if (!regOpen) {    res = registry->OpenWellKnownRegistry(nsIRegistry::ApplicationComponentRegistry);    if (NS_FAILED(res)) return res;  }  // get subtree  res = registry->GetSubtree(nsIRegistry::Common,      aRegistryKey, &uconvKey);  if (NS_FAILED(res)) return res;  // enumerate subtrees  res = registry->EnumerateSubtrees(uconvKey, getter_AddRefs(components));  if (NS_FAILED(res)) return res;  res = components->First();  if (NS_FAILED(res)) return res;  // create the bundles array  res = NS_NewISupportsArray(&mBundle);  if (NS_FAILED(res)) return res;  while (NS_OK != components->IsDone()) {    nsCOMPtr<nsISupports> base;    nsCOMPtr<nsIRegistryNode> node;    nsXPIDLCString name;    nsCOMPtr<nsIStringBundle> bundle;    res = components->CurrentItem(getter_AddRefs(base));    if (NS_FAILED(res)) return res;    node = do_QueryInterface(base, &res);    if (NS_FAILED(res)) {      res = components->Next();      if (NS_FAILED(res)) return res;      continue;    }    res = node->GetKey(&key);    if (NS_FAILED(res)) return res;    res = registry->GetStringUTF8(key, "name", getter_Copies(name));    if (NS_FAILED(res)) return res;    res = sbServ->CreateBundle(name, getter_AddRefs(bundle));    if (NS_FAILED(res)) {      res = components->Next();      if (NS_FAILED(res)) return res;      continue;    }    res = mBundle->AppendElement(bundle);    if (NS_FAILED(res)) return res;    res = components->Next();    if (NS_FAILED(res)) return res;  }  return res;}