state->mValues.Put(value);
state->PutOption(optIndex, value);
nsHTMLSelectElement::SaveState(){  nsSelectState* state = new nsSelectState();  if (!state) {    return NS_ERROR_OUT_OF_MEMORY;  }  NS_ADDREF(state);  PRUint32 len;  GetLength(&len);  for (PRUint32 optIndex = 0; optIndex < len; optIndex++) {    nsCOMPtr<nsIDOMHTMLOptionElement> option;    mOptions->ItemAsOption(optIndex, getter_AddRefs(option));    if (option) {      PRBool isSelected;      option->GetSelected(&isSelected);      if (isSelected) {        nsAutoString value;        option->GetValue(value);        state->mValues.Put(value);      }    }  }  nsCOMPtr<nsIPresState> presState;  nsresult rv = GetPrimaryPresState(this, getter_AddRefs(presState));  if (presState) {    rv = presState->SetStatePropertyAsSupports(NS_LITERAL_STRING("selecteditems"),                                           state);    NS_ASSERTION(NS_SUCCEEDED(rv), "selecteditems set failed!");  }  NS_RELEASE(state);  return rv;}