if (!nativeThis) return JS_FALSE;
InstallGetFolder(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval){  nsInstall *nativeThis =    (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);  if (!nativeThis)    return JS_FALSE;  JSObject *jsObj;  nsAutoString b0;  nsAutoString b1;  nsInstallFolder *folder = nsnull;  *rval = JSVAL_NULL;  // If there's no private data, this must be the prototype, so ignore  if (nsnull == nativeThis) {    return JS_TRUE;  }  if(argc >= 2)  {    ConvertJSValToStr(b1, cx, argv[1]); // we know that the second param must be a string    if(JSVAL_IS_STRING(argv[0])) // check if the first argument is a string    {      ConvertJSValToStr(b0, cx, argv[0]);      if(NS_OK != nativeThis->GetFolder(b0, b1, &folder))        return JS_TRUE;    }    else /* it must be an object */    {      if ((argv[0] == JSVAL_NULL) || !JSVAL_IS_OBJECT(argv[0])) //argv[0] MUST be a jsval      {        *rval = JSVAL_NULL;        JS_ReportError(cx, "GetFolder:Invalid Parameter");        return JS_TRUE;      }      jsObj = JSVAL_TO_OBJECT(argv[0]);      if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))      {        *rval = JSVAL_NULL;        JS_ReportError(cx, "GetFolder:Invalid Parameter");        return JS_TRUE;      }      folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);      if (!folder)      {        JS_ReportError(cx, "GetFolder:Invalid Parameter");        return JS_FALSE;      }      else if(NS_OK != nativeThis->GetFolder(*folder, b1, &folder))        return JS_TRUE;    }    if(nsnull == folder)      return JS_TRUE;  }  else if(argc >= 1)  {    //  public int GetFolder ( String folderName);    ConvertJSValToStr(b0, cx, argv[0]);    if(NS_OK != nativeThis->GetFolder(b0, &folder))    {      return JS_TRUE;    }    if(nsnull == folder)      return JS_TRUE;  }  else  {    JS_ReportError(cx, "Function GetFolder requires at least 1 parameter");    return JS_FALSE;  }  if ( folder )  {    /* Now create the new JSObject */    JSObject* fileSpecObject;    fileSpecObject = JS_NewObject(cx, &FileSpecObjectClass, gFileSpecProto, NULL);    if (fileSpecObject == NULL)      return JS_FALSE;    JS_SetPrivate(cx, fileSpecObject, folder);    if (fileSpecObject == NULL)      return JS_FALSE;    *rval = OBJECT_TO_JSVAL(fileSpecObject);  }  return JS_TRUE;}