return rv;
if (curlen && (curlen > aLength)) { for (i = (curlen - 1); (i >= (PRInt32)aLength) && NS_SUCCEEDED(rv); i--) { rv = Remove(i); } } else if (aLength) {  nsCOMPtr<nsINodeInfo> nodeInfo;  nsContentUtils::NameChanged(mNodeInfo, nsHTMLAtoms::option, getter_AddRefs(nodeInfo));  nsCOMPtr<nsIHTMLContent> element = NS_NewHTMLOptionElement(nodeInfo); if (!element) { return NS_ERROR_OUT_OF_MEMORY; }  nsCOMPtr<nsITextContent> text; rv = NS_NewTextNode(getter_AddRefs(text)); NS_ENSURE_SUCCESS(rv, rv);  rv = element->AppendChildTo(text, PR_FALSE, PR_FALSE); NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIDOMNode> node(do_QueryInterface(element));  for (i = curlen; i < (PRInt32)aLength; i++) { nsCOMPtr<nsIDOMNode> tmpNode;  rv = AppendChild(node, getter_AddRefs(tmpNode)); NS_ENSURE_SUCCESS(rv, rv);  if (i < ((PRInt32)aLength - 1)) { nsCOMPtr<nsIDOMNode> newNode;  rv = node->CloneNode(PR_TRUE, getter_AddRefs(newNode)); NS_ENSURE_SUCCESS(rv, rv);  node = newNode; } } }  return NS_OK;
nsHTMLOptionCollection::SetLength(PRUint32 aLength){  nsresult rv = NS_ERROR_UNEXPECTED;  if (mSelect) {    rv = mSelect->SetLength(aLength);  }  return rv;}