nsresult result = NS_ERROR_UNEXPECTED; if (mSelect) { if (mDirty) { GetOptions(); } result = mSelect->SetSelectedIndex(aSelectedIndex);
nsIFormControlFrame* formControlFrame = nsnull; if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { nsString value; value.AppendInt(aIndex, 10); nsIPresContext* presContext; nsGenericHTMLElement::GetPresContext(this, &presContext); formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value); NS_IF_RELEASE(presContext); } else { SetOptionSelectedByIndex(aIndex, PR_TRUE);
nsHTMLOptionCollection::SetSelectedIndex(PRInt32 aSelectedIndex){  nsresult result = NS_ERROR_UNEXPECTED;  if (mSelect) {    if (mDirty) {      GetOptions();    }    result = mSelect->SetSelectedIndex(aSelectedIndex);  }  return result;}