if (JSVAL_IS_INT(aID) && mOptions) { res = mOptions->SetProperty(aContext, aObj, aID, aVp); } else { res = nsGenericHTMLContainerFormElement::SetProperty(aContext, aObj, aID, aVp);
if (JSVAL_IS_INT(aID) && mSelect) { PRInt32 indx = JSVAL_TO_INT(aID); nsresult result;   if (mDirty) { GetOptions(); }  PRInt32 length = mElements.Count();   if ((indx >= 0) && (indx <= length)) {  if (!JSVAL_IS_OBJECT(*aVp) && !JS_ConvertValue(aContext, *aVp, JSTYPE_OBJECT, aVp)) { return PR_FALSE; }   if (JSVAL_IS_NULL(*aVp)) { mSelect->Remove(indx);    return PR_TRUE; }  JSObject* jsobj = JSVAL_TO_OBJECT(*aVp); JSClass* jsclass = JS_GetClass(aContext, jsobj);  if (jsclass && !((~jsclass->flags) & (JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS))) { nsISupports *supports = (nsISupports *)JS_GetPrivate(aContext, jsobj);  nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(supports)); nsCOMPtr<nsIDOMNode> ret;  if (option) { if (indx == length) { result = mSelect->AppendChild(option, getter_AddRefs(ret)); } else { nsIDOMNode *refChild = (nsIDOMNode*)mElements.ElementAt(indx); if (refChild) { nsCOMPtr<nsIDOMNode> parent;  refChild->GetParentNode(getter_AddRefs(parent));  if (parent) { parent->ReplaceChild(option, refChild, getter_AddRefs(ret)); } } } } } }
nsHTMLSelectElement::SetProperty(JSContext *aContext, JSObject *aObj,                                 jsval aID, jsval *aVp){  nsresult res = NS_OK;  // Set options in the options list by indexing into select  if (JSVAL_IS_INT(aID) && mOptions) {    res = mOptions->SetProperty(aContext, aObj, aID, aVp);  } else {    res = nsGenericHTMLContainerFormElement::SetProperty(aContext, aObj, aID,                                                         aVp);  }  return res;}