if (!mOptions) return NS_OK;   mOptions->AddOption(aContent);   nsIFormControlFrame* fcFrame = nsnull; nsresult result = nsGenericHTMLElement::GetPrimaryFrame(this, fcFrame, PR_FALSE); if (NS_SUCCEEDED(result) && (nsnull != fcFrame)) { nsISelectControlFrame* selectFrame = nsnull; result = fcFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame),(void **) &selectFrame); if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) { nsIPresContext* presContext; nsGenericHTMLElement::GetPresContext(this, &presContext); result = selectFrame->AddOption(presContext, mOptions->IndexOf(aContent)); NS_IF_RELEASE(presContext); } }  return result;
mDirty = PR_TRUE;
nsHTMLSelectElement::AddOption(nsIContent* aContent){  // When first populating the select, this will be null but that's ok  // as we will manually update the widget at frame construction time.  if (!mOptions) return NS_OK;  // Add the option to the option list.  mOptions->AddOption(aContent);  // Update the widget  nsIFormControlFrame* fcFrame = nsnull;  nsresult result = nsGenericHTMLElement::GetPrimaryFrame(this, fcFrame, PR_FALSE);  if (NS_SUCCEEDED(result) && (nsnull != fcFrame)) {    nsISelectControlFrame* selectFrame = nsnull;    result = fcFrame->QueryInterface(NS_GET_IID(nsISelectControlFrame),(void **) &selectFrame);    if (NS_SUCCEEDED(result) && (nsnull != selectFrame)) {      nsIPresContext* presContext;      nsGenericHTMLElement::GetPresContext(this, &presContext);      result = selectFrame->AddOption(presContext, mOptions->IndexOf(aContent));      NS_IF_RELEASE(presContext);    }  }    return result;}