case IMAGE_LOWSRC: { PRBool ok = PR_FALSE; secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_IMAGE_LOWSRC, PR_FALSE, &ok); if (!ok) { return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR); } nsAutoString prop; nsIDOMImage* b; if (NS_OK == a->QueryInterface(kIImageIID, (void **)&b)) { nsresult result = NS_OK; result = b->GetLowsrc(prop); if(NS_SUCCEEDED(result)) { nsJSUtils::nsConvertStringToJSVal(prop, cx, vp); NS_RELEASE(b); } else { NS_RELEASE(b); return nsJSUtils::nsReportError(cx, obj, result); } } else { return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_WRONG_TYPE_ERR); } break; }
GetHTMLImageElementProperty(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_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetLowSrc(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_NAME:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_NAME, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetName(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_ALIGN:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALIGN, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetAlign(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_ALT:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ALT, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetAlt(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_BORDER:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_BORDER, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetBorder(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_HEIGHT:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HEIGHT, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetHeight(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_HSPACE:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_HSPACE, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetHspace(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_ISMAP:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_ISMAP, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        PRBool prop;        nsresult result = NS_OK;        result = a->GetIsMap(&prop);        if (NS_SUCCEEDED(result)) {          *vp = BOOLEAN_TO_JSVAL(prop);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_LONGDESC:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_LONGDESC, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetLongDesc(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_USEMAP:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_USEMAP, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetUseMap(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_VSPACE:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_VSPACE, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetVspace(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      case HTMLIMAGEELEMENT_WIDTH:      {        PRBool ok = PR_FALSE;        secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLIMAGEELEMENT_WIDTH, PR_FALSE, &ok);        if (!ok) {          return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECURITY_ERR);        }        nsAutoString prop;        nsresult result = NS_OK;        result = a->GetWidth(prop);        if (NS_SUCCEEDED(result)) {          nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);        }        else {          return nsJSUtils::nsReportError(cx, obj, result);        }        break;      }      default:        return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);    }  }  else {    return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);  }  return PR_TRUE;}