nsCOMPtr<nsIAtom> tag; if (NS_FAILED(rv = aRoot->GetTag(getter_AddRefs(tag))))  return rv;
nsIAtom *tag = aRoot->Tag();
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;  }  PRUint32 numChildren = aRoot->GetChildCount();  for (PRUint32 childIndex = 0; childIndex < numChildren; childIndex++) {    nsIContent *child = aRoot->GetChildAt(childIndex);    if (child->IsContentOfType(nsIContent::eXUL)) {      rv = FindSortableContainer(child, aContainer);      if (*aContainer)        return rv;    }  }  return NS_ERROR_FAILURE;}