text->SetDocument(doc, PR_FALSE);
text->SetDocument(doc, PR_FALSE, PR_TRUE);
nsHTMLOptionElement::SetText(const nsString& aText){  PRInt32 numNodes;  PRBool usedExistingTextNode = PR_FALSE;  // Do we need to create a text node?  nsresult result = mInner.ChildCount(numNodes);  if (NS_FAILED(result)) {    return result;  }  for (PRInt32 i = 0; i < numNodes; i++) {    nsIContent * node = nsnull;    result = ChildAt(i, node);    if (NS_SUCCEEDED(result) && node) {      nsCOMPtr<nsIDOMText> domText;      result = node->QueryInterface(kIDOMTextIID, (void**)getter_AddRefs(domText));      if (NS_SUCCEEDED(result) && domText) {        result = domText->SetData(aText);        if (NS_SUCCEEDED(result)) {          usedExistingTextNode = PR_TRUE;        }        NS_RELEASE(node);        break;      }      NS_RELEASE(node);    }  }  if (!usedExistingTextNode) {    nsCOMPtr<nsIContent> text;    result = NS_NewTextNode(getter_AddRefs(text));    if (NS_OK == result) {      nsIDOMText* domtext;      result = text->QueryInterface(kIDOMTextIID, (void**)&domtext);      if (NS_SUCCEEDED(result) && domtext) {        result = domtext->SetData(aText);	      if (NS_SUCCEEDED(result)) {          result = AppendChildTo(text, PR_TRUE);          if (NS_SUCCEEDED(result)) {            nsIDocument * doc;            result = GetDocument(doc);            if (NS_SUCCEEDED(result)) {              text->SetDocument(doc, PR_FALSE);              NS_IF_RELEASE(doc);            }          }        }        NS_RELEASE(domtext);      }    }  }  if (NS_SUCCEEDED(result)) {    nsIFormControlFrame* fcFrame = nsnull;    result = GetPrimaryFrame(fcFrame);    if (NS_SUCCEEDED(result) && (nsnull != fcFrame)) {      nsIComboboxControlFrame* selectFrame = nsnull;      result = fcFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame),(void **) &selectFrame);      if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) {        selectFrame->UpdateSelection(PR_FALSE, PR_TRUE, 0);      }    }  }  return NS_OK;}