for (PRInt32 i=0; i < mNumOptions; i++) SetOptionSelected(i, PR_FALSE); SetOptionSelected(selectedIndex, PR_TRUE);
for (PRInt32 i=0; i < mNumOptions; i++) SetOptionSelectedCache(i, PR_FALSE); SetOptionSelectedCache(selectedIndex, PR_TRUE);
NS_IMETHODIMP nsNativeSelectControlFrame::SetProperty(nsIAtom* aName, const nsString& aValue){  if (nsHTMLAtoms::selected == aName) {    return NS_ERROR_INVALID_ARG; // Selected is readonly according to spec.  } else if (nsHTMLAtoms::selectedindex == aName) {    PRInt32 error = 0;    PRInt32 selectedIndex = aValue.ToInteger(&error, 10); // Get index from aValue    if (error)      return NS_ERROR_INVALID_ARG; // Couldn't convert to integer    // Update local cache of selected values    for (PRInt32 i=0; i < mNumOptions; i++)      SetOptionSelected(i, PR_FALSE);    SetOptionSelected(selectedIndex, PR_TRUE);    // Update widget    nsIListWidget* listWidget;    nsresult result = mWidget->QueryInterface(kListWidgetIID, (void **) &listWidget);    if ((NS_OK == result) && (nsnull != listWidget)) {      listWidget->Deselect();      listWidget->SelectItem(selectedIndex);      NS_RELEASE(listWidget);    }  } else {    return Inherited::SetProperty(aName, aValue);  }  return NS_OK;}