case IMAGE_LOWSRC: { PRBool ok = PR_FALSE; secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_IMAGE_LOWSRC, PR_TRUE, &ok); if (!ok) { return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR); } nsAutoString prop; nsJSUtils::nsConvertJSValToString(prop, cx, *vp);  nsIDOMImage *b; if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) { b->SetLowsrc(prop); NS_RELEASE(b); } else {  return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR); }  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;  }  if (JSVAL_IS_INT(id)) {    nsresult rv;    NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,                    NS_SCRIPTSECURITYMANAGER_PROGID, &rv);    if (NS_FAILED(rv)) {      return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);    }    switch(JSVAL_TO_INT(id)) {      case HTMLIMAGEELEMENT_LOWSRC:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LOWSRC, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetLowSrc(prop);                break;      }      case HTMLIMAGEELEMENT_NAME:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_NAME, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetName(prop);                break;      }      case HTMLIMAGEELEMENT_ALIGN:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALIGN, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetAlign(prop);                break;      }      case HTMLIMAGEELEMENT_ALT:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALT, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetAlt(prop);                break;      }      case HTMLIMAGEELEMENT_BORDER:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_BORDER, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetBorder(prop);                break;      }      case HTMLIMAGEELEMENT_HEIGHT:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HEIGHT, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetHeight(prop);                break;      }      case HTMLIMAGEELEMENT_HSPACE:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HSPACE, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetHspace(prop);                break;      }      case HTMLIMAGEELEMENT_ISMAP:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ISMAP, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        PRBool prop;        if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {          return nsJSUtils::nsReportError(cx, obj,  NS_ERROR_DOM_NOT_BOOLEAN_ERR);        }              a->SetIsMap(prop);                break;      }      case HTMLIMAGEELEMENT_LONGDESC:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LONGDESC, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetLongDesc(prop);                break;      }      case HTMLIMAGEELEMENT_USEMAP:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_USEMAP, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetUseMap(prop);                break;      }      case HTMLIMAGEELEMENT_VSPACE:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_VSPACE, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetVspace(prop);                break;      }      case HTMLIMAGEELEMENT_WIDTH:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_WIDTH, PR_TRUE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsJSUtils::nsConvertJSValToString(prop, cx, *vp);              a->SetWidth(prop);                break;      }      default:        return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);    }  }  else {    return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);  }  return PR_TRUE;}