PRInt32 childType; child->GetItemType(&childType);
NS_IMETHODIMP nsWebShell::FindChildWithName(const PRUnichar *aName, nsIDocShellTreeItem **_retval){   NS_ENSURE_ARG(aName);   NS_ENSURE_ARG_POINTER(_retval);     *_retval = nsnull;  // if we don't find one, we return NS_OK and a null result    nsAutoString name(aName);   nsXPIDLString childName;   PRInt32 i, n = mChildren.Count();   for (i = 0; i < n; i++)       {      nsIDocShellTreeItem* child = (nsIDocShellTreeItem*) mChildren.ElementAt(i); // doesn't addref the result      NS_ENSURE_TRUE(child, NS_ERROR_FAILURE);      child->GetName(getter_Copies(childName));      if(name.Equals(childName))         {         *_retval = child;         NS_ADDREF(child);         break;         }      PRInt32 childType;      child->GetItemType(&childType);      if(childType == mItemType) //Only ask it to check children if it is same type         {         // See if child contains the shell with the given name         nsCOMPtr<nsIDocShellTreeNode> childAsNode = do_QueryInterface(child);         if(child)            {            NS_ENSURE_SUCCESS(childAsNode->FindChildWithName(name.GetUnicode(), _retval), NS_ERROR_FAILURE);            }         }      if (*_retval)   // found it         break;      }  return NS_OK;}