if (NS_SUCCEEDED(rv) && selectedIndex > -1) { nsCOMPtr<nsIDOMNode> node;
result = GetOptions(getter_AddRefs(options)); if (NS_SUCCEEDED(result)) { nsCOMPtr<nsIDOMNode> node; if (selectedIndex == -1) { selectedIndex = 0; } result = options->Item(selectedIndex, getter_AddRefs(node)); if (NS_SUCCEEDED(result) && node) { nsCOMPtr<nsIHTMLContent> option = do_QueryInterface(node); if (option) { nsHTMLValue value;  nsresult rv = option->GetHTMLAttribute(nsHTMLAtoms::value, value); if (NS_CONTENT_ATTR_HAS_VALUE == rv) { if (eHTMLUnit_String == value.GetUnit()) { value.GetStringValue(aValue); } else { aValue.SetLength(0); } return NS_OK; }
nsHTMLSelectElement::GetValue(nsAString& aValue){  PRInt32 selectedIndex;  nsresult rv = GetSelectedIndex(&selectedIndex);  if (NS_SUCCEEDED(rv) && selectedIndex > -1) {    nsCOMPtr<nsIDOMNode> node;    rv = Item(selectedIndex, getter_AddRefs(node));    nsCOMPtr<nsIDOMHTMLOptionElement> option = do_QueryInterface(node);    if (NS_SUCCEEDED(rv) && option) {      return option->GetValue(aValue);    }  }  aValue.Truncate(0);  return rv;}