if (NS_FAILED(rv = aRoot->GetTag(*getter_AddRefs(tag))))  return rv;
if (NS_FAILED(rv = aRoot->GetTag(getter_AddRefs(tag))))  return rv;
XULSortServiceImpl::FindSortableContainer(nsIContent *aRoot, nsIContent **aContainer){  nsresult rv;  nsCOMPtr<nsIAtom> tag;  if (NS_FAILED(rv = aRoot->GetTag(*getter_AddRefs(tag))))  return rv;  if (tag == nsXULAtoms::templateAtom) // ignore content within templates    return NS_OK;      if (tag == nsXULAtoms::listbox || tag == nsXULAtoms::treechildren || tag == nsXULAtoms::menupopup)  {    *aContainer = aRoot;    NS_ADDREF(*aContainer);    return NS_OK;  }  nsCOMPtr<nsIContent> child;  PRInt32 childIndex = 0, numChildren = 0, nameSpaceID;  if (NS_FAILED(rv = aRoot->ChildCount(numChildren))) return rv;  for (childIndex = 0; childIndex < numChildren; childIndex++) {    if (NS_FAILED(rv = aRoot->ChildAt(childIndex, *getter_AddRefs(child)))) return rv;    if (NS_FAILED(rv = child->GetNameSpaceID(nameSpaceID)))  return rv;    if (nameSpaceID == kNameSpaceID_XUL) {      rv = FindSortableContainer(child, aContainer);      if (*aContainer)        return rv;    }  }  return NS_ERROR_FAILURE;}