if (NS_FAILED(rv = child->GetTag(*getter_AddRefs(tag)))) return rv;
if (NS_FAILED(rv = child->GetTag(getter_AddRefs(tag)))) return rv;
XULSortServiceImpl::SetSortColumnHints(nsIContent *content, const nsAString &sortResource, const nsAString &sortDirection){  PRInt32 numChildren, childIndex, nameSpaceID;  nsCOMPtr<nsIContent> child;  nsresult rv;  if (NS_FAILED(rv = content->ChildCount(numChildren))) return rv;    for (childIndex = 0; childIndex < numChildren; ++childIndex) {    if (NS_FAILED(rv = content->ChildAt(childIndex, *getter_AddRefs(child)))) return rv;    if (NS_FAILED(rv = child->GetNameSpaceID(nameSpaceID))) return rv;        if (nameSpaceID == kNameSpaceID_XUL) {      nsCOMPtr<nsIAtom> tag;      if (NS_FAILED(rv = child->GetTag(*getter_AddRefs(tag)))) return rv;              if (tag == nsXULAtoms::treecols || tag == nsXULAtoms::listcols || tag == nsXULAtoms::listhead) {        rv = SetSortColumnHints(child, sortResource, sortDirection);      } else if (tag == nsXULAtoms::treecol ||                 tag == nsXULAtoms::listcol || tag == nsXULAtoms::listheader) {        nsAutoString value;        if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, nsXULAtoms::resource, value))            && rv == NS_CONTENT_ATTR_HAS_VALUE)        {          if (value == sortResource) {            child->SetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, *kTrueStr, PR_TRUE);            child->SetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection, sortDirection, PR_TRUE);            // Note: don't break out of loop; want to set/unset attribs on ALL sort columns          } else {            child->UnsetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, PR_TRUE);            child->UnsetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection, PR_TRUE);          }        }      }    }  }    return NS_OK;}