PRInt32 type; GetType(&type); if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type || NS_FORM_INPUT_FILE == type) { if (NS_FORM_INPUT_FILE == type) { nsresult result; nsCOMPtr<nsIScriptSecurityManager> securityManager = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &result); if (NS_FAILED(result)) return result;  PRBool enabled;  result = securityManager->IsCapabilityEnabled("UniversalFileRead", &enabled);  if (NS_FAILED(result)) { return result; }  if (!enabled) {   return NS_ERROR_DOM_SECURITY_ERR; } }  nsIFormControlFrame* formControlFrame = nsnull;  if (NS_SUCCEEDED(GetPrimaryFrame(this, formControlFrame))) { if (formControlFrame ) { nsIPresContext* presContext; GetPresContext(this, &presContext); formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue); NS_IF_RELEASE(presContext); } } else {  nsCOMPtr<nsIPresState> presState; GetPrimaryPresState(this, getter_AddRefs(presState));   if (presState) { presState->SetStateProperty(NS_LITERAL_STRING("value"), aValue); } } return NS_OK; }   return nsGenericHTMLLeafFormElement::SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::value, aValue, PR_TRUE);
return SetValueSecure(aValue, PR_TRUE);
nsHTMLInputElement::SetValue(const nsAReadableString& aValue){  PRInt32 type;  GetType(&type);  if (NS_FORM_INPUT_TEXT == type || NS_FORM_INPUT_PASSWORD == type ||      NS_FORM_INPUT_FILE == type) {    if (NS_FORM_INPUT_FILE == type) {      nsresult result;      nsCOMPtr<nsIScriptSecurityManager> securityManager =                do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &result);      if (NS_FAILED(result))         return result;      PRBool enabled;      result = securityManager->IsCapabilityEnabled("UniversalFileRead",                                                    &enabled);      if (NS_FAILED(result)) {        return result;      }      if (!enabled) {        // setting the value of a "FILE" input widget requires the        // UniversalFileRead privilege        return NS_ERROR_DOM_SECURITY_ERR;      }    }    nsIFormControlFrame* formControlFrame = nsnull;    if (NS_SUCCEEDED(GetPrimaryFrame(this, formControlFrame))) {      if (formControlFrame ) {         nsIPresContext* presContext;        GetPresContext(this, &presContext);        formControlFrame->SetProperty(presContext, nsHTMLAtoms::value, aValue);        NS_IF_RELEASE(presContext);      }    }    else {      // Retrieve the presentation state instead.      nsCOMPtr<nsIPresState> presState;      GetPrimaryPresState(this, getter_AddRefs(presState));      // Obtain the value property from the presentation state.      if (presState) {        presState->SetStateProperty(NS_LITERAL_STRING("value"), aValue);      }    }    return NS_OK;  }  // Treat value == defaultValue for other input elements.  return nsGenericHTMLLeafFormElement::SetAttr(kNameSpaceID_HTML,                                               nsHTMLAtoms::value,                                               aValue, PR_TRUE);}