if (NS_SUCCEEDED(result)) {   nsIFormControlFrame* fcFrame = GetSelectFrame();  if (fcFrame) { nsISelectControlFrame* selectFrame = nsnull;  CallQueryInterface(fcFrame, &selectFrame);  if (selectFrame) { selectFrame->OnOptionTextChanged(this); } } }
nsHTMLOptionElement::SetText(const nsAString& aText){  PRInt32 numNodes, i;  PRBool usedExistingTextNode = PR_FALSE;  // Do we need to create a text node?  nsresult result = ChildCount(numNodes);  if (NS_FAILED(result)) {    return result;  }  for (i = 0; i < numNodes; i++) {    nsCOMPtr<nsIContent> node;    ChildAt(i, *getter_AddRefs(node));    if (node) {      nsCOMPtr<nsIDOMText> domText(do_QueryInterface(node));      if (domText) {        result = domText->SetData(aText);        if (NS_SUCCEEDED(result)) {          usedExistingTextNode = PR_TRUE;        }        break;      }    }  }  if (!usedExistingTextNode) {    nsCOMPtr<nsIContent> text;    result = NS_NewTextNode(getter_AddRefs(text));    if (NS_OK == result) {      nsCOMPtr<nsIDOMText> domtext(do_QueryInterface(text));      if (domtext) {        result = domtext->SetData(aText);	    if (NS_SUCCEEDED(result)) {          result = AppendChildTo(text, PR_TRUE, PR_FALSE);          if (NS_SUCCEEDED(result)) {            nsCOMPtr<nsIDocument> doc;            result = GetDocument(*getter_AddRefs(doc));            if (NS_SUCCEEDED(result)) {              text->SetDocument(doc, PR_FALSE, PR_TRUE);            }          }        }      }    }  }  if (NS_SUCCEEDED(result)) {    // No need to flush here, if there's no frame yet we don't need to    // force it to be created just to update the selection in it.    nsIFormControlFrame* fcFrame = GetSelectFrame();    if (fcFrame) {      nsISelectControlFrame* selectFrame = nsnull;      CallQueryInterface(fcFrame, &selectFrame);      if (selectFrame) {        selectFrame->OnOptionTextChanged(this);      }    }  }  return NS_OK;}