case HTMLIMAGEELEMENT_BORDER: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_BORDER, PR_TRUE); if (NS_SUCCEEDED(rv)) { nsAutoString prop; nsJSUtils::nsConvertJSValToString(prop, cx, *vp);  rv = a->SetBorder(prop);  } break; } case HTMLIMAGEELEMENT_HEIGHT: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HEIGHT, PR_TRUE); if (NS_SUCCEEDED(rv)) { nsAutoString prop; nsJSUtils::nsConvertJSValToString(prop, cx, *vp);  rv = a->SetHeight(prop);  } break; } case HTMLIMAGEELEMENT_HSPACE: { rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HSPACE, PR_TRUE); if (NS_SUCCEEDED(rv)) { nsAutoString prop; nsJSUtils::nsConvertJSValToString(prop, cx, *vp);  rv = a->SetHspace(prop);  } break; }
SetHTMLImageElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp){  nsIDOMHTMLImageElement *a = (nsIDOMHTMLImageElement*)nsJSUtils::nsGetNativeThis(cx, obj);  // If there's no private data, this must be the prototype, so ignore  if (nsnull == a) {    return JS_TRUE;  }  nsresult rv = NS_OK;  if (JSVAL_IS_INT(id)) {    nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);    if (!secMan)        return PR_FALSE;    switch(JSVAL_TO_INT(id)) {      case HTMLIMAGEELEMENT_LOWSRC:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LOWSRC, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetLowSrc(prop);                  }        break;      }      case HTMLIMAGEELEMENT_NAME:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_NAME, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetName(prop);                  }        break;      }      case HTMLIMAGEELEMENT_ALIGN:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALIGN, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetAlign(prop);                  }        break;      }      case HTMLIMAGEELEMENT_ALT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALT, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetAlt(prop);                  }        break;      }      case HTMLIMAGEELEMENT_BORDER:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_BORDER, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetBorder(prop);                  }        break;      }      case HTMLIMAGEELEMENT_HEIGHT:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HEIGHT, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetHeight(prop);                  }        break;      }      case HTMLIMAGEELEMENT_HSPACE:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HSPACE, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetHspace(prop);                  }        break;      }      case HTMLIMAGEELEMENT_ISMAP:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ISMAP, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          PRBool prop;          if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {            rv = NS_ERROR_DOM_NOT_BOOLEAN_ERR;            break;          }                rv = a->SetIsMap(prop);                  }        break;      }      case HTMLIMAGEELEMENT_LONGDESC:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LONGDESC, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetLongDesc(prop);                  }        break;      }      case HTMLIMAGEELEMENT_USEMAP:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_USEMAP, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetUseMap(prop);                  }        break;      }      case HTMLIMAGEELEMENT_VSPACE:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_VSPACE, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetVspace(prop);                  }        break;      }      case HTMLIMAGEELEMENT_WIDTH:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_WIDTH, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                rv = a->SetWidth(prop);                  }        break;      }      case IMAGE_LOWSRC:      {        rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_IMAGE_LOWSRC, PR_TRUE);        if (NS_SUCCEEDED(rv)) {          nsAutoString prop;          nsJSUtils::nsConvertJSValToString(prop, cx, *vp);                nsIDOMImage *b;          if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) {            b->SetLowsrc(prop);            NS_RELEASE(b);          }          else {                         rv = NS_ERROR_DOM_WRONG_TYPE_ERR;          }                  }        break;      }      default:        return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);    }  }  else {    return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);  }  if (NS_FAILED(rv))      return nsJSUtils::nsReportError(cx, obj, rv);  return PR_TRUE;}