if (!nativeThis) return JS_FALSE;
InstallPatch(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval){  nsInstall *nativeThis =    (nsInstall*)JS_GetInstancePrivate(cx, obj, &InstallClass, argv);  if (!nativeThis)    return JS_FALSE;  PRInt32 nativeRet;  nsAutoString b0;  nsAutoString b1;  nsAutoString b2;  nsAutoString b3;  nsAutoString b4;  JSObject *jsObj;  nsInstallFolder *folder = nsnull;  *rval = INT_TO_JSVAL(nsInstall::UNEXPECTED_ERROR);  // If there's no private data, this must be the prototype, so ignore  if (nsnull == nativeThis) {    return JS_TRUE;  }  if(argc >= 5)  {    //  public int Patch (String registryName,    //                    String version,        --OR-- VersionInfo version,    //                    String jarSourcePath,    //                    Object localDirSpec,    //                    String relativeLocalPath);    ConvertJSValToStr(b0, cx, argv[0]);    ConvertJSvalToVersionString(b1, cx, argv[1]);    ConvertJSValToStr(b2, cx, argv[2]);    ConvertJSValToStr(b3, cx, argv[4]);    if ((argv[3] == JSVAL_NULL) || !JSVAL_IS_OBJECT(argv[3])) //argv[3] MUST be a jsval    {      *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);      nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);      return JS_TRUE;    }    jsObj = JSVAL_TO_OBJECT(argv[3]);    if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))    {      *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);      nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);      return JS_TRUE;    }    folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);    if(NS_OK != nativeThis->Patch(b0, b1, b2, folder, b3, &nativeRet))    {        return JS_FALSE;    }    *rval = INT_TO_JSVAL(nativeRet);  }  else if(argc >= 4)  {    //  public int Patch (String registryName,    //                    String jarSourcePath,    //                    Object localDirSpec,    //                    String relativeLocalPath);    ConvertJSValToStr(b0, cx, argv[0]);    ConvertJSValToStr(b1, cx, argv[1]);    ConvertJSValToStr(b2, cx, argv[3]);    if ((argv[2] == JSVAL_NULL) || !JSVAL_IS_OBJECT(argv[2])) //argv[2] MUST be a jsval    {      *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);      nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);      return JS_TRUE;    }    jsObj = JSVAL_TO_OBJECT(argv[2]);    if (!JS_InstanceOf(cx, jsObj, &FileSpecObjectClass, nsnull))    {      *rval = INT_TO_JSVAL(nsInstall::INVALID_ARGUMENTS);      nativeThis->SaveError(nsInstall::INVALID_ARGUMENTS);      return JS_TRUE;    }    folder = (nsInstallFolder*)JS_GetPrivate(cx, jsObj);    if(NS_OK != nativeThis->Patch(b0, b1, folder, b2, &nativeRet))    {      return JS_FALSE;    }    *rval = INT_TO_JSVAL(nativeRet);  }  else  {    JS_ReportError(cx, "Function Patch requires 5 parameters");    return JS_FALSE;  }  return JS_TRUE;}