if (ret) { nsHTMLValue heightVal((PRInt32)height, eHTMLUnit_Integer);
nsHTMLValue heightVal((PRInt32)height, eHTMLUnit_Integer);
nsHTMLImageElement::Initialize(JSContext* aContext, JSObject *aObj,                               PRUint32 argc, jsval *argv){  nsresult result = NS_OK;  // XXX This element is created unattached to any document.  Later  // on, it might be used to preload the image cache.  For that, we  // need a document (actually a pres context).  The only way to get  // one is to associate the image with one at creation time.  // This is safer than it used to be since we get the global object  // from the static scope chain rather than through the JSCOntext.  nsCOMPtr<nsIScriptGlobalObject> globalObject;  nsContentUtils::GetStaticScriptGlobal(aContext, aObj,                                        getter_AddRefs(globalObject));;  nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(globalObject));  if (domWindow) {    nsCOMPtr<nsIDOMDocument> domDocument;    result = domWindow->GetDocument(getter_AddRefs(domDocument));    if (NS_SUCCEEDED(result)) {      // Maintain the reference      result = CallQueryInterface(domDocument, &mOwnerDocument);    }  }  if (NS_SUCCEEDED(result) && (argc > 0)) {    // The first (optional) argument is the width of the image    int32 width;    JSBool ret = JS_ValueToInt32(aContext, argv[0], &width);    if (ret) {      nsHTMLValue widthVal((PRInt32)width, eHTMLUnit_Integer);      result = SetHTMLAttribute(nsHTMLAtoms::width, widthVal, PR_FALSE);      if (NS_SUCCEEDED(result) && (argc > 1)) {        // The second (optional) argument is the height of the image        int32 height;        ret = JS_ValueToInt32(aContext, argv[1], &height);        if (ret) {          nsHTMLValue heightVal((PRInt32)height, eHTMLUnit_Integer);          result = SetHTMLAttribute(nsHTMLAtoms::height, heightVal, PR_FALSE);        }        else {          result = NS_ERROR_INVALID_ARG;        }      }    }    else {      result = NS_ERROR_INVALID_ARG;    }  }  return result;}