RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm/js/ rpmaug-js.c rpmbc-js.c rpmbf-js.c rpmcudf-js.c rpmd...

From: Jeff Johnson <n3npq@mac.com>
Date: Fri 03 Jun 2011 - 18:35:02 CEST
Message-id: <B7F46C1A-2945-46F9-B2F5-DCEDDD852C6E@mac.com>
Talk to me first *PLEASE* ... nothing at all wrong with what you
are doing _EXCEPT_ you aren't talking.

73 de Jeff


On Jun 3, 2011, at 12:32 PM, Per Řyvind Karlsen wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>  ____________________________________________________________________________
> 
>  Server: rpm5.org                         Name:   Per Řyvind Karlsen
>  Root:   /v/rpm/cvs                       Email:  pkarlsen@rpm5.org
>  Module: rpm                              Date:   03-Jun-2011 18:32:17
>  Branch: HEAD                             Handle: 2011060316321501
> 
>  Modified files:
>    rpm/js                  rpmaug-js.c rpmbc-js.c rpmbf-js.c rpmcudf-js.c
>                            rpmdb-js.c rpmdbc-js.c rpmdbe-js.c rpmdc-js.c
>                            rpmdig-js.c rpmdir-js.c rpmds-js.c rpmfc-js.c
>                            rpmfi-js.c rpmfts-js.c rpmgi-js.c rpmhdr-js.c
>                            rpmio-js.c rpmiob-js.c rpmjs-debug.h rpmmc-js.c
>                            rpmmg-js.c rpmmi-js.c rpmmpf-js.c rpmmpw-js.c
>                            rpmps-js.c rpmseq-js.c rpmsm-js.c rpmsp-js.c
>                            rpmst-js.c rpmsw-js.c rpmsx-js.c rpmsys-js.c
>                            rpmte-js.c rpmts-js.c rpmtxn-js.c rpmxar-js.c
> 
>  Log:
>    port to SpiderMonkey 1.8.5 API for real
> 
>  Summary:
>    Revision    Changes     Path
>    1.13        +112 -42    rpm/js/rpmaug-js.c
>    1.5         +17 -7      rpm/js/rpmbc-js.c
>    1.11        +84 -34     rpm/js/rpmbf-js.c
>    1.7         +45 -21     rpm/js/rpmcudf-js.c
>    1.32        +257 -109   rpm/js/rpmdb-js.c
>    1.15        +112 -48    rpm/js/rpmdbc-js.c
>    1.23        +530 -201   rpm/js/rpmdbe-js.c
>    1.10        +57 -23     rpm/js/rpmdc-js.c
>    1.6         +17 -7      rpm/js/rpmdig-js.c
>    1.9         +27 -11     rpm/js/rpmdir-js.c
>    1.21        +27 -12     rpm/js/rpmds-js.c
>    1.5         +17 -7      rpm/js/rpmfc-js.c
>    1.16        +17 -7      rpm/js/rpmfi-js.c
>    1.11        +78 -30     rpm/js/rpmfts-js.c
>    1.5         +17 -7      rpm/js/rpmgi-js.c
>    1.25        +71 -25     rpm/js/rpmhdr-js.c
>    1.10        +193 -75    rpm/js/rpmio-js.c
>    1.5         +17 -7      rpm/js/rpmiob-js.c
>    1.8         +3  -3      rpm/js/rpmjs-debug.h
>    1.13        +56 -21     rpm/js/rpmmc-js.c
>    1.5         +26 -10     rpm/js/rpmmg-js.c
>    1.29        +69 -23     rpm/js/rpmmi-js.c
>    1.8         +76 -30     rpm/js/rpmmpf-js.c
>    1.22        +198 -93    rpm/js/rpmmpw-js.c
>    1.19        +27 -9      rpm/js/rpmps-js.c
>    1.8         +86 -34     rpm/js/rpmseq-js.c
>    1.9         +31 -15     rpm/js/rpmsm-js.c
>    1.5         +25 -9      rpm/js/rpmsp-js.c
>    1.11        +28 -11     rpm/js/rpmst-js.c
>    1.5         +17 -7      rpm/js/rpmsw-js.c
>    1.9         +27 -11     rpm/js/rpmsx-js.c
>    1.9         +179 -73    rpm/js/rpmsys-js.c
>    1.20        +39 -17     rpm/js/rpmte-js.c
>    1.34        +103 -39    rpm/js/rpmts-js.c
>    1.12        +67 -26     rpm/js/rpmtxn-js.c
>    1.6         +17 -7      rpm/js/rpmxar-js.c
>  ____________________________________________________________________________
> 
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmaug-js.c
>  ============================================================================
>  $ cvs diff -u -r1.12 -r1.13 rpmaug-js.c
>  --- rpm/js/rpmaug-js.c	2 Apr 2011 02:01:53 -0000	1.12
>  +++ rpm/js/rpmaug-js.c	3 Jun 2011 16:32:15 -0000	1.13
>  @@ -29,8 +29,14 @@
>   /* XXX does aug_defnode() need binding? */
>   /* XXX unclear whether aug.defvar("foo", "bar") or aug.foo = "bar" is better */
>   static JSBool
>  -rpmaug_defvar(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_defvar(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -49,7 +55,7 @@
>       case 1:	/* success */
>   	/* XXX return NAME or EXPR on success?  or bool for success/failure? */
>   	/* XXX hmmm, bool and string mixed returns. */
>  -	*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _name));
>  +	JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _name)));
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -58,8 +64,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_get(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_get(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -73,7 +85,7 @@
> 
>       switch (rpmaugGet(aug, _path, &_value)) {
>       case 1:	/* found */
>  -	*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _value));
>  +	JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _value)));
>   #ifdef	NOTYET
>   	_value = _free(_value);
>   #endif
>  @@ -81,7 +93,7 @@
>       default:
>       case 0:	/* not found */
>       case -1:	/* multiply defined */
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -90,8 +102,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_set(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_set(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -105,11 +123,11 @@
> 
>       switch (rpmaugSet(aug, _path, _value)) {
>       case 0:	/* found */
>  -	*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _value));
>  +	JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _value)));
>   	break;
>       default:
>       case -1:	/* multiply defined */
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -118,8 +136,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_insert(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_insert(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -134,11 +158,11 @@
> 
>       switch (rpmaugInsert(aug, _path, _label, _before)) {
>       case 0:	/* success */
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	break;
>       default:
>       case -1:	/* failure */
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -147,8 +171,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_rm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_rm(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -160,15 +190,21 @@
>           goto exit;
> 
>       /* XXX rpmaug_rm() returns number of deleted nodes. */
>  -    *rval = INT_TO_JSVAL(rpmaugRm(aug, _path));
>  +    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(rpmaugRm(aug, _path)));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmaug_mv(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_mv(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -182,11 +218,11 @@
> 
>       switch (rpmaugMv(aug, _src, _dst)) {
>       case 0:	/* success */
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	break;
>       default:
>       case -1:	/* failure */
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -195,8 +231,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_match(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_match(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -211,13 +253,13 @@
> 
>       nmatches = rpmaugMatch(aug, _path, &_matches);
>       if (nmatches <= 0) {	/* not found */
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	goto exit;
>       } else {
>   	JSObject *o;
>   	jsval v;
>   	int i;
>  -	*rval = OBJECT_TO_JSVAL(o=JS_NewArrayObject(cx, 0, NULL));
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o=JS_NewArrayObject(cx, 0, NULL)));
>   	for (i = 0; i < nmatches; i++) {
>   	    v = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _matches[i]));
>   	    ok = JS_SetElement(cx, o, i, &v);
>  @@ -231,8 +273,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_save(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_save(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -241,11 +289,11 @@
> 
>       switch (rpmaugSave(aug)) {
>       case 0:	/* success */
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	break;
>       default:
>       case -1:	/* failure */
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -253,8 +301,14 @@
>   }
> 
>   static JSBool
>  -rpmaug_load(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_load(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -263,11 +317,11 @@
> 
>       switch (rpmaugLoad(aug)) {
>       case 0:	/* success */
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	break;
>       default:
>       case -1:	/* failure */
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -276,8 +330,14 @@
> 
>   /* XXX print is uselss method because of FILE * in Augeas API. */
>   static JSBool
>  -rpmaug_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmaug_print(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -290,11 +350,11 @@
> 
>       switch (rpmaugPrint(aug, NULL, _path)) {
>       case 0:	/* success */
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	break;
>       default:
>       case -1:	/* failure */
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	break;
>       }
>       ok = JS_TRUE;
>  @@ -330,11 +390,14 @@
>   };
> 
>   static JSBool
>  -rpmaug_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmaug_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>  +
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -347,12 +410,13 @@
>   	*vp = INT_TO_JSVAL(_debug);
>   	break;
>       default:
>  -        if (JSVAL_IS_STRING(id) && *vp == JSVAL_VOID) {
>  -	    const char * name = JS_GetStringBytes(JS_ValueToString(cx, id));
>  +        if (JSVAL_IS_STRING(idval) && *vp == JSVAL_VOID) {
>  +	    char * name = JS_EncodeString(cx, JS_ValueToString(cx, idval));
>   	    const char * _path = rpmGetPath(_defvar, "/", name, NULL);
>   	    const char * _value = NULL;
>   	    if (rpmaugGet(aug, _path, &_value) >= 0 && _value != NULL)
>   		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _value));
>  +	    JS_free(cx, name);
>   	    _path = _free(_path);
>   	    _value = _free(_value);
>               break;
>  @@ -364,11 +428,13 @@
>   }
> 
>   static JSBool
>  -rpmaug_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmaug_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -383,12 +449,14 @@
>   	break;
>       default:
>   	/* XXX expr = undefined same as deleting? */
>  -        if (JSVAL_IS_STRING(id)) {
>  -            const char * name = JS_GetStringBytes(JS_ValueToString(cx, id));
>  -            const char * expr = JS_GetStringBytes(JS_ValueToString(cx, *vp));
>  +        if (JSVAL_IS_STRING(idval)) {
>  +	    char * name = JS_EncodeString(cx, JS_ValueToString(cx, idval));
>  +            char * expr = JS_EncodeString(cx, JS_ValueToString(cx, *vp));
>   	    /* XXX should *setprop be permitted to delete NAME?!? */
>   	    /* XXX return is no. nodes in EXPR match. */
>   	    (void) rpmaugDefvar(aug, name, expr);
>  +	    JS_free(cx, name);
>  +	    JS_free(cx, expr);
>               break;
>           }
>   	break;
>  @@ -398,11 +466,13 @@
>   }
> 
>   static JSBool
>  -rpmaug_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
>  +rpmaug_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
>   	JSObject **objp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmaugClass, NULL);
>       rpmaug aug = ptr;
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
> 
>   _RESOLVE_DEBUG_ENTRY(_debug);
> 
>  @@ -412,8 +482,8 @@
>       }
> 
>       /* Lazily resolve new strings, with duplication to Augeas defvar too. */
>  -    if ((flags & JSRESOLVE_ASSIGNING) && JSVAL_IS_STRING(id)) {
>  -        const char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
>  +    if ((flags & JSRESOLVE_ASSIGNING) && JSVAL_IS_STRING(idval)) {
>  +	char * name = JS_EncodeString(cx, JS_ValueToString(cx, idval));
>   	const char * _path;
>   	const char * _value;
>   	int xx;
>  @@ -451,7 +521,7 @@
>   assert(0);
>   	    break;
>   	}
>  -
>  +	JS_free(cx, name);
>   	_path = _free(_path);
>   	_value = _free(_value);
>       }
>  @@ -528,7 +598,7 @@
>       const char * _loadpath = _rpmaugLoadpath;
>       unsigned int _flags = _rpmaugFlags;
> 
>  -_CTOR_DEBUG_ENTRY(_debug, vp);
>  +_CTOR_DEBUG_ENTRY(_debug);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ssu", &_root, &_loadpath, &_flags)))
>   	goto exit;
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmbc-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmbc-js.c
>  --- rpm/js/rpmbc-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmbc-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -59,10 +59,12 @@
>   };
> 
>   static JSBool
>  -rpmbc_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmbc_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -80,10 +82,12 @@
>   }
> 
>   static JSBool
>  -rpmbc_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmbc_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -174,18 +178,24 @@
>   }
> 
>   static JSBool
>  -rpmbc_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbc_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmbc_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmbcClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +        JS_SET_RVAL(cx , vp , OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmbf-js.c
>  ============================================================================
>  $ cvs diff -u -r1.10 -r1.11 rpmbf-js.c
>  --- rpm/js/rpmbf-js.c	26 Jan 2010 15:06:12 -0000	1.10
>  +++ rpm/js/rpmbf-js.c	3 Jun 2011 16:32:15 -0000	1.11
>  @@ -20,8 +20,14 @@
>   #define	rpmbf_convert	JS_ConvertStub
> 
>   static JSBool
>  -rpmbf_add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_add(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>       rpmbf bf = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -29,19 +35,25 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_s)))
>           goto exit;
> 
>  -    *rval = (rpmbfAdd(bf, _s, 0) == 0 ? JSVAL_TRUE : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (rpmbfAdd(bf, _s, 0) == 0 ? JSVAL_TRUE : JSVAL_FALSE));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmbf_chk(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_chk(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>       rpmbf bf = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -49,33 +61,45 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_s)))
>           goto exit;
> 
>  -    *rval = (rpmbfChk(bf, _s, 0) > 0 ? JSVAL_TRUE : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (rpmbfChk(bf, _s, 0) > 0 ? JSVAL_TRUE : JSVAL_FALSE));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmbf_clr(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_clr(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>       rpmbf bf = ptr;
>       JSBool ok = JS_FALSE;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = (rpmbfClr(bf) == 0 ? JSVAL_TRUE : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (rpmbfClr(bf) == 0 ? JSVAL_TRUE : JSVAL_FALSE));
>       ok = JS_TRUE;
>       return ok;
>   }
> 
>   static JSBool
>  -rpmbf_del(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_del(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>       rpmbf bf = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -83,19 +107,25 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_s)))
>           goto exit;
> 
>  -    *rval = (rpmbfDel(bf, _s, 0) == 0 ? JSVAL_TRUE : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (rpmbfDel(bf, _s, 0) == 0 ? JSVAL_TRUE : JSVAL_FALSE));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmbf_intersect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_intersect(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if (!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>       rpmbf _a = ptr;
>       JSObject * o = NULL;
>  @@ -104,21 +134,27 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx , vp , JSVAL_FALSE);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o", &o))
>        || (_b = JS_GetInstancePrivate(cx, o, &rpmbfClass, NULL)) == NULL)
>           goto exit;
> 
>       if (!rpmbfIntersect(_a, _b))
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx , vp , JSVAL_TRUE);
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmbf_union(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_union(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if (!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>       rpmbf _a = ptr;
>       JSObject * o = NULL;
>  @@ -127,25 +163,25 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx , vp , JSVAL_FALSE);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o", &o))
>        || (_b = JS_GetInstancePrivate(cx, o, &rpmbfClass, NULL)) == NULL)
>           goto exit;
> 
>       if (!rpmbfUnion(_a, _b))
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx , vp , JSVAL_TRUE);
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSFunctionSpec rpmbf_funcs[] = {
>  -    JS_FS("add",	rpmbf_add,		0,0,0),
>  -    JS_FS("chk",	rpmbf_chk,		0,0,0),
>  -    JS_FS("clr",	rpmbf_clr,		0,0,0),
>  -    JS_FS("del",	rpmbf_del,		0,0,0),
>  -    JS_FS("intersect",	rpmbf_intersect,	0,0,0),
>  -    JS_FS("union",	rpmbf_union,		0,0,0),
>  +    JS_FS("add",	rpmbf_add,		0,0),
>  +    JS_FS("chk",	rpmbf_chk,		0,0),
>  +    JS_FS("clr",	rpmbf_clr,		0,0),
>  +    JS_FS("del",	rpmbf_del,		0,0),
>  +    JS_FS("intersect",	rpmbf_intersect,	0,0),
>  +    JS_FS("union",	rpmbf_union,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -161,10 +197,12 @@
>   };
> 
>   static JSBool
>  -rpmbf_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmbf_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   #ifdef	NOTYET
>       rpmbf bf = ptr;
>  @@ -181,12 +219,13 @@
>   	break;
>       default:
>   #ifdef	NOTYET
>  -        if (JSVAL_IS_STRING(id) && *vp == JSVAL_VOID) {
>  -	    const char * name = JS_GetStringBytes(JS_ValueToString(cx, id));
>  +        if (JSVAL_IS_STRING(idval) && *vp == JSVAL_VOID) {
>  +	    char * name = JS_EncodeString(cx, JS_ValueToString(cx, idval));
>   	    const char * _path = rpmGetPath(_defvar, "/", name, NULL);
>   	    const char * _value = NULL;
>   	    if (rpmbfGet(bf, _path, &_value) >= 0 && _value != NULL)
>   		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _value));
>  +	    JS_free(cx, name);
>   	    _path = _free(_path);
>   	    _value = _free(_value);
>               break;
>  @@ -199,10 +238,12 @@
>   }
> 
>   static JSBool
>  -rpmbf_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmbf_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmbfClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   #ifdef	NOTYET
>       rpmbf bf = ptr;
>  @@ -222,11 +263,13 @@
>   #ifdef	NOTYET
>   	/* XXX expr = undefined same as deleting? */
>           if (JSVAL_IS_STRING(id)) {
>  -            const char * name = JS_GetStringBytes(JS_ValueToString(cx, id));
>  -            const char * expr = JS_GetStringBytes(JS_ValueToString(cx, *vp));
>  +	    char * name = JS_EncodeString(cx, JS_ValueToString(cx, idval));
>  +	    char * expr = JS_EncodeString(cx, JS_ValueToString(cx, *vp));
>   	    /* XXX should *setprop be permitted to delete NAME?!? */
>   	    /* XXX return is no. nodes in EXPR match. */
>   	    (void) rpmbfDefvar(bf, name, expr);
>  +	    JS_free(cx, name);
>  +	    JS_free(cx, expr);
>               break;
>           }
>   #endif
>  @@ -358,11 +401,18 @@
>   }
> 
>   static JSBool
>  -rpmbf_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmbf_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>       unsigned int _m = 0;
>       unsigned int _k = 0;
>       unsigned int _flags = 0;
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>  +
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
>  @@ -370,13 +420,13 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/uuu", &_m, &_k, &_flags)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	if (rpmbf_init(cx, obj, _m, _k, _flags) == NULL)
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmbfClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +        JS_SET_RVAL(cx , vp , OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmcudf-js.c
>  ============================================================================
>  $ cvs diff -u -r1.6 -r1.7 rpmcudf-js.c
>  --- rpm/js/rpmcudf-js.c	10 Jan 2010 18:29:12 -0000	1.6
>  +++ rpm/js/rpmcudf-js.c	3 Jun 2011 16:32:15 -0000	1.7
>  @@ -41,8 +41,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmcudf_issolution(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmcudf_issolution(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmcudfClass, NULL);
>       rpmcudf cudf = ptr;
>       JSObject *fno = NULL;
>  @@ -54,15 +60,15 @@
>   	goto exit;
> 
>       if (fno && JSVAL_IS_STRING(OBJECT_TO_JSVAL(fno))) {
>  -	const char * _fn =
>  -		JS_GetStringBytes(JS_ValueToString(cx, OBJECT_TO_JSVAL(fno)));
>  +	char * _fn = JS_EncodeString(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(fno)));
>   	int _flags = RPMCUDV_CUDF;	/* XXX FIXME */
>  -	const char * _av[] = { _fn, NULL };
>  +	char * _av[] = { _fn, NULL };
>   	rpmcudf Y = rpmcudfNew(_av, _flags);
>  -	*rval = (rpmcudfIsSolution(cudf, Y) ? JSVAL_TRUE : JSVAL_FALSE);
>  +	JS_SET_RVAL(cx, vp, (rpmcudfIsSolution(cudf, Y) ? JSVAL_TRUE : JSVAL_FALSE));
>  +	JS_free(cx, _fn);
>   	Y = rpmcudfFree(Y);
>       } else
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       ok = JS_TRUE;
> 
>   exit:
>  @@ -70,8 +76,14 @@
>   }
> 
>   static JSBool
>  -rpmcudf_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmcudf_print(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmcudfClass, NULL);
>       rpmcudf cudf = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -82,18 +94,18 @@
>   	rpmcudfPrintPreamble(cudf);
>   	rpmcudfPrintRequest(cudf);
>   	rpmcudfPrintUniverse(cudf);
>  -	*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, rpmiobStr(cudf->iob)));
>  +	JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, rpmiobStr(cudf->iob))));
>   	(void) rpmiobEmpty(cudf->iob);
>       } else
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       ok = JS_TRUE;
> 
>       return ok;
>   }
> 
>   static JSFunctionSpec rpmcudf_funcs[] = {
>  -    JS_FS("issolution",	rpmcudf_issolution,		0,0,0),
>  -    JS_FS("print",	rpmcudf_print,			0,0,0),
>  +    JS_FS("issolution",	rpmcudf_issolution,		0,0),
>  +    JS_FS("print",	rpmcudf_print,			0,0),
>       JS_FS_END
>   };
> 
>  @@ -124,11 +136,13 @@
>   };
> 
>   static JSBool
>  -rpmcudf_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmcudf_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmcudfClass, NULL);
>       rpmcudf cudf = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -185,10 +199,12 @@
>   }
> 
>   static JSBool
>  -rpmcudf_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmcudf_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmcudfClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -255,11 +271,11 @@
>   static rpmcudf
>   rpmcudf_init(JSContext *cx, JSObject *obj, JSObject *fno, int _flags)
>   {
>  -    const char * fn = NULL;
>  +    char * fn = NULL;
>       rpmcudf cudf = NULL;
> 
>       if (fno && JSVAL_IS_STRING(OBJECT_TO_JSVAL(fno)))
>  -	fn = JS_GetStringBytes(JS_ValueToString(cx, OBJECT_TO_JSVAL(fno)));
>  +	fn = JS_EncodeString(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(fno)));
> 
>       switch (_flags) {
>       default:	_flags = RPMCUDV_CUDF;	break;
>  @@ -268,7 +284,7 @@
>   	break;
>       }
> 
>  -    {	const char *_av[] = { fn, NULL };
>  +    {	char *_av[] = { fn, NULL };
>   	cudf = rpmcudfNew(_av, _flags);
>       }
> 
>  @@ -280,6 +296,8 @@
>   if (_debug)
>   fprintf(stderr, "<== %s(%p,%p, %p, %d) cudf %p fn %s\n", __FUNCTION__, cx, obj, fno, _flags, cudf, fn);
> 
>  +    JS_free(cx, fn);
>  +
>       return cudf;
>   }
> 
>  @@ -295,23 +313,29 @@
>   }
> 
>   static JSBool
>  -rpmcudf_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmcudf_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>       JSBool ok = JS_FALSE;
>       JSObject *fno = NULL;
>       int _flags = 0;
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/oi", &fno, &_flags)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmcudf_init(cx, obj, fno, _flags);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmcudfClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmdb-js.c
>  ============================================================================
>  $ cvs diff -u -r1.31 -r1.32 rpmdb-js.c
>  --- rpm/js/rpmdb-js.c	10 Jan 2010 18:29:12 -0000	1.31
>  +++ rpm/js/rpmdb-js.c	3 Jun 2011 16:32:15 -0000	1.32
>  @@ -88,7 +88,8 @@
>   	p->dbt.data = &p->_u._ll;
>       } else
>       if (JSVAL_IS_STRING(v)) {
>  -	p->dbt.data = JS_GetStringBytes(JSVAL_TO_STRING(v));
>  +#warning need to free this one...
>  +	p->dbt.data = JS_EncodeString(cx, JSVAL_TO_STRING(v));
>   	p->dbt.size = strlen(p->dbt.data) + 1;
>       } else
>       if (JSVAL_IS_OBJECT(v)) {
>  @@ -135,8 +136,14 @@
>   /* --- Object methods */
> 
>   static JSBool
>  -rpmdb_Associate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Associate(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o_txn = NULL;
>  @@ -149,7 +156,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "oo/u", &o_txn, &o_db, &_flags)))
>   	goto exit;
>  @@ -175,7 +182,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -186,8 +193,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_AssociateForeign(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_AssociateForeign(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o_db = NULL;
>  @@ -198,7 +211,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o_db, &_flags)))
>  @@ -224,7 +237,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -235,8 +248,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Close(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       uint32_t _flags = 0;
>  @@ -245,13 +264,13 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	int ret = db->close(db, _flags);
>   	if (ret)
>   	    db->err(db, ret, "DB->close");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	db = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -262,8 +281,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Compact(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Compact(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -274,7 +299,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags)))
>   	goto exit;
>  @@ -291,7 +316,7 @@
>   	if (ret)
>   	    db->err(db, ret, "DB->compact");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -301,8 +326,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Cursor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Cursor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -313,7 +344,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ou", &o, &_flags)))
>   	goto exit;
>  @@ -337,7 +368,7 @@
>   		/* XXX error msg */
>   		goto exit;
>   	    }
>  -	    *rval = OBJECT_TO_JSVAL(o);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	    break;
>   	}
>       }
>  @@ -349,8 +380,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Del(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Del(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -363,7 +400,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ov/u", &o, &_kv, &_flags)))
>   	goto exit;
>  @@ -381,10 +418,10 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -396,8 +433,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Exists(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Exists(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -410,7 +453,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ov/u", &o, &_kv, &_flags)))
>   	goto exit;
>  @@ -424,15 +467,15 @@
>   	int ret = db->exists(db, _txn, _RPMDBT_PTR(_k), _flags);
>   	switch (ret) {
>   	default:
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    db->err(db, ret, "DB->exists");
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -444,8 +487,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Get(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Get(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -460,7 +509,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ov/vu", &o, &_kv, &_dv, &_flags)))
>   	goto exit;
>  @@ -484,15 +533,15 @@
>   #endif
>   	switch (ret) {
>   	default:
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    db->err(db, ret, "DB->get");
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyN(cx, _RPMDBT_PTR(_d)->data, _RPMDBT_PTR(_d)->size));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyN(cx, _RPMDBT_PTR(_d)->data, _RPMDBT_PTR(_d)->size)));
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -504,8 +553,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Join(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Join(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -520,7 +575,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       /* Build the cursor list. */
>       for (i = 0; i < argc; i++) {
>  @@ -553,14 +608,14 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    if ((o = JS_NewObject(cx, &rpmdbcClass, NULL, NULL)) == NULL
>   	     || !JS_SetPrivate(cx, o, (void *)_dbc))
>   	    {
>   		if (_dbc)	_dbc->close(_dbc);
>   		goto exit;
>   	    }
>  -	    *rval = OBJECT_TO_JSVAL(o);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	    break;
>   	}
>       }
>  @@ -571,8 +626,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_KeyRange(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_KeyRange(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -585,7 +646,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ov/u", &o, &_kv, &_flags)))
>   	goto exit;
>  @@ -607,15 +668,18 @@
>   	    db->err(db, ret, "DB->key_range");
>   	    goto exit;
>   	    break;
>  +#warning JS_PushArguments() & JS_PopArguments() has been removed from API
>  +#if 0
>   	case 0:
>   	  { void * mark = NULL;
>  -	    *rval = OBJECT_TO_JSVAL(JS_NewArrayObject(cx, 3,
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(JS_NewArrayObject(cx, 3,
>   			JS_PushArguments(cx, &mark, "ddd",
>   				_key_range.less,
>   				_key_range.equal,
>  -				_key_range.greater)));
>  +				_key_range.greater))));
>   	    JS_PopArguments(cx, mark);
>   	  } break;
>  +#endif
>   	}
>       }
> 
>  @@ -625,8 +689,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Open(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -641,7 +711,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "os/suui", &o, &_file, &_database, &_type, &_oflags, &_mode)))
>   	goto exit;
>  @@ -669,7 +739,7 @@
>               /* XXX only DB_UPGRADE/DB_VERIFY are currently implemented */
>               ret = db->set_feedback(db, rpmdb_feedback);
>               if (ret) db->err(db, ret, "DB->set_feedback");
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	}
>       }
> 
>  @@ -680,8 +750,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Pget(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Pget(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -697,7 +773,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ov/vu", &o, &_kv, &_dv, &_flags)))
>   	goto exit;
>  @@ -713,15 +789,15 @@
>   	int ret = db->pget(db, _txn, _RPMDBT_PTR(_k), _RPMDBT_PTR(_p), _RPMDBT_PTR(_d), _flags);
>   	switch (ret) {
>   	default:
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    db->err(db, ret, "DB->pget");
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyN(cx, _RPMDBT_PTR(_d)->data, _RPMDBT_PTR(_d)->size));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyN(cx, _RPMDBT_PTR(_d)->data, _RPMDBT_PTR(_d)->size)));
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -733,8 +809,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Put(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Put(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -749,7 +831,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ovv/u", &o, &_kv, &_dv, &_flags)))
>   	goto exit;
>  @@ -765,15 +847,15 @@
>   	int ret = db->put(db, _txn, _RPMDBT_PTR(_k), _RPMDBT_PTR(_d), _flags);
>   	switch (ret) {
>   	default:
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    db->err(db, ret, "DB->put");
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -785,8 +867,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Remove(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       const char * _file = NULL;
>  @@ -796,7 +884,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s/s", &_file, &_database)))
>   	goto exit;
>  @@ -807,7 +895,7 @@
>   	if (ret)
>   	    fprintf(stderr, "db->remove: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	db = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -819,8 +907,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Rename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Rename(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       const char * _file = NULL;
>  @@ -831,7 +925,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "sss", &_file, &_database, &_newname)))
>   	goto exit;
>  @@ -844,7 +938,7 @@
>   	if (ret)
>   	    db->err(db, ret, "DB->rename");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -854,8 +948,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Stat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Stat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -866,7 +966,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags)))
>   	goto exit;
>  @@ -880,7 +980,7 @@
>   	if (ret)
>   	    db->err(db, ret, "DB->stat");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	/* XXX FIXME: format for return. ugh */
>   	_sp = _free(_sp);
>       }
>  @@ -892,8 +992,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_StatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_StatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       uint32_t _flags = DB_STAT_ALL;	/* XXX DB_FAST_STAT is saner default */
>  @@ -902,7 +1008,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -912,7 +1018,7 @@
>   	if (ret)
>   	    db->err(db, ret, "DB->stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -922,8 +1028,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Sync(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Sync(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -931,7 +1043,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       /* XXX check argc? */
> 
>  @@ -940,7 +1052,7 @@
>   	if (ret)
>   	    db->err(db, ret, "DB->sync");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -950,8 +1062,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Truncate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Truncate(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       JSObject * o = NULL;
>  @@ -962,7 +1080,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       /* XXX check argc? */
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags)))
>  @@ -977,7 +1095,7 @@
>   	    db->err(db, ret, "DB->truncate");
>   	    goto exit;
>   	}
>  -	*rval = INT_TO_JSVAL(_count);
>  +	JS_SET_RVAL(cx, vp, INT_TO_JSVAL(_count));
>       }
> 
>       ok = JS_TRUE;
>  @@ -987,8 +1105,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Upgrade(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Upgrade(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       const char * _file = NULL;
>  @@ -997,7 +1121,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_file)))
>   	goto exit;
>  @@ -1009,7 +1133,7 @@
>   	    db->err(db, ret, "DB->upgrade");
>   	    goto exit;
>   	}
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1019,8 +1143,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_Verify(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_Verify(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>       const char * _file = NULL;
>  @@ -1031,7 +1161,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (db == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ssu", &_file, &_database, &_flags)))
>   	goto exit;
>  @@ -1042,7 +1172,7 @@
>   	if (ret)
>   	    fprintf(stderr, "db->verify: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	db = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -1054,27 +1184,27 @@
>   }
> 
>   static JSFunctionSpec rpmdb_funcs[] = {
>  -    JS_FS("associate",	rpmdb_Associate,	0,0,0),
>  -    JS_FS("associate_foreign",	rpmdb_AssociateForeign,	0,0,0),
>  -    JS_FS("close",	rpmdb_Close,		0,0,0),
>  -    JS_FS("compact",	rpmdb_Compact,		0,0,0),
>  -    JS_FS("cursor",	rpmdb_Cursor,		0,0,0),
>  -    JS_FS("del",	rpmdb_Del,		0,0,0),
>  -    JS_FS("exists",	rpmdb_Exists,		0,0,0),
>  -    JS_FS("get",	rpmdb_Get,		0,0,0),
>  -    JS_FS("join",	rpmdb_Join,		0,0,0),
>  -    JS_FS("key_range",	rpmdb_KeyRange,		0,0,0),
>  -    JS_FS("open",	rpmdb_Open,		0,0,0),
>  -    JS_FS("pget",	rpmdb_Pget,		0,0,0),
>  -    JS_FS("put",	rpmdb_Put,		0,0,0),
>  -    JS_FS("remove",	rpmdb_Remove,		0,0,0),
>  -    JS_FS("rename",	rpmdb_Rename,		0,0,0),
>  -    JS_FS("stat",	rpmdb_Stat,		0,0,0),
>  -    JS_FS("stat_print",	rpmdb_StatPrint,	0,0,0),
>  -    JS_FS("sync",	rpmdb_Sync,		0,0,0),
>  -    JS_FS("truncate",	rpmdb_Truncate,		0,0,0),
>  -    JS_FS("upgrade",	rpmdb_Upgrade,		0,0,0),
>  -    JS_FS("verify",	rpmdb_Verify,		0,0,0),
>  +    JS_FS("associate",	rpmdb_Associate,	0,0),
>  +    JS_FS("associate_foreign",	rpmdb_AssociateForeign,	0,0),
>  +    JS_FS("close",	rpmdb_Close,		0,0),
>  +    JS_FS("compact",	rpmdb_Compact,		0,0),
>  +    JS_FS("cursor",	rpmdb_Cursor,		0,0),
>  +    JS_FS("del",	rpmdb_Del,		0,0),
>  +    JS_FS("exists",	rpmdb_Exists,		0,0),
>  +    JS_FS("get",	rpmdb_Get,		0,0),
>  +    JS_FS("join",	rpmdb_Join,		0,0),
>  +    JS_FS("key_range",	rpmdb_KeyRange,		0,0),
>  +    JS_FS("open",	rpmdb_Open,		0,0),
>  +    JS_FS("pget",	rpmdb_Pget,		0,0),
>  +    JS_FS("put",	rpmdb_Put,		0,0),
>  +    JS_FS("remove",	rpmdb_Remove,		0,0),
>  +    JS_FS("rename",	rpmdb_Rename,		0,0),
>  +    JS_FS("stat",	rpmdb_Stat,		0,0),
>  +    JS_FS("stat_print",	rpmdb_StatPrint,	0,0),
>  +    JS_FS("sync",	rpmdb_Sync,		0,0),
>  +    JS_FS("truncate",	rpmdb_Truncate,		0,0),
>  +    JS_FS("upgrade",	rpmdb_Upgrade,		0,0),
>  +    JS_FS("verify",	rpmdb_Verify,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -1329,7 +1459,7 @@
>   #define	_GET_B(_test)	((_test) ? _RET_B(_i) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmdb_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdb_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>  @@ -1341,7 +1471,9 @@
>       uint32_t _u = 0;
>       int _i = 0;
>       FILE * _fp = NULL;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -1481,25 +1613,27 @@
>   	? JSVAL_TRUE : JSVAL_FALSE)
> 
>   static JSBool
>  -rpmdb_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdb_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbClass, NULL);
>       DB * db = ptr;
>  -    const char * _s = NULL;
>  +    char * _s = NULL;
>       uint32_t _gb = 0;
>       uint32_t _b = 0;
>       uint32_t _u = 0;
>       int _i = 0;
>       int _nc = 0;
>       FILE * _fp = NULL;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>   	return JS_TRUE;
> 
>       if (JSVAL_IS_STRING(*vp))
>  -	_s = JS_GetStringBytes(JS_ValueToString(cx, *vp));
>  +	_s = JS_EncodeString(cx, JS_ValueToString(cx, *vp));
>       if (JSVAL_IS_INT(*vp))
>   	_u = _i = JSVAL_TO_INT(*vp);
> 
>  @@ -1570,6 +1704,8 @@
>       default:
>   	break;
>       }
>  +    
>  +    JS_free(cx, _s);
> 
>       return JS_TRUE;
>   }
>  @@ -1663,8 +1799,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSObject * o = NULL;
>       DB_ENV * _dbenv = NULL;
>       uint32_t _flags = 0;
>  @@ -1678,12 +1820,12 @@
>       if (OBJ_IS_RPMDBE(cx, o))
>   	_dbenv = JS_GetInstancePrivate(cx, o, &rpmdbeClass, NULL);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmdb_init(cx, obj, _dbenv, _flags);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdbClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -1692,8 +1834,14 @@
>   }
> 
>   static JSBool
>  -rpmdb_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdb_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmdbClass, NULL);
>  @@ -1708,8 +1856,8 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_fn)))
>           goto exit;
> 
>  -    *rval = (db && _fn && (_con = rpmdbLgetfilecon(db, _fn)) != NULL)
>  -	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID;
>  +    JS_SET_RVAL(cx, vp, (db && _fn && (_con = rpmdbLgetfilecon(db, _fn)) != NULL)
>  +	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID);
>       _con = _free(_con);
> 
>       ok = JS_TRUE;
>  @@ -1718,7 +1866,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmdbc-js.c
>  ============================================================================
>  $ cvs diff -u -r1.14 -r1.15 rpmdbc-js.c
>  --- rpm/js/rpmdbc-js.c	10 Jan 2010 18:29:12 -0000	1.14
>  +++ rpm/js/rpmdbc-js.c	3 Jun 2011 16:32:15 -0000	1.15
>  @@ -43,8 +43,14 @@
>   /* --- Object methods */
> 
>   static JSBool
>  -rpmdbc_Close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Close(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -52,13 +58,13 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	int ret = dbc->close(dbc);
>   	if (ret)
>   	    fprintf(stderr, "DBC->close: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	dbc = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -69,8 +75,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Cmp(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Cmp(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       JSObject * _o = NULL;
>  @@ -80,7 +92,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o", &_o))
>        ||	(_otherdbc = JS_GetInstancePrivate(cx, _o, &rpmdbcClass, NULL)) == NULL)
>  @@ -98,7 +110,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = (!_result ? JSVAL_TRUE : JSVAL_FALSE);
>  +	    JS_SET_RVAL(cx, vp, (!_result ? JSVAL_TRUE : JSVAL_FALSE));
>   	    break;
>   	}
>       }
>  @@ -110,8 +122,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Count(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Count(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -119,7 +137,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	db_recno_t _count = 0;
>   	uint32_t _flags = 0;
>  @@ -130,8 +148,8 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    if (!JS_NewNumberValue(cx, (jsdouble)_count, rval))
>  -		*rval = JSVAL_VOID;
>  +	    if (!JS_NewNumberValue(cx, (jsdouble)_count, &JS_RVAL(cx, vp)))
>  +		JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -143,8 +161,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Del(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Del(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       uint32_t _flags = 0;
>  @@ -153,7 +177,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -165,7 +189,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -177,8 +201,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Dup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Dup(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       uint32_t _flags = 0;
>  @@ -187,7 +217,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -208,7 +238,7 @@
>   		/* XXX error msg */
>   		goto exit;
>   	    }
>  -	    *rval = OBJECT_TO_JSVAL(_o);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_o));
>   	    break;
>   	}
>       }
>  @@ -220,8 +250,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Get(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Get(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       jsval _kv = JSVAL_NULL;
>  @@ -234,7 +270,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "v/vu", &_kv, &_dv, &_flags)))
>   	goto exit;
>  @@ -257,10 +293,10 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyN(cx, _RPMDBT_PTR(_d)->data, _RPMDBT_PTR(_d)->size));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyN(cx, _RPMDBT_PTR(_d)->data, _RPMDBT_PTR(_d)->size)));
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -272,8 +308,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Pget(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Pget(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       jsval _kv = JSVAL_NULL;
>  @@ -287,7 +329,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "v/vu", &_kv, &_dv, &_flags)))
>   	goto exit;
>  @@ -303,10 +345,10 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _RPMDBT_PTR(_d)->data));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _RPMDBT_PTR(_d)->data)));
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -318,8 +360,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_Put(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_Put(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>       jsval _kv = JSVAL_NULL;
>  @@ -332,7 +380,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbc == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "vv/u", &_kv, &_dv, &_flags)))
>   	goto exit;
>  @@ -345,14 +393,14 @@
>   	switch (ret) {
>   	default:
>   	    fprintf(stderr, "DBC->put: %s\n", db_strerror(ret));
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	case DB_NOTFOUND:
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    break;
>   	}
>       }
>  @@ -364,14 +412,14 @@
>   }
> 
>   static JSFunctionSpec rpmdbc_funcs[] = {
>  -    JS_FS("close",	rpmdbc_Close,		0,0,0),
>  -    JS_FS("cmp",	rpmdbc_Cmp,		0,0,0),
>  -    JS_FS("count",	rpmdbc_Count,		0,0,0),
>  -    JS_FS("del",	rpmdbc_Del,		0,0,0),
>  -    JS_FS("dup",	rpmdbc_Dup,		0,0,0),
>  -    JS_FS("get",	rpmdbc_Get,		0,0,0),
>  -    JS_FS("pget",	rpmdbc_Pget,		0,0,0),
>  -    JS_FS("put",	rpmdbc_Put,		0,0,0),
>  +    JS_FS("close",	rpmdbc_Close,		0,0),
>  +    JS_FS("cmp",	rpmdbc_Cmp,		0,0),
>  +    JS_FS("count",	rpmdbc_Count,		0,0),
>  +    JS_FS("del",	rpmdbc_Del,		0,0),
>  +    JS_FS("dup",	rpmdbc_Dup,		0,0),
>  +    JS_FS("get",	rpmdbc_Get,		0,0),
>  +    JS_FS("pget",	rpmdbc_Pget,		0,0),
>  +    JS_FS("put",	rpmdbc_Put,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -394,11 +442,13 @@
>   };
> 
>   static JSBool
>  -rpmdbc_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdbc_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -433,11 +483,13 @@
>   }
> 
>   static JSBool
>  -rpmdbc_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdbc_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbcClass, NULL);
>       DBC * dbc = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -585,18 +637,24 @@
>   }
> 
>   static JSBool
>  -rpmdbc_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmdbc_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdbcClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -605,8 +663,14 @@
>   }
> 
>   static JSBool
>  -rpmdbc_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbc_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmdbcClass, NULL);
>  @@ -621,8 +685,8 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_fn)))
>           goto exit;
> 
>  -    *rval = (dbc && _fn && (_con = rpmdbcLgetfilecon(dbc, _fn)) != NULL)
>  -	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID;
>  +    JS_SET_RVAL(cx, vp, = (dbc && _fn && (_con = rpmdbcLgetfilecon(dbc, _fn)) != NULL)
>  +	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID);
>       _con = _free(_con);
> 
>       ok = JS_TRUE;
>  @@ -631,7 +695,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmdbe-js.c
>  ============================================================================
>  $ cvs diff -u -r1.22 -r1.23 rpmdbe-js.c
>  --- rpm/js/rpmdbe-js.c	3 Jun 2011 13:41:37 -0000	1.22
>  +++ rpm/js/rpmdbe-js.c	3 Jun 2011 16:32:15 -0000	1.23
>  @@ -145,8 +145,14 @@
>   /* --- Object methods */
> 
>   static JSBool
>  -rpmdbe_CdsgroupBegin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_CdsgroupBegin(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -154,7 +160,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (dbenv->app_private != NULL) {
>   	JSObject * _o = NULL;
>  @@ -173,7 +179,7 @@
>   		/* XXX error msg */
>   		goto exit;
>   	    }
>  -	    *rval = OBJECT_TO_JSVAL(_o);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(_o));
>   	    break;
>   	}
>       }
>  @@ -185,8 +191,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_Close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_Close(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = 0;
>  @@ -195,13 +207,13 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	int ret = dbenv->close(dbenv, _flags);
>           if (ret)
>   	    fprintf(stderr, "DB_ENV->close: %s", db_strerror(ret));
>           else
>  -            *rval = JSVAL_TRUE;
>  +            JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	dbenv = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -213,8 +225,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_Dbremove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_Dbremove(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       const char * _file = NULL;
>  @@ -224,7 +242,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s/s", &_file, &_database)))
>   	goto exit;
>  @@ -236,7 +254,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->dbremove(%s,%s)", _file, _database);
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -246,8 +264,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_Dbrename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_Dbrename(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       const char * _file = NULL;
>  @@ -258,7 +282,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "sss", &_file, &_database, &_newname)))
>   	goto exit;
>  @@ -270,7 +294,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->dbrename(%s,%s,%s)", _file, _database, _newname);
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -280,8 +304,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_Failchk(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_Failchk(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = 0;
>  @@ -290,7 +320,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_VOID;
>  +    JS_SET_RVAL(cx, vp, JSVAL_VOID);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -302,10 +332,10 @@
>   	    dbenv->err(dbenv, ret, "DB_ENV->failchk");
>   	    break;
>   	case DB_RUNRECOVERY:
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -317,8 +347,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_FileidReset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_FileidReset(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       const char * _file = NULL;
>  @@ -328,7 +364,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s/u", &_file, &_flags)))
>   	goto exit;
>  @@ -338,7 +374,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->fileid_reset");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -348,8 +384,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockDetect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockDetect(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -357,7 +399,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -368,8 +410,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockGet(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockGet(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -377,7 +425,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -388,8 +436,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockId(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockId(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -397,7 +451,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -408,8 +462,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockIdFree(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockIdFree(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -417,7 +477,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -428,8 +488,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockPut(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockPut(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -437,7 +503,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -448,8 +514,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -457,7 +529,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -468,8 +540,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -477,7 +555,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -488,8 +566,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LockVec(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LockVec(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -497,7 +581,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -508,8 +592,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogArchive(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogArchive(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = 0;
>  @@ -518,7 +608,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>  @@ -533,17 +623,17 @@
>   	    dbenv->err(dbenv, ret, "DB_ENV->log_archive");
>   	    break;
>   	case DB_RUNRECOVERY:
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    break;
>   	case 0:
>   argvPrint("log_archive", _av, NULL);
>   	    if (_av == NULL) {
>  -		*rval = JSVAL_NULL;
>  +		JS_SET_RVAL(cx, vp, JSVAL_NULL);
>   	    } else {
>   		int _ac = argvCount(_av);
>   		JSObject * o = JS_NewArrayObject(cx, 0, NULL);
>   		int i;
>  -		*rval = OBJECT_TO_JSVAL(o);
>  +		JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   		for (i = 0; i < _ac; i++) {
>   		    jsval v = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _av[i]));
>   		    (void) JS_SetElement(cx, o, i, &v);
>  @@ -562,8 +652,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogCursor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogCursor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -571,7 +667,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -582,8 +678,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogFile(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogFile(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -591,7 +693,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -602,8 +704,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogFlush(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogFlush(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -611,7 +719,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -622,8 +730,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogPrintf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogPrintf(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -631,7 +745,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -642,8 +756,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogPut(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogPut(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -651,7 +771,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -662,8 +782,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -671,7 +797,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -682,8 +808,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LogStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LogStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -691,7 +823,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -702,8 +834,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_LsnReset(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_LsnReset(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       const char * _file = NULL;
>  @@ -713,7 +851,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s/u", &_file, &_flags)))
>   	goto exit;
>  @@ -723,7 +861,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->lsn_reset");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -733,8 +871,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MempFcreate(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MempFcreate(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -742,7 +886,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -753,8 +897,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MempRegister(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MempRegister(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -762,7 +912,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -773,8 +923,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MempStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MempStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -783,7 +939,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>  @@ -799,7 +955,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->memp_stat");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -809,8 +965,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MempStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MempStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -819,7 +981,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -829,7 +991,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->memp_stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -839,8 +1001,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MempSync(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MempSync(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -848,7 +1016,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (dbenv->app_private != NULL) {
>   	DB_LSN * _lsn = NULL;
>  @@ -856,7 +1024,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->memp_sync");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -866,8 +1034,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MempTrickle(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MempTrickle(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       int _percent = 20;
>  @@ -876,7 +1050,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_VOID;
>  +    JS_SET_RVAL(cx, vp, JSVAL_VOID);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/i", &_percent)))
>   	goto exit;
>  @@ -887,7 +1061,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->memp_sync");
>   	else
>  -	    *rval = INT_TO_JSVAL(nwrote);
>  +	    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(nwrote));
>       }
> 
>       ok = JS_TRUE;
>  @@ -897,8 +1071,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MutexAlloc(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MutexAlloc(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -906,7 +1086,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -917,8 +1097,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MutexFree(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MutexFree(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -926,7 +1112,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -937,8 +1123,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MutexLock(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MutexLock(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -946,7 +1138,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -957,8 +1149,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MutexStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MutexStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -967,7 +1165,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -978,7 +1176,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->mutex_stat");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -988,8 +1186,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MutexStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MutexStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -998,7 +1202,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1008,7 +1212,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->mutex_stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1018,8 +1222,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_MutexUnlock(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_MutexUnlock(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -1027,7 +1237,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -1038,8 +1248,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_Open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_Open(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       const char * _home = NULL;
>  @@ -1050,7 +1266,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "su/i", &_home, &_eflags, &_mode)))
>   	goto exit;
>  @@ -1068,7 +1284,7 @@
>   	    /* XXX only DB_RECOVER is currently implemented */
>   	    ret = dbenv->set_feedback(dbenv, rpmdbe_feedback);
>   	    if (ret) dbenv->err(dbenv, ret, "DB_ENV->set_feedback");
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	}
>       }
> 
>  @@ -1079,8 +1295,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_Remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_Remove(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       const char * _home = NULL;
>  @@ -1090,7 +1312,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s/u", &_home, &_flags)))
>   	goto exit;
>  @@ -1101,7 +1323,7 @@
>   	    dbenv->err(dbenv, ret, "DB_ENV->remove: %s", _home);
>   	    goto exit;
>   	} else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1111,8 +1333,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepElect(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepElect(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _nsites = 0;
>  @@ -1123,7 +1351,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/uu", &_nsites, &_nvotes)))
>   	goto exit;
>  @@ -1133,7 +1361,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->rep_elect");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1143,8 +1371,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepProcessMessage(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepProcessMessage(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -1152,7 +1386,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -1163,8 +1397,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepStart(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepStart(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -1172,7 +1412,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -1183,8 +1423,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1193,7 +1439,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1204,7 +1450,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->rep_stat");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1214,8 +1460,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1224,7 +1476,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1234,7 +1486,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->rep_stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1244,8 +1496,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepSync(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepSync(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = 0;
>  @@ -1254,7 +1512,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1264,7 +1522,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->rep_sync");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1274,8 +1532,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepmgrStart(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepmgrStart(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -1283,7 +1547,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   	/* FIXME todo++ */
> 
>  @@ -1294,8 +1558,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepmgrStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepmgrStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1304,7 +1574,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1315,7 +1585,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->repmgr_stat");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1325,8 +1595,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_RepmgrStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_RepmgrStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1335,7 +1611,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1345,7 +1621,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->repmgr_stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1355,8 +1631,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_StatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_StatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1365,7 +1647,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1375,7 +1657,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1387,8 +1669,14 @@
>   #define OBJ_IS_RPMTXN(_cx, _o)  (JS_GET_CLASS(_cx, _o) == &rpmtxnClass)
> 
>   static JSBool
>  -rpmdbe_TxnBegin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_TxnBegin(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSObject * o = NULL;
>  @@ -1399,7 +1687,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags)))
>   	goto exit;
>  @@ -1423,7 +1711,7 @@
>   		/* XXX error msg */
>   		goto exit;
>   	    }
>  -	    *rval = OBJECT_TO_JSVAL(o);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	    break;
>   	}
>       }
>  @@ -1435,8 +1723,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_TxnCheckpoint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_TxnCheckpoint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _kb = 0;
>  @@ -1447,7 +1741,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/uuu", &_kb, &_minutes, &_flags)))
>   	goto exit;
>  @@ -1457,7 +1751,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->txn_checkpoint");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1467,8 +1761,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_TxnRecover(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_TxnRecover(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -1476,7 +1776,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>   #ifdef	NOTYET
>       if (dbenv->app_private != NULL) {
>  @@ -1502,7 +1802,7 @@
>   	    }
>   	    _flags = DB_NEXT;
>   	}
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
>   #endif
> 
>  @@ -1513,8 +1813,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_TxnStat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_TxnStat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1523,7 +1829,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1534,7 +1840,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->txn_stat");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1544,8 +1850,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_TxnStatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_TxnStatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>       uint32_t _flags = DB_STAT_ALL;
>  @@ -1554,7 +1866,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (dbenv == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -1564,7 +1876,7 @@
>   	if (ret)
>   	    dbenv->err(dbenv, ret, "DB_ENV->txn_stat_print");
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -1574,58 +1886,58 @@
>   }
> 
>   static JSFunctionSpec rpmdbe_funcs[] = {
>  -    JS_FS("cdsgroup_begin",	rpmdbe_CdsgroupBegin,		0,0,0),
>  -    JS_FS("close",		rpmdbe_Close,			0,0,0),
>  -    JS_FS("dbremove",		rpmdbe_Dbremove,		0,0,0),
>  -    JS_FS("dbrename",		rpmdbe_Dbrename,		0,0,0),
>  -    JS_FS("failchk",		rpmdbe_Failchk,			0,0,0),
>  -    JS_FS("fileid_reset",	rpmdbe_FileidReset,		0,0,0),
>  -    JS_FS("lock_detect",	rpmdbe_LockDetect,		0,0,0),
>  -    JS_FS("lock_get",		rpmdbe_LockGet,			0,0,0),
>  -    JS_FS("lock_id",		rpmdbe_LockId,			0,0,0),
>  -    JS_FS("lock_id_free",	rpmdbe_LockIdFree,		0,0,0),
>  -    JS_FS("lock_put",		rpmdbe_LockPut,			0,0,0),
>  -    JS_FS("lock_stat",		rpmdbe_LockStat,		0,0,0),
>  -    JS_FS("lock_stat_print",	rpmdbe_LockStatPrint,		0,0,0),
>  -    JS_FS("lock_vec",		rpmdbe_LockVec,			0,0,0),
>  -    JS_FS("log_archive",	rpmdbe_LogArchive,		0,0,0),
>  -    JS_FS("log_cursor",		rpmdbe_LogCursor,		0,0,0),
>  -    JS_FS("log_file",		rpmdbe_LogFile,			0,0,0),
>  -    JS_FS("log_flush",		rpmdbe_LogFlush,		0,0,0),
>  -    JS_FS("log_printf",		rpmdbe_LogPrintf,		0,0,0),
>  -    JS_FS("log_put",		rpmdbe_LogPut,			0,0,0),
>  -    JS_FS("log_stat",		rpmdbe_LogStat,			0,0,0),
>  -    JS_FS("log_stat_print",	rpmdbe_LogStatPrint,		0,0,0),
>  -    JS_FS("lsn_reset",		rpmdbe_LsnReset,		0,0,0),
>  -    JS_FS("memp_fcreate",	rpmdbe_MempFcreate,		0,0,0),
>  -    JS_FS("memp_register",	rpmdbe_MempRegister,		0,0,0),
>  -    JS_FS("memp_stat",		rpmdbe_MempStat,		0,0,0),
>  -    JS_FS("memp_stat_print",	rpmdbe_MempStatPrint,		0,0,0),
>  -    JS_FS("memp_sync",		rpmdbe_MempSync,		0,0,0),
>  -    JS_FS("memp_trickle",	rpmdbe_MempTrickle,		0,0,0),
>  -    JS_FS("mutex_alloc",	rpmdbe_MutexAlloc,		0,0,0),
>  -    JS_FS("mutex_free",		rpmdbe_MutexFree,		0,0,0),
>  -    JS_FS("mutex_lock",		rpmdbe_MutexLock,		0,0,0),
>  -    JS_FS("mutex_stat",		rpmdbe_MutexStat,		0,0,0),
>  -    JS_FS("mutex_stat_print",	rpmdbe_MutexStatPrint,		0,0,0),
>  -    JS_FS("mutex_unlock",	rpmdbe_MutexUnlock,		0,0,0),
>  -    JS_FS("open",		rpmdbe_Open,			0,0,0),
>  -    JS_FS("remove",		rpmdbe_Remove,			0,0,0),
>  -    JS_FS("rep_elect",		rpmdbe_RepElect,		0,0,0),
>  -    JS_FS("rep_process_message",rpmdbe_RepProcessMessage,	0,0,0),
>  -    JS_FS("rep_start",		rpmdbe_RepStart,		0,0,0),
>  -    JS_FS("rep_stat",		rpmdbe_RepStat,			0,0,0),
>  -    JS_FS("rep_stat_print",	rpmdbe_RepStatPrint,		0,0,0),
>  -    JS_FS("rep_sync",		rpmdbe_RepSync,			0,0,0),
>  -    JS_FS("repmgr_start",	rpmdbe_RepmgrStart,		0,0,0),
>  -    JS_FS("repmgr_stat",	rpmdbe_RepmgrStat,		0,0,0),
>  -    JS_FS("repmgr_stat_print",	rpmdbe_RepmgrStatPrint,		0,0,0),
>  -    JS_FS("stat_print",		rpmdbe_StatPrint,		0,0,0),
>  -    JS_FS("txn_begin",		rpmdbe_TxnBegin,		0,0,0),
>  -    JS_FS("txn_checkpoint",	rpmdbe_TxnCheckpoint,		0,0,0),
>  -    JS_FS("txn_recover",	rpmdbe_TxnRecover,		0,0,0),
>  -    JS_FS("txn_stat",		rpmdbe_TxnStat,			0,0,0),
>  -    JS_FS("txn_stat_print",	rpmdbe_TxnStatPrint,		0,0,0),
>  +    JS_FS("cdsgroup_begin",	rpmdbe_CdsgroupBegin,		0,0),
>  +    JS_FS("close",		rpmdbe_Close,			0,0),
>  +    JS_FS("dbremove",		rpmdbe_Dbremove,		0,0),
>  +    JS_FS("dbrename",		rpmdbe_Dbrename,		0,0),
>  +    JS_FS("failchk",		rpmdbe_Failchk,			0,0),
>  +    JS_FS("fileid_reset",	rpmdbe_FileidReset,		0,0),
>  +    JS_FS("lock_detect",	rpmdbe_LockDetect,		0,0),
>  +    JS_FS("lock_get",		rpmdbe_LockGet,			0,0),
>  +    JS_FS("lock_id",		rpmdbe_LockId,			0,0),
>  +    JS_FS("lock_id_free",	rpmdbe_LockIdFree,		0,0),
>  +    JS_FS("lock_put",		rpmdbe_LockPut,			0,0),
>  +    JS_FS("lock_stat",		rpmdbe_LockStat,		0,0),
>  +    JS_FS("lock_stat_print",	rpmdbe_LockStatPrint,		0,0),
>  +    JS_FS("lock_vec",		rpmdbe_LockVec,			0,0),
>  +    JS_FS("log_archive",	rpmdbe_LogArchive,		0,0),
>  +    JS_FS("log_cursor",		rpmdbe_LogCursor,		0,0),
>  +    JS_FS("log_file",		rpmdbe_LogFile,			0,0),
>  +    JS_FS("log_flush",		rpmdbe_LogFlush,		0,0),
>  +    JS_FS("log_printf",		rpmdbe_LogPrintf,		0,0),
>  +    JS_FS("log_put",		rpmdbe_LogPut,			0,0),
>  +    JS_FS("log_stat",		rpmdbe_LogStat,			0,0),
>  +    JS_FS("log_stat_print",	rpmdbe_LogStatPrint,		0,0),
>  +    JS_FS("lsn_reset",		rpmdbe_LsnReset,		0,0),
>  +    JS_FS("memp_fcreate",	rpmdbe_MempFcreate,		0,0),
>  +    JS_FS("memp_register",	rpmdbe_MempRegister,		0,0),
>  +    JS_FS("memp_stat",		rpmdbe_MempStat,		0,0),
>  +    JS_FS("memp_stat_print",	rpmdbe_MempStatPrint,		0,0),
>  +    JS_FS("memp_sync",		rpmdbe_MempSync,		0,0),
>  +    JS_FS("memp_trickle",	rpmdbe_MempTrickle,		0,0),
>  +    JS_FS("mutex_alloc",	rpmdbe_MutexAlloc,		0,0),
>  +    JS_FS("mutex_free",		rpmdbe_MutexFree,		0,0),
>  +    JS_FS("mutex_lock",		rpmdbe_MutexLock,		0,0),
>  +    JS_FS("mutex_stat",		rpmdbe_MutexStat,		0,0),
>  +    JS_FS("mutex_stat_print",	rpmdbe_MutexStatPrint,		0,0),
>  +    JS_FS("mutex_unlock",	rpmdbe_MutexUnlock,		0,0),
>  +    JS_FS("open",		rpmdbe_Open,			0,0),
>  +    JS_FS("remove",		rpmdbe_Remove,			0,0),
>  +    JS_FS("rep_elect",		rpmdbe_RepElect,		0,0),
>  +    JS_FS("rep_process_message",rpmdbe_RepProcessMessage,	0,0),
>  +    JS_FS("rep_start",		rpmdbe_RepStart,		0,0),
>  +    JS_FS("rep_stat",		rpmdbe_RepStat,			0,0),
>  +    JS_FS("rep_stat_print",	rpmdbe_RepStatPrint,		0,0),
>  +    JS_FS("rep_sync",		rpmdbe_RepSync,			0,0),
>  +    JS_FS("repmgr_start",	rpmdbe_RepmgrStart,		0,0),
>  +    JS_FS("repmgr_stat",	rpmdbe_RepmgrStat,		0,0),
>  +    JS_FS("repmgr_stat_print",	rpmdbe_RepmgrStatPrint,		0,0),
>  +    JS_FS("stat_print",		rpmdbe_StatPrint,		0,0),
>  +    JS_FS("txn_begin",		rpmdbe_TxnBegin,		0,0),
>  +    JS_FS("txn_checkpoint",	rpmdbe_TxnCheckpoint,		0,0),
>  +    JS_FS("txn_recover",	rpmdbe_TxnRecover,		0,0),
>  +    JS_FS("txn_stat",		rpmdbe_TxnStat,			0,0),
>  +    JS_FS("txn_stat_print",	rpmdbe_TxnStatPrint,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -1819,7 +2131,7 @@
>   #define	_GET_B(_test)	((_test) ? _RET_B(_i) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmdbe_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdbe_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>  @@ -1831,7 +2143,9 @@
>       int _i = 0;
>       long _l = 0;
>       FILE * _fp = NULL;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -2017,7 +2331,7 @@
>   	? JSVAL_TRUE : JSVAL_FALSE)
> 
>   static JSBool
>  -rpmdbe_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdbe_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdbeClass, NULL);
>       DB_ENV * dbenv = ptr;
>  @@ -2025,7 +2339,7 @@
>       const char ** _av = NULL;
>       int _ac = 0;
>   #endif
>  -    const char * _s = NULL;
>  +    char * _s = NULL;
>       uint32_t _gb = 0;
>       uint32_t _b = 0;
>       uint32_t _u = 0;
>  @@ -2033,7 +2347,9 @@
>       int _nc = 0;
>       long _l = 0;
>       FILE * _fp = NULL;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       jsdouble d;
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>  @@ -2041,7 +2357,7 @@
>   	return JS_TRUE;
> 
>       if (JSVAL_IS_STRING(*vp))
>  -	_s = JS_GetStringBytes(JS_ValueToString(cx, *vp));
>  +	_s = JS_EncodeString(cx, JS_ValueToString(cx, *vp));
>       if (JSVAL_IS_NUMBER(*vp)) {
>   	(void) JS_ValueToNumber(cx, *vp, &d);
>   	_u = _i = _l = d;
>  @@ -2235,6 +2551,8 @@
>   	break;
>       }
> 
>  +    JS_free(cx, _s);
>  +
>       return JS_TRUE;
>   }
> 
>  @@ -2325,18 +2643,23 @@
>   }
> 
>   static JSBool
>  -rpmdbe_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>       JSBool ok = JS_FALSE;
>  -
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmdbe_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdbeClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -2345,8 +2668,14 @@
>   }
> 
>   static JSBool
>  -rpmdbe_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdbe_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmdbeClass, NULL);
>  @@ -2361,8 +2690,8 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_fn)))
>           goto exit;
> 
>  -    *rval = (db && _fn && (_con = rpmdbeLgetfilecon(db, _fn)) != NULL)
>  -	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID;
>  +    JS_SET_RVAL(cx, vp, (db && _fn && (_con = rpmdbeLgetfilecon(db, _fn)) != NULL)
>  +	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID);
>       _con = _free(_con);
> 
>       ok = JS_TRUE;
>  @@ -2371,7 +2700,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmdc-js.c
>  ============================================================================
>  $ cvs diff -u -r1.9 -r1.10 rpmdc-js.c
>  --- rpm/js/rpmdc-js.c	10 Jan 2010 18:29:12 -0000	1.9
>  +++ rpm/js/rpmdc-js.c	3 Jun 2011 16:32:15 -0000	1.10
>  @@ -43,8 +43,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmdc_Init(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdc_Init(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdcClass, NULL);
>       rpmdc dc = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -65,15 +71,21 @@
>       dc = rpmDigestInit(_dalgo, _flags);
>       (void) JS_SetPrivate(cx, obj, (void *)dc);
> 
>  -    *rval = JSVAL_TRUE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmdc_Update(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdc_Update(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdcClass, NULL);
>       rpmdc dc = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -82,7 +94,7 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &s)))
>           goto exit;
>       if (dc == NULL)
>  @@ -90,7 +102,7 @@
> 
>       if (s && (ns = strlen(s)) > 0)
>   	(void) rpmDigestUpdate(dc, s, ns);
>  -    *rval = JSVAL_TRUE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -98,8 +110,14 @@
>   }
> 
>   static JSBool
>  -rpmdc_Fini(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdc_Fini(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdcClass, NULL);
>       rpmdc dc = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -108,12 +126,12 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       if (dc == NULL)
>   	goto exit;
> 
>       (void) rpmDigestFinal(dc, &s, &ns, 1);
>  -    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s));
>  +    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s)));
> 
>       (void) JS_SetPrivate(cx, obj, (void *)NULL);
> 
>  @@ -124,9 +142,9 @@
>   }
> 
>   static JSFunctionSpec rpmdc_funcs[] = {
>  -    JS_FS("init",	rpmdc_Init,		0,0,0),
>  -    JS_FS("update",	rpmdc_Update,		0,0,0),
>  -    JS_FS("fini",	rpmdc_Fini,		0,0,0),
>  +    JS_FS("init",	rpmdc_Init,		0,0),
>  +    JS_FS("update",	rpmdc_Update,		0,0),
>  +    JS_FS("fini",	rpmdc_Fini,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -152,11 +170,13 @@
>       ((_p) ? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, (_f))) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmdc_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdc_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdcClass, NULL);
>       rpmdc dc = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -177,10 +197,12 @@
>   }
> 
>   static JSBool
>  -rpmdc_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdc_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -280,8 +302,14 @@
>   }
> 
>   static JSBool
>  -rpmdc_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdc_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       unsigned int _dalgo = PGPHASHALGO_NONE;
>       unsigned int _flags = RPMDIGEST_NONE;
>  @@ -291,12 +319,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/uu", &_dalgo, &_flags)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmdc_init(cx, obj, _dalgo, _flags);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdcClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -305,8 +333,14 @@
>   }
> 
>   static JSBool
>  -rpmdc_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdc_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmdcClass, NULL);
>  @@ -338,9 +372,9 @@
>   	s = NULL;
>   	ns = 0;
>   	if (!rpmDigestFinal(dc, &s, &ns, 1)) {
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s)));
>   	} else
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	s = _free(s);
> 
>   	/* XXX reinitialize so that _dalgo is persistent */
>  @@ -348,13 +382,13 @@
>   	(void) JS_SetPrivate(cx, o, (void *)dc);
>   	dc = ptr = rpmdc_init(cx, o, _dalgo, _flags);
>       } else
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmdig-js.c
>  ============================================================================
>  $ cvs diff -u -r1.5 -r1.6 rpmdig-js.c
>  --- rpm/js/rpmdig-js.c	11 Oct 2010 18:39:35 -0000	1.5
>  +++ rpm/js/rpmdig-js.c	3 Jun 2011 16:32:15 -0000	1.6
>  @@ -55,10 +55,12 @@
>   };
> 
>   static JSBool
>  -rpmdig_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdig_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdigClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -76,10 +78,12 @@
>   }
> 
>   static JSBool
>  -rpmdig_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdig_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdigClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -171,18 +175,24 @@
>   }
> 
>   static JSBool
>  -rpmdig_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdig_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmdig_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdigClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmdir-js.c
>  ============================================================================
>  $ cvs diff -u -r1.8 -r1.9 rpmdir-js.c
>  --- rpm/js/rpmdir-js.c	10 Jan 2010 18:29:12 -0000	1.8
>  +++ rpm/js/rpmdir-js.c	3 Jun 2011 16:32:15 -0000	1.9
>  @@ -54,10 +54,12 @@
>   };
> 
>   static JSBool
>  -rpmdir_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdir_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdirClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -75,10 +77,12 @@
>   }
> 
>   static JSBool
>  -rpmdir_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmdir_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdirClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -203,8 +207,14 @@
>   }
> 
>   static JSBool
>  -rpmdir_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdir_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       const char * _dn = NULL;
> 
>  @@ -213,12 +223,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/s", &_dn)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmdir_init(cx, obj, _dn);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdirClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -227,8 +237,14 @@
>   }
> 
>   static JSBool
>  -rpmdir_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmdir_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmdirClass, NULL);
>  @@ -237,7 +253,7 @@
>       const char * _dn = NULL;
> 
>   if (_debug)
>  -fprintf(stderr, "==> %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "==> %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/s", &_dn)))
>           goto exit;
> 
>  @@ -250,13 +266,13 @@
> 
>       dir = ptr = rpmdir_init(cx, o, _dn);
> 
>  -    *rval = OBJECT_TO_JSVAL(o);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmds-js.c
>  ============================================================================
>  $ cvs diff -u -r1.20 -r1.21 rpmds-js.c
>  --- rpm/js/rpmds-js.c	12 Jan 2010 21:41:49 -0000	1.20
>  +++ rpm/js/rpmds-js.c	3 Jun 2011 16:32:15 -0000	1.21
>  @@ -70,11 +70,13 @@
>   };
> 
>   static JSBool
>  -rpmds_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmds_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdsClass, NULL);
>       rpmds ds = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       int ix;
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
>  @@ -146,11 +148,13 @@
>   }
> 
>   static JSBool
>  -rpmds_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmds_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmdsClass, NULL);
>       rpmds ds = (rpmds)ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       int myint;
>       int ix;
> 
>  @@ -330,7 +334,7 @@
>   	    return NULL;
>       } else
>       if (JSVAL_IS_STRING(v)) {
>  -	const char * s = JS_GetStringBytes(JS_ValueToString(cx, v));
>  +	char * s = JS_EncodeString(cx, JS_ValueToString(cx, v));
>   	if (!strcmp(s, "cpuinfo")) {
>   	    xx = rpmdsCpuinfo(&ds, NULL);
>   if (_debug)
>  @@ -356,12 +360,13 @@
>   fprintf(stderr, "\tstring \"%s\" is unknown. ds %p\n", s, ds);
>   	    return NULL;
>   	}
>  +	JS_free(cx, s);
>       } else
>       if (o && JS_IsArrayObject(cx, o)) {
>   	jsuint length = 0;
>   	JSBool ok = JS_GetArrayLength(cx, o, &length);
>  -	const char * N = NULL;
>  -	const char * EVR = NULL;
>  +	char * N = NULL;
>  +	char * EVR = NULL;
>   	uint32_t F = 0;
>   	jsuint i;
> 
>  @@ -378,10 +383,10 @@
>   		return NULL;
>   		/*@notreached@*/ break;
>   	    case 0:
>  -		N = JS_GetStringBytes(JSVAL_TO_STRING(v));
>  +		N = JS_EncodeString(cx, JSVAL_TO_STRING(v));
>   		break;
>   	    case 1:
>  -		EVR = JS_GetStringBytes(JSVAL_TO_STRING(v));
>  +		EVR = JS_EncodeString(cx, JSVAL_TO_STRING(v));
>   		break;
>   	    case 2:
>   		F = JSVAL_TO_INT(v);
>  @@ -392,6 +397,10 @@
>   if (_debug)
>   fprintf(stderr, "\trpmdsSingle(%s(%d), %s, %s, 0x%x) ds %p\n", tagName(_tagN), _tagN, N, EVR, F, ds);
>   	return NULL;
>  +	if (N)
>  +	    JS_free(cx, N);
>  +	if (EVR)
>  +	    JS_free(cx, EVR);
>       } else {
>   if (_debug)
>   fprintf(stderr, "\tobject class %p is unknown. ds %p\n", JS_GET_CLASS(cx, o), ds);
>  @@ -417,8 +426,14 @@
>   }
> 
>   static JSBool
>  -rpmds_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmds_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       jsval v = JSVAL_VOID;
>       uint32_t tagN = RPMTAG_REQUIRENAME;
>  @@ -428,13 +443,13 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "v/u", &v, &tagN)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	if (rpmds_init(cx, obj, v, tagN) == NULL)
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmdsClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmfc-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmfc-js.c
>  --- rpm/js/rpmfc-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmfc-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -57,10 +57,12 @@
>   };
> 
>   static JSBool
>  -rpmfc_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmfc_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmfcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -78,10 +80,12 @@
>   }
> 
>   static JSBool
>  -rpmfc_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmfc_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmfcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -173,18 +177,24 @@
>   }
> 
>   static JSBool
>  -rpmfc_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfc_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmfc_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmfcClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmfi-js.c
>  ============================================================================
>  $ cvs diff -u -r1.15 -r1.16 rpmfi-js.c
>  --- rpm/js/rpmfi-js.c	10 Jan 2010 18:29:12 -0000	1.15
>  +++ rpm/js/rpmfi-js.c	3 Jun 2011 16:32:15 -0000	1.16
>  @@ -89,11 +89,13 @@
>   };
> 
>   static JSBool
>  -rpmfi_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmfi_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmfiClass, NULL);
>       rpmfi fi = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       int ix;
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>  @@ -227,11 +229,13 @@
>   }
> 
>   static JSBool
>  -rpmfi_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmfi_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmfiClass, NULL);
>       rpmfi fi = (rpmfi)ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       int myint;
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>  @@ -377,8 +381,14 @@
>   }
> 
>   static JSBool
>  -rpmfi_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfi_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       rpmts ts = NULL;	/* XXX FIXME: should be a ts method? */
>       JSObject *hdro = NULL;
>  @@ -389,14 +399,14 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/i", &hdro, &tagN)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	Header h = JS_GetInstancePrivate(cx, hdro, &rpmhdrClass, NULL);
>   	if (rpmfi_init(cx, obj, ts, h, tagN) == NULL)
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmfiClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmfts-js.c
>  ============================================================================
>  $ cvs diff -u -r1.10 -r1.11 rpmfts-js.c
>  --- rpm/js/rpmfts-js.c	13 Jan 2010 19:47:58 -0000	1.10
>  +++ rpm/js/rpmfts-js.c	3 Jun 2011 16:32:15 -0000	1.11
>  @@ -50,15 +50,16 @@
>   	    jsuint length = 0;
>   	    jsuint i;
> 
>  -	    if (JS_GetArrayLength(cx, dno, &length))
>  +	    if (JS_GetArrayLength(cx, dno, &length)) {
>   	    for (i = 0; i < length; i++) {
>   		jsval v;
>   		if (JS_GetElement(cx, dno, (jsint)i, &v))
>  -		    argvAdd(&av, JS_GetStringBytes(JSVAL_TO_STRING(v)));
>  +		    argvAdd(&av, JS_EncodeString(cx, JSVAL_TO_STRING(v)));
>  +	    }
>   	    }
>   	} else
>   	    argvAdd(&av, 
>  -                JS_GetStringBytes(JS_ValueToString(cx, OBJECT_TO_JSVAL(dno))));
>  +                JS_EncodeString(cx, JS_ValueToString(cx, OBJECT_TO_JSVAL(dno))));
>   	
>   	if (_options == -1) _options = 0;
>   	_options &= FTS_OPTIONMASK;
>  @@ -66,6 +67,7 @@
>   	if (av)
>   	    fts = Fts_open((char *const *)av, _options, NULL);
>   	    /* XXX error msg */
>  +#warning need to JS_free()
>   	av = argvFree(av);
>   	if (!JS_SetPrivate(cx, obj, (void *)fts)) {
>   	    /* XXX error msg */
>  @@ -85,8 +87,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmfts_children(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_children(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       FTSENT * p;
>  @@ -99,8 +107,8 @@
>           goto exit;
> 
>       /* XXX FIXME: FTS_children() return? */
>  -    *rval = (fts && (p = Fts_children(fts, _instr)) != NULL
>  -		? OBJECT_TO_JSVAL(obj) : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (fts && (p = Fts_children(fts, _instr)) != NULL
>  +		? OBJECT_TO_JSVAL(obj) : JSVAL_FALSE));
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -108,8 +116,14 @@
>   }
> 
>   static JSBool
>  -rpmfts_close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_close(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -123,15 +137,21 @@
>   	fts = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, (void *)fts);
>       }
>  -    *rval = OBJECT_TO_JSVAL(obj);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
> 
>       ok = JS_TRUE;
>       return ok;
>   }
> 
>   static JSBool
>  -rpmfts_open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_open(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       JSObject *dno = NULL;
>  @@ -153,7 +173,7 @@
> 
>       fts = ptr = rpmfts_init(cx, obj, dno, _options);
> 
>  -    *rval = OBJECT_TO_JSVAL(obj);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -161,23 +181,35 @@
>   }
> 
>   static JSBool
>  -rpmfts_read(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_read(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       JSBool ok = JS_FALSE;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = (fts && Fts_read(fts) ? OBJECT_TO_JSVAL(obj) : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (fts && Fts_read(fts) ? OBJECT_TO_JSVAL(obj) : JSVAL_FALSE));
> 
>       ok = JS_TRUE;
>       return ok;
>   }
> 
>   static JSBool
>  -rpmfts_set(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_set(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       FTSENT * p = (fts ? fts->fts_cur : NULL);
>  @@ -189,8 +221,8 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_instr)))
>           goto exit;
> 
>  -    *rval = (fts && p && !Fts_set(fts, p, _instr)
>  -		? OBJECT_TO_JSVAL(obj) : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (fts && p && !Fts_set(fts, p, _instr)
>  +		? OBJECT_TO_JSVAL(obj) : JSVAL_FALSE));
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -198,11 +230,11 @@
>   }
> 
>   static JSFunctionSpec rpmfts_funcs[] = {
>  -    JS_FS("children",	rpmfts_children,	0,0,0),
>  -    JS_FS("close",	rpmfts_close,		0,0,0),
>  -    JS_FS("open",	rpmfts_open,		0,0,0),
>  -    JS_FS("read",	rpmfts_read,		0,0,0),
>  -    JS_FS("set",	rpmfts_set,		0,0,0),
>  +    JS_FS("children",	rpmfts_children,	0,0),
>  +    JS_FS("close",	rpmfts_close,		0,0),
>  +    JS_FS("open",	rpmfts_open,		0,0),
>  +    JS_FS("read",	rpmfts_read,		0,0),
>  +    JS_FS("set",	rpmfts_set,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -284,12 +316,14 @@
>       ((_p) ? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, (_p)->_f)) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmfts_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmfts_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       FTSENT * p = (fts ? fts->fts_cur : NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -355,12 +389,14 @@
>       if ((_p) && JS_ValueToInt32(cx, *vp, &myint)) (_p)->_f = myint
> 
>   static JSBool
>  -rpmfts_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmfts_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmftsClass, NULL);
>       FTS * fts = ptr;
>       FTSENT * p = (fts ? fts->fts_cur : NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       int myint = 0;
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
>  @@ -493,8 +529,14 @@
>   }
> 
>   static JSBool
>  -rpmfts_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       JSObject *dno = NULL;
>       int _options = 0;
>  @@ -504,12 +546,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ou", &dno, &_options)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmfts_init(cx, obj, dno, _options);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmftsClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -518,8 +560,14 @@
>   }
> 
>   static JSBool
>  -rpmfts_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmfts_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmftsClass, NULL);
>  @@ -541,13 +589,13 @@
> 
>       fts = ptr = rpmfts_init(cx, o, dno, _options);
> 
>  -    *rval = OBJECT_TO_JSVAL(o);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmgi-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmgi-js.c
>  --- rpm/js/rpmgi-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmgi-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -57,10 +57,12 @@
>   };
> 
>   static JSBool
>  -rpmgi_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmgi_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmgiClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -78,10 +80,12 @@
>   }
> 
>   static JSBool
>  -rpmgi_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmgi_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmgiClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -177,18 +181,24 @@
>   }
> 
>   static JSBool
>  -rpmgi_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmgi_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmgi_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmgiClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmhdr-js.c
>  ============================================================================
>  $ cvs diff -u -r1.24 -r1.25 rpmhdr-js.c
>  --- rpm/js/rpmhdr-js.c	12 Jan 2010 21:41:49 -0000	1.24
>  +++ rpm/js/rpmhdr-js.c	3 Jun 2011 16:32:15 -0000	1.25
>  @@ -144,8 +144,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmhdr_ds(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmhdr_ds(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>       rpmTag tagN = RPMTAG_NAME;
>       JSBool ok = JS_FALSE;
>  @@ -154,15 +160,21 @@
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &tagN)))
>           goto exit;
>  -    *rval = OBJECT_TO_JSVAL(rpmjs_NewDsObject(cx, OBJECT_TO_JSVAL(obj), tagN));
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(rpmjs_NewDsObject(cx, OBJECT_TO_JSVAL(obj), tagN)));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmhdr_fi(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmhdr_fi(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>       Header h = ptr;
>       rpmTag tagN = RPMTAG_BASENAMES;
>  @@ -172,15 +184,21 @@
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &tagN)))
>           goto exit;
>  -    *rval = OBJECT_TO_JSVAL(rpmjs_NewFiObject(cx, h, tagN));
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(rpmjs_NewFiObject(cx, h, tagN)));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmhdr_sprintf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmhdr_sprintf(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>       Header h = ptr;
>       char * qfmt = NULL;
>  @@ -195,29 +213,41 @@
> 
>       if ((s = headerSprintf(h, qfmt, NULL, rpmHeaderFormats, &errstr)) == NULL)
>   	s = errstr; 	/* XXX FIXME: returning errstr in-band. */
>  -    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s));
>  +    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s)));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmhdr_getorigin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmhdr_getorigin(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>       Header h = ptr;
>       JSBool ok = JS_FALSE;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>  -    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, headerGetOrigin(h)));
>  +    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, headerGetOrigin(h))));
>       ok = JS_TRUE;
>       return ok;
>   }
> 
>   static JSBool
>  -rpmhdr_setorigin(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmhdr_setorigin(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>       Header h = ptr;
>       char * s = NULL;
>  @@ -229,18 +259,18 @@
>           goto exit;
> 
>       (void) headerSetOrigin(h, s);
>  -    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, headerGetOrigin(h)));
>  +    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, headerGetOrigin(h))));
>       ok = JS_TRUE;
>   exit:
>       return ok;
>   }
> 
>   static JSFunctionSpec rpmhdr_funcs[] = {
>  -    JS_FS("ds",		rpmhdr_ds,		0,0,0),
>  -    JS_FS("fi",		rpmhdr_fi,		0,0,0),
>  -    JS_FS("sprintf",	rpmhdr_sprintf,		0,0,0),
>  -    JS_FS("getorigin",	rpmhdr_getorigin,	0,0,0),
>  -    JS_FS("setorigin",	rpmhdr_setorigin,	0,0,0),
>  +    JS_FS("ds",		rpmhdr_ds,		0,0),
>  +    JS_FS("fi",		rpmhdr_fi,		0,0),
>  +    JS_FS("sprintf",	rpmhdr_sprintf,		0,0),
>  +    JS_FS("getorigin",	rpmhdr_getorigin,	0,0),
>  +    JS_FS("setorigin",	rpmhdr_setorigin,	0,0),
>       JS_FS_END
>   };
> 
>  @@ -255,11 +285,13 @@
>   };
> 
>   static JSBool
>  -rpmhdr_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmhdr_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>       Header h = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -272,9 +304,12 @@
>   	*vp = INT_TO_JSVAL(_debug);
>   	break;
>       default: {
>  +	char * s = NULL;
>   	rpmTag tag = JSVAL_IS_INT(id)
>   		? (rpmTag) JSVAL_TO_INT(id)
>  -		: tagValue(JS_GetStringBytes(JS_ValueToString(cx, id)));
>  +		: tagValue((s = JS_EncodeString(cx, (JS_ValueToString(cx, id)))));
>  +	if (s)
>  +	    JS_free(cx, s);
>   	if (rpmhdrLoadTag(cx, obj, h, tag, vp) == NULL)
>   	    break;
>         } break;
>  @@ -284,10 +319,12 @@
>   }
> 
>   static JSBool
>  -rpmhdr_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmhdr_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmhdrClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -325,11 +362,14 @@
>       }
> 
>       if (JSVAL_IS_INT(id) || JSVAL_IS_STRING(id)) {
>  +	char * s = NULL;
>   	rpmTag tag = JSVAL_IS_INT(id)
>   		? (rpmTag) JSVAL_TO_INT(id)
>  -		: tagValue(JS_GetStringBytes(JS_ValueToString(cx, id)));
>  +		: tagValue(JS_EncodeString(cx, JS_ValueToString(cx, id)));
>   	JSObject * arr = rpmhdrLoadTag(cx, obj, h, tag, NULL);
> 
>  +	if (s)
>  +	    JS_free(cx, s);
>   	if (!JS_DefineElement(cx, obj, tag, OBJECT_TO_JSVAL(arr),
>   			NULL, NULL, JSPROP_ENUMERATE)) {
>   	    *objp = NULL;
>  @@ -358,7 +398,7 @@
>   JSClass rpmhiClass = {
>       "Hi",
>       JSCLASS_HAS_PRIVATE,
>  -    JS_PropertyStub,  JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
>  +    JS_PropertyStub,  JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
>       JS_EnumerateStub, JS_ResolveStub,  JS_ConvertStub,  rpmhi_dtor,
>       JSCLASS_NO_OPTIONAL_MEMBERS
>   };
>  @@ -447,8 +487,14 @@
>   }
> 
>   static JSBool
>  -rpmhdr_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmhdr_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       JSObject *tso = NULL;
> 
>  @@ -457,13 +503,13 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/o", &tso)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	if (rpmhdr_init(cx, obj, NULL))
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmhdrClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmio-js.c
>  ============================================================================
>  $ cvs diff -u -r1.9 -r1.10 rpmio-js.c
>  --- rpm/js/rpmio-js.c	10 Jan 2010 18:29:12 -0000	1.9
>  +++ rpm/js/rpmio-js.c	3 Jun 2011 16:32:15 -0000	1.10
>  @@ -64,8 +64,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmio_digestinit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_digestinit(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       jsuint _dalgo = PGPHASHALGO_MD5;
>  @@ -77,14 +83,20 @@
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "/uu", &_dalgo, &_flags))) {
>   	if (fd)
>   	    fdInitDigest(fd, _dalgo, _flags);
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmio_digestfini(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_digestfini(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       jsuint _dalgo = PGPHASHALGO_MD5;
>  @@ -97,16 +109,22 @@
>   	    const char * s = NULL;
>   	    size_t ns = 0;
>   	    fdFiniDigest(fd, _dalgo, &s, &ns, 1);
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s)));
>   	} else
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmio_fchown(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fchown(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       jsint _uid = -1;
>  @@ -118,15 +136,21 @@
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "/ii", &_uid, &_gid))) {
>           uid_t uid = _uid;
>           uid_t gid = _gid;
>  -        *rval = (fd && !Fchown(fd, uid, gid)
>  -                ? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +        JS_SET_RVAL(cx, vp, (fd && !Fchown(fd, uid, gid)
>  +                ? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmio_fclose(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fclose(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -140,15 +164,21 @@
>   	fd = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, (void *)fd);
>       }
>  -    *rval = OBJECT_TO_JSVAL(obj);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
> 
>       ok = JS_TRUE;
>       return ok;
>   }
> 
>   static JSBool
>  -rpmio_fdopen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fdopen(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       const char * _fmode = "r.ufdio";
>  @@ -164,11 +194,11 @@
>   	JSObject *o;
>   	if ((o = JS_NewObject(cx, &rpmioClass, NULL, NULL)) != NULL
>   	 && JS_SetPrivate(cx, o, (void *)fd))
>  -	    *rval = OBJECT_TO_JSVAL(obj);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>   	else
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       } else
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -176,31 +206,49 @@
>   }
> 
>   static JSBool
>  -rpmio_ferror(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_ferror(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>  -    *rval = (fd && !Ferror(fd) ? JSVAL_TRUE : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (fd && !Ferror(fd) ? JSVAL_TRUE : JSVAL_FALSE));
>       return JS_TRUE;
>   }
> 
>   static JSBool
>  -rpmio_fflush(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fflush(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>  -    *rval = (fd && !Fflush(fd) ? JSVAL_TRUE : JSVAL_FALSE);
>  +    JS_SET_RVAL(cx, vp, (fd && !Fflush(fd) ? JSVAL_TRUE : JSVAL_FALSE));
>       return JS_TRUE;
>   }
> 
>   #ifdef	NOTYET
>   static JSBool
>  -rpmio_fgetpos(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fgetpos(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JSVAL_TRUE;
>  @@ -215,27 +263,39 @@
>   	    rc = pos;
>       }
>   _rpmio_debug = 0;
>  -    *rval = INT_TO_JSVAL(rc);
>  +    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(rc));
>       return ok;
>   }
>   #endif
> 
>   static JSBool
>  -rpmio_fileno(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fileno(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       int fdno;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>  -    *rval = (fd && (fdno = Fileno(fd)) >= 0
>  -		? INT_TO_JSVAL(fdno) : INT_TO_JSVAL(-1));
>  +    JS_SET_RVAL(cx, vp, (fd && (fdno = Fileno(fd)) >= 0
>  +		? INT_TO_JSVAL(fdno) : INT_TO_JSVAL(-1)));
>       return JS_TRUE;
>   }
> 
>   static JSBool
>  -rpmio_fopen(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fopen(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       const char * _fn = NULL;
>  @@ -256,7 +316,7 @@
> 
>       fd = ptr = rpmio_init(cx, obj, _fn, _fmode);
> 
>  -    *rval = OBJECT_TO_JSVAL(obj);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -264,8 +324,14 @@
>   }
> 
>   static JSBool
>  -rpmio_fread(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fread(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -284,16 +350,16 @@
>   	char * b = alloca(nb);
>   	size_t nr = Fread(b, 1, nb, fd);
>   	if (nr == 0)
>  -	    *rval = JSVAL_VOID;		/* XXX goofy? */
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);		/* XXX goofy? */
>   	else
>   	if (Ferror(fd))
>  -	    *rval = JSVAL_FALSE;	/* XXX goofy? */
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);	/* XXX goofy? */
>   	else {
>   	    b[nr] = '\0';
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, b));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, b)));
>   	}
>       } else
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -301,8 +367,14 @@
>   }
> 
>   static JSBool
>  -rpmio_fseek(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fseek(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok;
>  @@ -313,14 +385,20 @@
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "/ii", &_offset, _whence)))
>   	rc = (fd ? Fseek(fd, _offset, _whence) : -3);
>  -    *rval = INT_TO_JSVAL(rc);
>  +    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(rc));
>       return ok;
>   }
> 
>   #ifdef	NOTYET
>   static JSBool
>  -rpmio_fsetpos(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fsetpos(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok;
>  @@ -332,14 +410,20 @@
>   	fpos_t pos = _offset;
>   	rc = (fd ? Fsetpos(fd, &pos) : -3);
>       }
>  -    *rval = INT_TO_JSVAL(rc);
>  +    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(rc));
>       return ok;
>   }
>   #endif
> 
>   static JSBool
>  -rpmio_fstat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fstat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -354,21 +438,27 @@
>   	if ((st = memcpy(xmalloc(nb), &sb, nb)) != NULL
>   	 && (o = JS_NewObject(cx, &rpmstClass, NULL, NULL)) != NULL
>   	 && JS_SetPrivate(cx, o, (void *)st))
>  -	    *rval = OBJECT_TO_JSVAL(o);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	else {
>   	    st = _free(st);
>  -	    *rval = JSVAL_VOID;		/* XXX goofy? */
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);		/* XXX goofy? */
>   	}
>       } else
>  -	*rval = JSVAL_VOID;		/* XXX goofy? */
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);		/* XXX goofy? */
> 
>       ok = JS_TRUE;
>       return ok;
>   }
> 
>   static JSBool
>  -rpmio_ftell(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_ftell(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JSVAL_TRUE;
>  @@ -376,13 +466,19 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>       rc = (int)(fd ? Ftell(fd) : -3);
>  -    *rval = INT_TO_JSVAL(rc);
>  +    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(rc));
>       return ok;
>   }
> 
>   static JSBool
>  -rpmio_fwrite(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_fwrite(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -399,11 +495,11 @@
>       if (fd) {
>   	size_t nw = Fwrite(b, 1, nb, fd);
>   	if (nw == 0)
>  -	    *rval = JSVAL_VOID;		/* XXX goofy? */
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);		/* XXX goofy? */
>   	else
>  -	    *rval = (nw != nb || Ferror(fd) ? JSVAL_FALSE : JSVAL_TRUE);
>  +	    JS_SET_RVAL(cx, vp, (nw != nb || Ferror(fd) ? JSVAL_FALSE : JSVAL_TRUE));
>       } else
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -411,8 +507,14 @@
>   }
> 
>   static JSBool
>  -rpmio_rewind(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_rewind(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>       JSBool ok = JSVAL_TRUE;
>  @@ -421,34 +523,34 @@
>       /* XXX should return fd object */
>       if (fd) {
>   	Rewind(fd);
>  -	*rval = JSVAL_TRUE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       } else
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       return ok;
>   }
> 
>   static JSFunctionSpec rpmio_funcs[] = {
>  -    JS_FS("digestinit",	rpmio_digestinit,	0,0,0),
>  -    JS_FS("digestfini",	rpmio_digestfini,	0,0,0),
>  -    JS_FS("fchown",	rpmio_fchown,		0,0,0),
>  -    JS_FS("fclose",	rpmio_fclose,		0,0,0),
>  -    JS_FS("fdopen",	rpmio_fdopen,		0,0,0),
>  -    JS_FS("ferror",	rpmio_ferror,		0,0,0),
>  -    JS_FS("fflush",	rpmio_fflush,		0,0,0),
>  +    JS_FS("digestinit",	rpmio_digestinit,	0,0),
>  +    JS_FS("digestfini",	rpmio_digestfini,	0,0),
>  +    JS_FS("fchown",	rpmio_fchown,		0,0),
>  +    JS_FS("fclose",	rpmio_fclose,		0,0),
>  +    JS_FS("fdopen",	rpmio_fdopen,		0,0),
>  +    JS_FS("ferror",	rpmio_ferror,		0,0),
>  +    JS_FS("fflush",	rpmio_fflush,		0,0),
>   #ifdef	NOTYET
>  -    JS_FS("fgetpos",	rpmio_fgetpos,		0,0,0),
>  +    JS_FS("fgetpos",	rpmio_fgetpos,		0,0),
>   #endif
>  -    JS_FS("fileno",	rpmio_fileno,		0,0,0),
>  -    JS_FS("fopen",	rpmio_fopen,		0,0,0),
>  -    JS_FS("fread",	rpmio_fread,		0,0,0),
>  -    JS_FS("fseek",	rpmio_fseek,		0,0,0),
>  +    JS_FS("fileno",	rpmio_fileno,		0,0),
>  +    JS_FS("fopen",	rpmio_fopen,		0,0),
>  +    JS_FS("fread",	rpmio_fread,		0,0),
>  +    JS_FS("fseek",	rpmio_fseek,		0,0),
>   #ifdef	NOTYET
>  -    JS_FS("fsetpos",	rpmio_fsetpos,		0,0,0),
>  +    JS_FS("fsetpos",	rpmio_fsetpos,		0,0),
>   #endif
>  -    JS_FS("fstat",	rpmio_fstat,		0,0,0),
>  -    JS_FS("ftell",	rpmio_ftell,		0,0,0),
>  -    JS_FS("fwrite",	rpmio_fwrite,		0,0,0),
>  -    JS_FS("rewind",	rpmio_rewind,		0,0,0),
>  +    JS_FS("fstat",	rpmio_fstat,		0,0),
>  +    JS_FS("ftell",	rpmio_ftell,		0,0),
>  +    JS_FS("fwrite",	rpmio_fwrite,		0,0),
>  +    JS_FS("rewind",	rpmio_rewind,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -489,11 +591,13 @@
>   	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, (_p)->_f)) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmio_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmio_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>       FD_t fd = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -522,10 +626,12 @@
>   }
> 
>   static JSBool
>  -rpmio_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmio_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmioClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -628,8 +734,14 @@
>   }
> 
>   static JSBool
>  -rpmio_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       const char * _fn = NULL;
>       const char * _fmode = "r.ufdio";
>  @@ -639,12 +751,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ss", &_fn, &_fmode)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmio_init(cx, obj, _fn, _fmode);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmioClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -653,8 +765,14 @@
>   }
> 
>   static JSBool
>  -rpmio_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmio_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmioClass, NULL);
>  @@ -664,7 +782,7 @@
>       const char * _fmode = "r.ufdio";
> 
>   if (_debug)
>  -fprintf(stderr, "==> %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "==> %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ss", &_fn, &_fmode)))
>           goto exit;
> 
>  @@ -677,13 +795,13 @@
> 
>       fd = ptr = rpmio_init(cx, o, _fn, _fmode);
> 
>  -    *rval = OBJECT_TO_JSVAL(o);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmiob-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmiob-js.c
>  --- rpm/js/rpmiob-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmiob-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -54,10 +54,12 @@
>   };
> 
>   static JSBool
>  -rpmiob_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmiob_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmiobClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -75,10 +77,12 @@
>   }
> 
>   static JSBool
>  -rpmiob_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmiob_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmiobClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -170,18 +174,24 @@
>   }
> 
>   static JSBool
>  -rpmiob_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmiob_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmiob_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmiobClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmjs-debug.h
>  ============================================================================
>  $ cvs diff -u -r1.7 -r1.8 rpmjs-debug.h
>  --- rpm/js/rpmjs-debug.h	12 Jan 2010 21:41:49 -0000	1.7
>  +++ rpm/js/rpmjs-debug.h	3 Jun 2011 16:32:15 -0000	1.8
>  @@ -25,7 +25,7 @@
>   #define	_METHOD_DEBUG_ENTRY(_test) \
>       if (_test) \
>   	fprintf(stderr, "==> %s(%p,%p,%p[%u],%p) ptr %p\n", \
>  -	    __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, ptr)
>  +	    __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), ptr)
> 
>   #define	_PROP_DEBUG_ENTRY(_test)\
>       if (_test) \
>  @@ -75,8 +75,8 @@
>   #define	_CTOR_DEBUG_ENTRY(_test) \
>       if (_test) \
>   	fprintf(stderr, "==> %s(%p,%p,%p[%u],%p)%s\n", \
>  -	    __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, \
>  -	    (JS_IsConstructing(cx) ? " constructing" : ""))
>  +	    __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), \
>  +	    (JS_IsConstructing(cx, vp) ? " constructing" : ""))
> 
>   /*@unchecked@*/
>   extern int _rpmjs_debug;
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmmc-js.c
>  ============================================================================
>  $ cvs diff -u -r1.12 -r1.13 rpmmc-js.c
>  --- rpm/js/rpmmc-js.c	12 Jan 2010 21:41:49 -0000	1.12
>  +++ rpm/js/rpmmc-js.c	3 Jun 2011 16:32:15 -0000	1.13
>  @@ -25,8 +25,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmmc_add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmc_add(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmcClass, NULL);
>       rpmmc mc = ptr;
>       char * s = NULL;
>  @@ -41,13 +47,19 @@
>       (void) rpmDefineMacro(mc, s, lvl);
>       ok = JS_TRUE;
>   exit:
>  -    *rval = BOOLEAN_TO_JSVAL(ok);
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));
>       return ok;
>   }
> 
>   static JSBool
>  -rpmmc_del(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmc_del(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmcClass, NULL);
>       rpmmc mc = ptr;
>       char * s = NULL;
>  @@ -61,13 +73,19 @@
>       (void) rpmUndefineMacro(mc, s);
>       ok = JS_TRUE;
>   exit:
>  -    *rval = BOOLEAN_TO_JSVAL(ok);
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));
>       return ok;
>   }
> 
>   static JSBool
>  -rpmmc_list(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmc_list(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmcClass, NULL);
>       rpmmc mc = ptr;
>       void * _mire = NULL;
>  @@ -91,10 +109,10 @@
>   		goto exit;
>   	    vec[i] = STRING_TO_JSVAL(valstr);
>   	}
>  -	*rval = OBJECT_TO_JSVAL(JS_NewArrayObject(cx, ac, vec));
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(JS_NewArrayObject(cx, ac, vec)));
>   	vec = _free(vec);
>       } else
>  -	*rval = JSVAL_NULL;	/* XXX JSVAL_VOID? */
>  +	JS_SET_RVAL(cx, vp, JSVAL_NULL);	/* XXX JSVAL_VOID? */
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -102,8 +120,14 @@
>   }
> 
>   static JSBool
>  -rpmmc_expand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmc_expand(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmcClass, NULL);
>       rpmmc mc = ptr;
>       char * s;
>  @@ -121,7 +145,7 @@
>       if ((valstr = JS_NewStringCopyZ(cx, t)) == NULL)
>   	goto exit;
>       t = _free(t);
>  -    *rval = STRING_TO_JSVAL(valstr);
>  +    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(valstr));
> 
>       ok = JS_TRUE;
>   exit:
>  @@ -129,10 +153,10 @@
>   }
> 
>   static JSFunctionSpec rpmmc_funcs[] = {
>  -    JS_FS("add",	rpmmc_add,		0,0,0),
>  -    JS_FS("del",	rpmmc_del,		0,0,0),
>  -    JS_FS("list",	rpmmc_list,		0,0,0),
>  -    JS_FS("expand",	rpmmc_expand,		0,0,0),
>  +    JS_FS("add",	rpmmc_add,		0,0),
>  +    JS_FS("del",	rpmmc_del,		0,0),
>  +    JS_FS("list",	rpmmc_list,		0,0),
>  +    JS_FS("expand",	rpmmc_expand,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -147,10 +171,12 @@
>   };
> 
>   static JSBool
>  -rpmmc_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmc_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -168,10 +194,12 @@
>   }
> 
>   static JSBool
>  -rpmmc_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmc_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmcClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -245,7 +273,7 @@
>   fprintf(stderr, "==> %s(%p,%p,%p) mc %p\n", __FUNCTION__, cx, obj, o, mc);
> 
>       if (JSVAL_IS_STRING(v)) {
>  -	const char * s = JS_GetStringBytes(JS_ValueToString(cx, v));
>  +	char * s = JS_EncodeString(cx, JS_ValueToString(cx, v));
>           if (!strcmp(s, "global"))
>               mc = rpmGlobalMacroContext;
>   	else if (!strcmp(s, "cli"))
>  @@ -259,6 +287,7 @@
>   	}
>   if (_debug)
>   fprintf(stderr, "\tinitMacros(\"%s\") mc %p\n", s, mc);
>  +	JS_free(cx, s);
>       } else
>       if (o == NULL) {
>   if (_debug)
>  @@ -287,8 +316,14 @@
>   }
> 
>   static JSBool
>  -rpmmc_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmc_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       jsval v = JSVAL_VOID;
>       JSObject *o = NULL;
>  @@ -298,12 +333,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/v", &v)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmmc_init(cx, obj, v);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmmcClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmmg-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmmg-js.c
>  --- rpm/js/rpmmg-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmmg-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -55,10 +55,12 @@
>   };
> 
>   static JSBool
>  -rpmmg_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmg_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmgClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -76,10 +78,12 @@
>   }
> 
>   static JSBool
>  -rpmmg_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmg_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmgClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -202,8 +206,14 @@
>   }
> 
>   static JSBool
>  -rpmmg_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmg_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       const char * _magicfile = NULL;
>       int _flags = 0;
>  @@ -213,12 +223,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/su", &_magicfile, &_flags)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmmg_init(cx, obj, _magicfile, _flags);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmmgClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -227,8 +237,14 @@
>   }
> 
>   static JSBool
>  -rpmmg_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmg_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmmgClass, NULL);
>  @@ -242,13 +258,13 @@
> 
>       if (mg)
>   	s = rpmmgFile(mg, _fn);
>  -    *rval = (s ? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s)) : JSVAL_NULL);
>  +    JS_SET_RVAL(cx, vp, (s ? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, s)) : JSVAL_NULL));
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, mg);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, mg);
>       s = _free(s);
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmmi-js.c
>  ============================================================================
>  $ cvs diff -u -r1.28 -r1.29 rpmmi-js.c
>  --- rpm/js/rpmmi-js.c	10 Jan 2010 18:29:12 -0000	1.28
>  +++ rpm/js/rpmmi-js.c	3 Jun 2011 16:32:15 -0000	1.29
>  @@ -25,8 +25,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmmi_pattern(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmi_pattern(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmiClass, NULL);
>       rpmmi mi = ptr;
>       jsval tagid = JSVAL_VOID;
>  @@ -50,24 +56,33 @@
>       case RPMMIRE_GLOB:
>       case RPMMIRE_PCRE:
>   	if (!JSVAL_IS_VOID(tagid)) {
>  +	    char * s = NULL;
>   	    /* XXX TODO: make sure both tag and key were specified. */
>   	    tag = JSVAL_IS_INT(tagid)
>   		? (rpmTag) JSVAL_TO_INT(tagid)
>  -		: tagValue(JS_GetStringBytes(JS_ValueToString(cx, tagid)));
>  +		: tagValue(s = JS_EncodeString(cx, JS_ValueToString(cx, tagid)));
>  +	    if (s)
>  +		JS_free(cx, s);
>   	}
>   	rpmmiAddPattern(mi, tag, type, pattern);
>   	ok = JS_TRUE;
>   	break;
>       }
>  -    *rval = BOOLEAN_TO_JSVAL(ok);
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));
> 
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmmi_prune(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmi_prune(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmiClass, NULL);
>       rpmmi mi = ptr;
>       uint32_t _u = 0;
>  @@ -80,15 +95,21 @@
>       /* XXX handle arrays */
>       if (!rpmmiPrune(mi, &_u, 1, 1))
>   	ok = JS_TRUE;
>  -    *rval = BOOLEAN_TO_JSVAL(ok);
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));
> 
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmmi_grow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmi_grow(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmiClass, NULL);
>       rpmmi mi = ptr;
>       uint32_t _u = 0;
>  @@ -101,15 +122,21 @@
>       /* XXX handle arrays */
>       if (!rpmmiGrow(mi, &_u, 1))
>   	ok = JS_TRUE;
>  -    *rval = BOOLEAN_TO_JSVAL(ok);
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));
> 
>   exit:
>       return ok;
>   }
> 
>   static JSBool
>  -rpmmi_growbn(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmi_growbn(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmiClass, NULL);
>       rpmmi mi = ptr;
>       const char * _bn = NULL;
>  @@ -122,17 +149,17 @@
>       /* XXX handle arrays */
>       if (!rpmmiGrowBasename(mi, _bn))
>   	ok = JS_TRUE;
>  -    *rval = BOOLEAN_TO_JSVAL(ok);
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));
> 
>   exit:
>       return ok;
>   }
> 
>   static JSFunctionSpec rpmmi_funcs[] = {
>  -    JS_FS("pattern",	rpmmi_pattern,		0,0,0),
>  -    JS_FS("prune",	rpmmi_prune,		0,0,0),
>  -    JS_FS("grow",	rpmmi_grow,		0,0,0),
>  -    JS_FS("growbn",	rpmmi_growbn,		0,0,0),
>  +    JS_FS("pattern",	rpmmi_pattern,		0,0),
>  +    JS_FS("prune",	rpmmi_prune,		0,0),
>  +    JS_FS("grow",	rpmmi_grow,		0,0),
>  +    JS_FS("growbn",	rpmmi_growbn,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -153,11 +180,13 @@
>   };
> 
>   static JSBool
>  -rpmmi_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmi_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmiClass, NULL);
>       rpmmi mi = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -192,10 +221,12 @@
>   }
> 
>   static JSBool
>  -rpmmi_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmi_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmiClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -296,6 +327,7 @@
>       rpmmi mi;
>       uint32_t _u = 0;
>       void * _key = NULL;
>  +    char * s = NULL;
>       int _keylen = 0;
> 
>       if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v)) {
>  @@ -309,15 +341,20 @@
>   	_key = (void *) &_u;
>       } else
>       if (JSVAL_IS_STRING(v)) {
>  -	const char * s = JS_GetStringBytes(JS_ValueToString(cx, v));
>  +	s = JS_EncodeString(cx, JS_ValueToString(cx, v));
>   	_keylen = strlen(s);
>   	_key = (void *)s;
>       } else
>   	/* XXX TODO: handle key object as binary octet string. */
>   	return NULL;
> 
>  -    if ((mi = rpmtsInitIterator(ts, _tag, _key, _keylen)) == NULL)
>  +    if ((mi = rpmtsInitIterator(ts, _tag, _key, _keylen)) == NULL) {
>  +	if (s)
>  +	    JS_free(cx, s);
>   	return NULL;
>  +    }
>  +    if (s)
>  +	JS_free(cx, s);
>       if (!JS_SetPrivate(cx, obj, (void *)mi)) {
>   	/* XXX error msg */
>   	mi = rpmmiFree(mi);
>  @@ -338,8 +375,14 @@
>   }
> 
>   static JSBool
>  -rpmmi_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmi_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSObject *tso = NULL;
>       jsval tagid = JSVAL_VOID;
>       jsval kv = JSVAL_VOID;
>  @@ -351,14 +394,17 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/vv", &tso, &tagid, &kv)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	rpmts ts = JS_GetInstancePrivate(cx, tso, &rpmtsClass, NULL);
> 
>   	if (!JSVAL_IS_VOID(tagid)) {
>  +	    char * s = NULL;
>   	    /* XXX TODO: make sure both tag and key were specified. */
>   	    tag = JSVAL_IS_INT(tagid)
>   		? (rpmTag) JSVAL_TO_INT(tagid)
>  -		: tagValue(JS_GetStringBytes(JS_ValueToString(cx, tagid)));
>  +		: tagValue(s = JS_EncodeString(cx, JS_ValueToString(cx, tagid)));
>  +	    if (s)
>  +		JS_free(cx, s);
>   	}
> 
>   	if (ts == NULL || rpmmi_init(cx, obj, ts, tag, kv))
>  @@ -366,7 +412,7 @@
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmmiClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmmpf-js.c
>  ============================================================================
>  $ cvs diff -u -r1.7 -r1.8 rpmmpf-js.c
>  --- rpm/js/rpmmpf-js.c	10 Jan 2010 18:29:12 -0000	1.7
>  +++ rpm/js/rpmmpf-js.c	3 Jun 2011 16:32:15 -0000	1.8
>  @@ -48,8 +48,14 @@
>   #define	_RPMMPF_PAGESIZE	(4 * BUFSIZ)
> 
>   static JSBool
>  -rpmmpf_Close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_Close(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       uint32_t _flags = 0;
>  @@ -58,7 +64,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (mpf == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -67,7 +73,7 @@
>   	if (ret)
>   	    fprintf(stderr, "DB_MPOOLFILE->close: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	mpf = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -78,8 +84,14 @@
>   }
> 
>   static JSBool
>  -rpmmpf_Get(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_Get(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       JSObject * o = NULL;
>  @@ -90,7 +102,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (mpf == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags)))
>   	goto exit;
>  @@ -107,7 +119,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -119,8 +131,14 @@
>   }
> 
>   static JSBool
>  -rpmmpf_Open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_Open(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       char * _file = NULL;
>  @@ -133,7 +151,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (mpf == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/suiu", &_file, &_flags, &_mode, &_pagesize)))
>   	goto exit;
>  @@ -146,7 +164,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -158,8 +176,14 @@
>   }
> 
>   static JSBool
>  -rpmmpf_Put(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_Put(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       DB_CACHE_PRIORITY _priority = DB_PRIORITY_UNCHANGED;
>  @@ -168,7 +192,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (mpf == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_priority)))
>   	goto exit;
>  @@ -179,11 +203,11 @@
>   	switch (ret) {
>   	default:
>   	    fprintf(stderr, "DB_MPOOLFILE->put: %s\n", db_strerror(ret));
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>       }
>  @@ -195,8 +219,14 @@
>   }
> 
>   static JSBool
>  -rpmmpf_Sync(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_Sync(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -204,12 +234,12 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (mpf == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	int ret = mpf->sync(mpf);
>   	if (ret)
>   	    fprintf(stderr, "DB_MPOOLFILE->sync: %s\n", db_strerror(ret));
>  -	*rval = (!ret ? JSVAL_TRUE : JSVAL_FALSE);
>  +	JS_SET_RVAL(cx, vp, (!ret ? JSVAL_TRUE : JSVAL_FALSE));
>       }
> 
>       ok = JS_TRUE;
>  @@ -219,11 +249,11 @@
>   }
> 
>   static JSFunctionSpec rpmmpf_funcs[] = {
>  -    JS_FS("close",	rpmmpf_Close,		0,0,0),
>  -    JS_FS("get",	rpmmpf_Get,		0,0,0),
>  -    JS_FS("open",	rpmmpf_Open,		0,0,0),
>  -    JS_FS("put",	rpmmpf_Put,		0,0,0),
>  -    JS_FS("sync",	rpmmpf_Sync,		0,0,0),
>  +    JS_FS("close",	rpmmpf_Close,		0,0),
>  +    JS_FS("get",	rpmmpf_Get,		0,0),
>  +    JS_FS("open",	rpmmpf_Open,		0,0),
>  +    JS_FS("put",	rpmmpf_Put,		0,0),
>  +    JS_FS("sync",	rpmmpf_Sync,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -268,14 +298,16 @@
>   #define	_GET_B(_test)	((_test) ? _RET_B(_i) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmmpf_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmpf_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       int32_t _i = 0;
>       uint32_t _u = 0;
>       uint32_t _gb = 0;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -308,14 +340,16 @@
>   	? JSVAL_TRUE : JSVAL_FALSE)
> 
>   static JSBool
>  -rpmmpf_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmpf_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpfClass, NULL);
>       DB_MPOOLFILE * mpf = ptr;
>       int32_t _i = 0;
>       uint32_t _u = 0;
>       uint32_t _gb = 0;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -432,18 +466,24 @@
>   }
> 
>   static JSBool
>  -rpmmpf_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>       JSBool ok = JS_FALSE;
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmmpf_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmmpfClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -452,8 +492,14 @@
>   }
> 
>   static JSBool
>  -rpmmpf_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpf_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmmpfClass, NULL);
>  @@ -478,7 +524,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmmpw-js.c
>  ============================================================================
>  $ cvs diff -u -r1.21 -r1.22 rpmmpw-js.c
>  --- rpm/js/rpmmpw-js.c	17 Jan 2010 12:16:31 -0000	1.21
>  +++ rpm/js/rpmmpw-js.c	3 Jun 2011 16:32:15 -0000	1.22
>  @@ -1762,12 +1762,13 @@
>   mpw_j2mpw(JSContext *cx, jsval v)
>   {
>       mpwObject * z = NULL;
>  +    char * s = NULL;
>       if (JSVAL_IS_INT(v))
>   	z = mpw_FromLong(JSVAL_TO_INT(v));
>       else if (JSVAL_IS_DOUBLE(v))
>  -	z = mpw_FromDouble(*JSVAL_TO_DOUBLE(v));
>  +	z = mpw_FromDouble(JSVAL_TO_DOUBLE(v));
>       else if (JSVAL_IS_STRING(v))
>  -	z = mpw_FromHEX(JS_GetStringBytes(JSVAL_TO_STRING(v)));
>  +	z = mpw_FromHEX(s = JS_EncodeString(cx, JSVAL_TO_STRING(v)));
>       else if (JSVAL_IS_OBJECT(v)) {
>   	JSObject *o = JSVAL_TO_OBJECT(v);
>   	if (OBJ_IS_MPW(cx, o))
>  @@ -1777,6 +1778,8 @@
>   fprintf(stderr, "*** %s: 0x%x[%s]\n", __FUNCTION__, (unsigned)v, v2s(cx, v));
>   assert(z != NULL);
>   }
>  +    if (s)
>  +	JS_free(cx, s);
>       return z;
>   }
> 
>  @@ -1784,8 +1787,14 @@
> 
>   /** Convert to string. */
>   static JSBool
>  -mpw_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_toString(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       jsuint _base = 10;
>       JSBool ok;
>  @@ -1793,31 +1802,44 @@
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "/u", &_base))) {
>   	/* XXX FIXME check _base is 0 or [2,36] */
>  -	*rval = mpw_format(cx, ptr, _base, 0);
>  +	JS_SET_RVAL(cx, vp, mpw_format(cx, ptr, _base, 0));
>       } else
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       return ok;
>   }
> 
>   #ifdef	NOTYET
>   /** Convert to string in base 10. */
>   static JSBool
>  -mpw_valueOf(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_valueOf(JSContext *cx, uintN argc, jsval *vp)
>  +{
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       jsuint _base = 10;
>       JSBool ok = JS_TRUE;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>  -    *rval = mpw_format(cx, ptr, _base, 0);
>  +    JS_SET_RVAL(cx, vp, mpw_format(cx, ptr, _base, 0));
>       return ok;
>   }
>   #endif
> 
>   /** Miller-Rabin prime test. */
>   static JSBool
>  -mpw_isPrime(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_isPrime(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       mpwObject * z = ptr;
>       size_t zsize = (z ? MPW_SIZE(z) : 0);
>  @@ -1839,21 +1861,27 @@
> 
>   	    mpbzero(&b);
>   	    mpbset(&b, zsize, zdata);
>  -	    *rval = mpbpprime_w(&b, &rngc, _trials, wksp)
>  -		? JSVAL_TRUE : JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, mpbpprime_w(&b, &rngc, _trials, wksp)
>  +		? JSVAL_TRUE : JSVAL_FALSE);
>   	    mpbfree(&b);
>   	} else
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	randomGeneratorContextFree(&rngc);
>       } else
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>       return ok;
>   }
> 
>   /** Return random k invertible modulo q. */
>   static JSBool
>  -mpw_randomK(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_randomK(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       mpwObject * q = ptr;
>       JSBool ok = JS_TRUE;
>  @@ -1873,20 +1901,26 @@
>   	    mpbzero(&b);
>   	    mpbset(&b, qsize, qdata);
>   	    mpbrndinv_w(&b, &rngc, wksp, wksp+qsize, wksp+2*qsize);
>  -	    ok = mpw_wrap(cx, rval, mpw_FromMPW(qsize, wksp, 0));
>  +	    ok = mpw_wrap(cx, &JS_RVAL(cx, vp), mpw_FromMPW(qsize, wksp, 0));
>   	    mpbfree(&b);
>   	} else
>  -	    *rval = JSVAL_NULL;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_NULL);
>   	randomGeneratorContextFree(&rngc);
>       } else
>  -	*rval = JSVAL_NULL;
>  +	JS_SET_RVAL(cx, vp, JSVAL_NULL);
>       return ok;
>   }
> 
>   /** Return eq(x, y). */
>   static JSBool
>  -mpw_eq(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_eq(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       JSBool ok = JS_TRUE;
> 
>  @@ -1895,8 +1929,8 @@
>   	mpwObject * x = mpw_j2mpw(cx, argv[0]);
>   	mpwObject * y = mpw_j2mpw(cx, argv[1]);
> 
>  -	*rval = ((x->ob_size * y->ob_size) > 0 && mpeqx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y)))
>  -		? JSVAL_TRUE : JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, ((x->ob_size * y->ob_size) > 0 && mpeqx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y)))
>  +		? JSVAL_TRUE : JSVAL_FALSE);
> 
>   	if (!JSVAL_IS_MPW(cx, argv[0])) x = _free(x);
>   	if (!JSVAL_IS_MPW(cx, argv[1])) y = _free(y);
>  @@ -1907,18 +1941,30 @@
> 
>   /** Return ne(x, y). */
>   static JSBool
>  -mpw_ne(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_ne(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_TRUE;
>  -    if ((ok = mpw_eq(cx, obj, argc, argv, rval)))
>  -	*rval = (*rval == JSVAL_TRUE ? JSVAL_FALSE : JSVAL_TRUE);
>  +    if ((ok = mpw_eq(cx, argc, vp)))
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE ? JSVAL_FALSE : JSVAL_TRUE);
>       return ok;
>   }
> 
>   /** Return lt(x, y). */
>   static JSBool
>  -mpw_lt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_lt(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       JSBool ok = JS_TRUE;
> 
>  @@ -1928,17 +1974,17 @@
>   	mpwObject * y = mpw_j2mpw(cx, argv[1]);
> 
>   	if (x->ob_size < 0 && y->ob_size > 0)
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	else
>   	if (x->ob_size > 0 && y->ob_size < 0)
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	else
>   	if (x->ob_size < 0 && y->ob_size < 0)
>  -	    *rval = mpgtx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? JSVAL_TRUE : JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, mpgtx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? JSVAL_TRUE : JSVAL_FALSE);
>   	if (x->ob_size > 0 && y->ob_size > 0)
>  -	    *rval = mpltx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? JSVAL_TRUE : JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, mpltx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? JSVAL_TRUE : JSVAL_FALSE);
> 
>   	if (!JSVAL_IS_MPW(cx, argv[0])) x = _free(x);
>   	if (!JSVAL_IS_MPW(cx, argv[1])) y = _free(y);
>  @@ -1949,18 +1995,30 @@
> 
>   /** Return ge(x, y). */
>   static JSBool
>  -mpw_ge(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_ge(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_TRUE;
>  -    if ((ok = mpw_lt(cx, obj, argc, argv, rval)))
>  -	*rval = (*rval == JSVAL_TRUE ? JSVAL_FALSE : JSVAL_TRUE);
>  +    if ((ok = mpw_lt(cx, argc, vp)))
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE ? JSVAL_FALSE : JSVAL_TRUE);
>       return ok;
>   }
> 
>   /** Return gt(x, y). */
>   static JSBool
>  -mpw_gt(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_gt(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       JSBool ok = JS_TRUE;
> 
>  @@ -1970,17 +2028,17 @@
>   	mpwObject * y = mpw_j2mpw(cx, argv[1]);
> 
>   	if (x->ob_size < 0 && y->ob_size > 0)
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	else
>   	if (x->ob_size > 0 && y->ob_size < 0)
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	else
>   	if (x->ob_size < 0 && y->ob_size < 0)
>  -	    *rval = mpltx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? JSVAL_TRUE : JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, mpltx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? JSVAL_TRUE : JSVAL_FALSE);
>   	if (x->ob_size > 0 && y->ob_size > 0)
>  -	    *rval = mpgtx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? JSVAL_TRUE : JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, mpgtx(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? JSVAL_TRUE : JSVAL_FALSE);
> 
>   	if (!JSVAL_IS_MPW(cx, argv[0])) x = _free(x);
>   	if (!JSVAL_IS_MPW(cx, argv[1])) y = _free(y);
>  @@ -1991,18 +2049,30 @@
> 
>   /** Return le(x, y). */
>   static JSBool
>  -mpw_le(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_le(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_TRUE;
>  -    if ((ok = mpw_gt(cx, obj, argc, argv, rval)))
>  -	*rval = (*rval == JSVAL_TRUE ? JSVAL_FALSE : JSVAL_TRUE);
>  +    if ((ok = mpw_gt(cx, argc, vp)))
>  +	JS_SET_RVAL(cx, vp, JSVAL_TRUE ? JSVAL_FALSE : JSVAL_TRUE);
>       return ok;
>   }
> 
>   /** Return min(x, y). */
>   static JSBool
>  -mpw_min(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_min(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       JSBool ok = JS_TRUE;
> 
>  @@ -2013,18 +2083,18 @@
>   	mpwObject * y = mpw_j2mpw(cx, argv[1]);
> 
>   	if (x->ob_size < 0 && y->ob_size > 0)
>  -	    *rval = argv[0];
>  +	    JS_SET_RVAL(cx, vp, argv[0]);
>   	else
>   	if (x->ob_size > 0 && y->ob_size < 0)
>  -	    *rval = argv[1];
>  +	    JS_SET_RVAL(cx, vp, argv[1]);
>   	else
>   	if (x->ob_size < 0 && y->ob_size < 0)
>  -	    *rval = mpgex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? argv[0] : argv[1];
>  +	    JS_SET_RVAL(cx, vp, mpgex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? argv[0] : argv[1]);
>   	else
>   	if (x->ob_size > 0 && y->ob_size > 0)
>  -	    *rval = mplex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? argv[0] : argv[1];
>  +	    JS_SET_RVAL(cx, vp, mplex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? argv[0] : argv[1]);
> 
>   	if (!JSVAL_IS_MPW(cx, argv[0])) x = _free(x);
>   	if (!JSVAL_IS_MPW(cx, argv[1])) y = _free(y);
>  @@ -2035,8 +2105,14 @@
> 
>   /** Return max(x, y). */
>   static JSBool
>  -mpw_max(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_max(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       JSBool ok = JS_TRUE;
> 
>  @@ -2047,18 +2123,18 @@
>   	mpwObject * y = mpw_j2mpw(cx, argv[1]);
> 
>   	if (x->ob_size < 0 && y->ob_size > 0)
>  -	    *rval = argv[1];
>  +	    JS_SET_RVAL(cx, vp, argv[1]);
>   	else
>   	if (x->ob_size > 0 && y->ob_size < 0)
>  -	    *rval = argv[0];
>  +	    JS_SET_RVAL(cx, vp, argv[0]);
>   	else
>   	if (x->ob_size < 0 && y->ob_size < 0)
>  -	    *rval = mpgex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? argv[1] : argv[0];
>  +	    JS_SET_RVAL(cx, vp, mpgex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? argv[1] : argv[0]);
>   	else
>   	if (x->ob_size > 0 && y->ob_size > 0)
>  -	    *rval = mplex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  -		? argv[1] : argv[0];
>  +	    JS_SET_RVAL(cx, vp, mplex(MPW_SIZE(x), MPW_DATA(x), MPW_SIZE(y), MPW_DATA(y))
>  +		? argv[1] : argv[0]);
> 
>   	if (!JSVAL_IS_MPW(cx, argv[0])) x = _free(x);
>   	if (!JSVAL_IS_MPW(cx, argv[1])) y = _free(y);
>  @@ -2070,14 +2146,20 @@
>   #ifdef DYING
>   /** Return random number 1 < r < b-1. */
>   static JSBool
>  -mpw_Rndm(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +mpw_Rndm(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>       JSBool ok;
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>   assert(argc == 2);
>  -    ok = mpw_wrap(cx, rval,
>  +    ok = mpw_wrap(cx, &JS_RVAL(cx, vp),
>   		mpw_ops2('R', mpw_j2mpw(cx, argv[0]), mpw_j2mpw(cx, argv[1])));
>       return ok;
>   }
>  @@ -2085,24 +2167,24 @@
> 
>   static JSFunctionSpec rpmmpw_funcs[] = {
>   #ifdef	NOTYET
>  -    JS_FS("toExponential", mpw_toExponential,	0,0,0),
>  -    JS_FS("toFixed",	mpw_toFixed,		0,0,0),
>  -    JS_FS("toLocaleString", mpw_toLocaleString,	0,0,0),
>  -    JS_FS("toSource",	mpw_toSource,		0,0,0),
>  -    JS_FS("toJSON",	mpw_toJSON,		0,0,0),
>  -    JS_FS("valueOf",	mpw_valueOf,		0,0,0),
>  +    JS_FS("toExponential", mpw_toExponential,	0,0),
>  +    JS_FS("toFixed",	mpw_toFixed,		0,0),
>  +    JS_FS("toLocaleString", mpw_toLocaleString,	0,0),
>  +    JS_FS("toSource",	mpw_toSource,		0,0),
>  +    JS_FS("toJSON",	mpw_toJSON,		0,0),
>  +    JS_FS("valueOf",	mpw_valueOf,		0,0),
>   #endif
>  -    JS_FS("toString",	mpw_toString,		0,0,0),
>  -    JS_FS("isPrime",	mpw_isPrime,		0,0,0),
>  -    JS_FS("randomK",	mpw_randomK,		0,0,0),
>  -    JS_FS("eq",		mpw_eq,			0,0,0),
>  -    JS_FS("ne",		mpw_ne,			0,0,0),
>  -    JS_FS("lt",		mpw_lt,			0,0,0),
>  -    JS_FS("ge",		mpw_ge,			0,0,0),
>  -    JS_FS("gt",		mpw_gt,			0,0,0),
>  -    JS_FS("le",		mpw_le,			0,0,0),
>  -    JS_FS("min",	mpw_min,		0,0,0),
>  -    JS_FS("max",	mpw_max,		0,0,0),
>  +    JS_FS("toString",	mpw_toString,		0,0),
>  +    JS_FS("isPrime",	mpw_isPrime,		0,0),
>  +    JS_FS("randomK",	mpw_randomK,		0,0),
>  +    JS_FS("eq",		mpw_eq,			0,0),
>  +    JS_FS("ne",		mpw_ne,			0,0),
>  +    JS_FS("lt",		mpw_lt,			0,0),
>  +    JS_FS("ge",		mpw_ge,			0,0),
>  +    JS_FS("gt",		mpw_gt,			0,0),
>  +    JS_FS("le",		mpw_le,			0,0),
>  +    JS_FS("min",	mpw_min,		0,0),
>  +    JS_FS("max",	mpw_max,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -2117,10 +2199,12 @@
>   };
> 
>   static JSBool
>  -rpmmpw_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmpw_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -2138,10 +2222,12 @@
>   }
> 
>   static JSBool
>  -rpmmpw_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmmpw_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmmpwClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -2209,6 +2295,7 @@
>   rpmmpw_init(JSContext *cx, JSObject *obj, jsval v)
>   {
>       mpwObject * z = NULL;
>  +    char * s = NULL;
> 
>   if (_debug)
>   fprintf(stderr, "==> %s(%p,%p,0x%x[%s])\n", __FUNCTION__, cx, obj, (unsigned)v, v2s(cx, v));
>  @@ -2217,17 +2304,19 @@
>   	z = mpw_FromLong((long)JSVAL_TO_INT(v));
>       } else
>       if (JSVAL_IS_DOUBLE(v)) {
>  -	double d = *(JSVAL_TO_DOUBLE(v));
>  +	double d = JSVAL_TO_DOUBLE(v);
>   	z = mpw_FromDouble(d);
>       } else
>       if (JSVAL_IS_STRING(v)) {
>  -	z = mpw_FromHEX(JS_GetStringBytes(JSVAL_TO_STRING(v)));
>  +	z = mpw_FromHEX(s = JS_EncodeString(cx, JSVAL_TO_STRING(v)));
>       } else {
>   	z = mpw_New(1);
>       }
> 
>       if (!JS_SetPrivate(cx, obj, (void *)z))
>   	z = _free(z);
>  +    if (s)
>  +	JS_free(cx, s);
>   if (_debug)
>   fprintf(stderr, "<== %s(%p,%p,0x%x[%s]) z %p\n", __FUNCTION__, cx, obj, (unsigned)v, v2s(cx, v), z);
>       return z;
>  @@ -2245,8 +2334,14 @@
>   }
> 
>   static JSBool
>  -rpmmpw_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpw_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       jsval v = JSVAL_NULL;
> 
>  @@ -2255,12 +2350,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/v", &v)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmmpw_init(cx, obj, v);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmmpwClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -2269,8 +2364,14 @@
>   }
> 
>   static JSBool
>  -rpmmpw_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmmpw_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = NULL;
>       void * ptr = NULL;
>  @@ -2287,22 +2388,24 @@
>   	/* Return a new Mpw object. */
>   	if ((o = rpmjs_NewMpwObject(cx, v)) != NULL)
>   	    ptr = z = JS_GetInstancePrivate(cx, o, &rpmmpwClass, NULL);
>  -	*rval = OBJECT_TO_JSVAL(o);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	ok = JS_TRUE;
>   	break;
>       default:
>  -	*rval = JSVAL_NULL;
>  +	JS_SET_RVAL(cx, vp, JSVAL_NULL);
>   	for (i = 0; i < argc; i++) {
>   	    v = argv[i];
> 
>   	    /* Check for operations. */
>   	    if (JSVAL_IS_STRING(v)) {
>  -		const char * s = JS_GetStringBytes(JSVAL_TO_STRING(v));
>  +		char * s = JS_EncodeString(cx, JSVAL_TO_STRING(v));
>   		size_t ns = strlen(s);
>   		int c = (ns == 1 ? *s : 0);
> 
>  -		if (ns == 0)
>  +		if (ns == 0) {
>  +		    JS_free(cx, s);
>   		    continue;
>  +		}
> 
>   		if (!strcmp(s, "**")) c = (int)'P';
>   		if (!strcmp(s, "<<")) c = (int)'<';
>  @@ -2397,6 +2500,8 @@
>   		    
>   		    break;
>   		}
>  +#warning memleaks likely to occur here
>  +		JS_free(cx, s);
>   	    } else {
>   assert(++ix < (int)argc);
>   		stack[ix] = mpw_j2mpw(cx, v);
>  @@ -2405,7 +2510,7 @@
>   	}
>   	if (ix < 0) {
>   	    ok = JS_TRUE;
>  -	    *rval = JSVAL_NULL;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_NULL);
>   	    o = NULL;
>   	    ptr = z = NULL;
>   	} else {
>  @@ -2413,8 +2518,8 @@
>   	    ptr = z = mpw_FromMPW(MPW_SIZE(x), MPW_DATA(x), 0);
>   	    if (x->ob_size < 0)
>   		z->ob_size = -z->ob_size;
>  -	    ok = mpw_wrap(cx, rval, z);
>  -	    o = JSVAL_TO_OBJECT(*rval);
>  +	    ok = mpw_wrap(cx, &JS_RVAL(cx, vp), z);
>  +	    o = JSVAL_TO_OBJECT(JS_RVAL(cx, vp));
>   	}
>   	while (ix >= 0) {
>   	    if (freeme[ix]) stack[ix] = _free(stack[ix]); freeme[ix] = 0;
>  @@ -2424,7 +2529,7 @@
>       }
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\t", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z));
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\t", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr), mpfprintln(stderr, MPW_SIZE(z), MPW_DATA(z));
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmps-js.c
>  ============================================================================
>  $ cvs diff -u -r1.18 -r1.19 rpmps-js.c
>  --- rpm/js/rpmps-js.c	10 Jan 2010 18:29:12 -0000	1.18
>  +++ rpm/js/rpmps-js.c	3 Jun 2011 16:32:15 -0000	1.19
>  @@ -23,8 +23,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmps_push(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmps_push(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmpsClass, NULL);
>       rpmps ps = ptr;
>       char *pkgNEVR;
>  @@ -49,8 +55,14 @@
>   }
> 
>   static JSBool
>  -rpmps_print(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmps_print(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmpsClass, NULL);
>       rpmps ps = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -64,8 +76,8 @@
>   }
> 
>   static JSFunctionSpec rpmps_funcs[] = {
>  -    JS_FS("push",	rpmps_push,		0,0,0),
>  -    JS_FS("print",	rpmps_print,		0,0,0),
>  +    JS_FS("push",	rpmps_push,		0,0),
>  +    JS_FS("print",	rpmps_print,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -82,7 +94,7 @@
>   };
> 
>   static JSBool
>  -rpmps_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmps_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmpsClass, NULL);
>       rpmps ps = ptr;
>  @@ -107,7 +119,7 @@
>   }
> 
>   static JSBool
>  -rpmps_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmps_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmpsClass, NULL);
>       jsint tiny = JSVAL_TO_INT(id);
>  @@ -228,19 +240,25 @@
>   }
> 
>   static JSBool
>  -rpmps_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmps_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	if (rpmps_init(cx, obj) == NULL)
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmpsClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmseq-js.c
>  ============================================================================
>  $ cvs diff -u -r1.7 -r1.8 rpmseq-js.c
>  --- rpm/js/rpmseq-js.c	10 Jan 2010 18:29:12 -0000	1.7
>  +++ rpm/js/rpmseq-js.c	3 Jun 2011 16:32:15 -0000	1.8
>  @@ -44,8 +44,14 @@
>   /* --- Object methods */
> 
>   static JSBool
>  -rpmseq_Close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_Close(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>       uint32_t _flags = 0;
>  @@ -54,7 +60,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (seq == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -63,7 +69,7 @@
>   	if (ret)
>   	    fprintf(stderr, "DB_SEQUENCE->close: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	seq = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -74,8 +80,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_Get(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_Get(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>       JSObject * o = NULL;
>  @@ -87,7 +99,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (seq == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/iu", &o, &_delta, &_flags)))
>   	goto exit;
>  @@ -107,8 +119,8 @@
>   	    break;
>   	case 0:
>   	    d = _seqno;
>  -	    if (!JS_NewNumberValue(cx, d, rval))
>  -		*rval = JSVAL_FALSE;
>  +	    if (!JS_NewNumberValue(cx, d, &JS_RVAL(cx, vp)))
>  +		JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	    break;
>   	}
>       }
>  @@ -120,8 +132,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_Open(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_Open(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>       JSObject * o = NULL;
>  @@ -134,7 +152,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (seq == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "ov/u", &o, &_kv, &_flags)))
>   	goto exit;
>  @@ -151,7 +169,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    seq->api_internal = obj;
>   	    break;
>   	}
>  @@ -164,8 +182,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_Remove(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_Remove(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>       JSObject * o = NULL;
>  @@ -176,7 +200,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (seq == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/u", &o, &_flags)))
>   	goto exit;
>  @@ -191,7 +215,7 @@
>   	    goto exit;
>   	    break;
>   	case 0:
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	    break;
>   	}
>   	seq = ptr = NULL;
>  @@ -205,8 +229,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_Stat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_Stat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>       uint32_t _flags = 0;
>  @@ -215,7 +245,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (seq == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -225,7 +255,7 @@
>   	if (ret)
>   	    fprintf(stderr, "DB_SEQUENCE->stat: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	sp = _free(sp);
>       }
> 
>  @@ -236,8 +266,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_StatPrint(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_StatPrint(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>       uint32_t _flags = 0;
>  @@ -246,7 +282,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (seq == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -255,7 +291,7 @@
>   	if (ret)
>   	    fprintf(stderr, "DB_SEQUENCE->stat_print: %s\n", db_strerror(ret));
>   	else
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -265,12 +301,12 @@
>   }
> 
>   static JSFunctionSpec rpmseq_funcs[] = {
>  -    JS_FS("close",		rpmseq_Close,		0,0,0),
>  -    JS_FS("get",		rpmseq_Get,		0,0,0),
>  -    JS_FS("open",		rpmseq_Open,		0,0,0),
>  -    JS_FS("remove",		rpmseq_Remove,		0,0,0),
>  -    JS_FS("stat",		rpmseq_Stat,		0,0,0),
>  -    JS_FS("stat_print",		rpmseq_StatPrint,	0,0,0),
>  +    JS_FS("close",		rpmseq_Close,		0,0),
>  +    JS_FS("get",		rpmseq_Get,		0,0),
>  +    JS_FS("open",		rpmseq_Open,		0,0),
>  +    JS_FS("remove",		rpmseq_Remove,		0,0),
>  +    JS_FS("stat",		rpmseq_Stat,		0,0),
>  +    JS_FS("stat_print",		rpmseq_StatPrint,	0,0),
>       JS_FS_END
>   };
> 
>  @@ -321,11 +357,13 @@
>   };
> 
>   static JSBool
>  -rpmseq_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmseq_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       jsdouble d = 0;
>       int ret;
> 
>  @@ -429,11 +467,13 @@
>   }
> 
>   static JSBool
>  -rpmseq_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmseq_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmseqClass, NULL);
>       DB_SEQUENCE * seq = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       jsdouble d = 0;
>       int ret;
> 
>  @@ -585,8 +625,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSObject * o = NULL;
>       DB * _db = NULL;
>       uint32_t _flags = 0;
>  @@ -600,12 +646,12 @@
>       if (OBJ_IS_RPMDB(cx, o))
>   	_db = JS_GetInstancePrivate(cx, o, &rpmdbClass, NULL);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmseq_init(cx, obj, _db, _flags);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmseqClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -614,8 +660,14 @@
>   }
> 
>   static JSBool
>  -rpmseq_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmseq_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmseqClass, NULL);
>  @@ -640,7 +692,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmsm-js.c
>  ============================================================================
>  $ cvs diff -u -r1.8 -r1.9 rpmsm-js.c
>  --- rpm/js/rpmsm-js.c	10 Jan 2010 18:29:12 -0000	1.8
>  +++ rpm/js/rpmsm-js.c	3 Jun 2011 16:32:15 -0000	1.9
>  @@ -71,11 +71,13 @@
>   #define	_GET_CON(_test)	((_test) ? _GET_STR(con) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmsm_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsm_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsmClass, NULL);
>       rpmsm sm = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -102,10 +104,12 @@
>   	? JSVAL_TRUE : JSVAL_FALSE)
> 
>   static JSBool
>  -rpmsm_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsm_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsmClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -195,8 +199,14 @@
>   }
> 
>   static JSBool
>  -rpmsm_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsm_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       const char * _fn = NULL;
>       unsigned int _flags = 0;
>       JSBool ok = JS_FALSE;
>  @@ -206,12 +216,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/su", &_fn, &_flags)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmsm_init(cx, obj, _fn, _flags);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmsmClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -220,38 +230,44 @@
>   }
> 
>   static JSBool
>  -rpmsm_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsm_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmsmClass, NULL);
>       JSBool ok = JS_FALSE;
>       rpmsm sm = ptr;
>  -    const char *_cmd = NULL;
>  +    char *_cmd = NULL;
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_cmd)))
>           goto exit;
> 
>       if (sm && _cmd) {
>  -	const char * av[2] = { _cmd, NULL };
>  +	char * av[2] = { _cmd, NULL };
>   	const char * result = NULL;
>   	/* XXX FIXME: pin down rc value. list returns nitems? */
>   	int rc = rpmsmRun(sm, av, &result);
> 
>   	if (rc < 0)
>  -	    *rval = JSVAL_FALSE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
>   	else if (rc == 0 || result == NULL)
>  -	    *rval = JSVAL_TRUE;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	else
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, result));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, result)));
>       } else
>  -	*rval = JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmsp-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmsp-js.c
>  --- rpm/js/rpmsp-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmsp-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -63,10 +63,12 @@
>   #define	_GET_CON(_test)	((_test) ? _GET_STR(con) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmsp_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsp_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmspClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -89,10 +91,12 @@
>   	? JSVAL_TRUE : JSVAL_FALSE)
> 
>   static JSBool
>  -rpmsp_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsp_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmspClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -185,18 +189,24 @@
>   }
> 
>   static JSBool
>  -rpmsp_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsp_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmsp_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmspClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -205,8 +215,14 @@
>   }
> 
>   static JSBool
>  -rpmsp_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsp_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmspClass, NULL);
>  @@ -229,7 +245,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmst-js.c
>  ============================================================================
>  $ cvs diff -u -r1.10 -r1.11 rpmst-js.c
>  --- rpm/js/rpmst-js.c	17 Jan 2010 12:16:31 -0000	1.10
>  +++ rpm/js/rpmst-js.c	3 Jun 2011 16:32:15 -0000	1.11
>  @@ -80,11 +80,13 @@
>   #define	_GET_I(_p, _f)   ((_p) ? INT_TO_JSVAL((int)(_p)->_f) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmst_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmst_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmstClass, NULL);
>       struct stat * st = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       time_t mytime = (time_t)0xffffffff;
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
>  @@ -127,10 +129,12 @@
>   }
> 
>   static JSBool
>  -rpmst_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmst_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmstClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -214,11 +218,12 @@
>   fprintf(stderr, "==> %s(%p,%p,%u) st %p\n", __FUNCTION__, cx, obj, (unsigned)fnv, st);
> 
>       if (JSVAL_IS_STRING(fnv)) {
>  -	const char * fn = JS_GetStringBytes(JS_ValueToString(cx, fnv));
>  +	char * fn = JS_EncodeString(cx, JS_ValueToString(cx, fnv));
>   	if (Stat(fn, st) < 0) {
>   	    /* XXX error msg */
>   	    st = _free(st);
>   	}
>  +	JS_free(cx, fn);
>       } else {
>   	st = _free(st);
>       }
>  @@ -242,8 +247,14 @@
>   }
> 
>   static JSBool
>  -rpmst_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmst_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       jsval fnv = JSVAL_VOID;
> 
>  @@ -252,12 +263,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/v", &fnv)))
>           goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmst_init(cx, obj, fnv);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmstClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -266,8 +277,14 @@
>   }
> 
>   static JSBool
>  -rpmst_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmst_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmstClass, NULL);
>  @@ -285,13 +302,13 @@
> 
>       st = ptr = rpmst_init(cx, o, fnv);
> 
>  -    *rval = OBJECT_TO_JSVAL(o);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmsw-js.c
>  ============================================================================
>  $ cvs diff -u -r1.4 -r1.5 rpmsw-js.c
>  --- rpm/js/rpmsw-js.c	10 Jan 2010 18:29:12 -0000	1.4
>  +++ rpm/js/rpmsw-js.c	3 Jun 2011 16:32:15 -0000	1.5
>  @@ -58,10 +58,12 @@
>   };
> 
>   static JSBool
>  -rpmsw_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsw_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -79,10 +81,12 @@
>   }
> 
>   static JSBool
>  -rpmsw_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsw_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmswClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -173,18 +177,24 @@
>   }
> 
>   static JSBool
>  -rpmsw_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsw_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmsw_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmswClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmsx-js.c
>  ============================================================================
>  $ cvs diff -u -r1.8 -r1.9 rpmsx-js.c
>  --- rpm/js/rpmsx-js.c	10 Jan 2010 18:29:12 -0000	1.8
>  +++ rpm/js/rpmsx-js.c	3 Jun 2011 16:32:16 -0000	1.9
>  @@ -148,10 +148,12 @@
>   #define	_GET_CON(_test)	((_test) ? _GET_STR(con) : JSVAL_VOID)
> 
>   static JSBool
>  -rpmsx_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsx_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsxClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>   #if defined(WITH_SELINUX)
>       security_context_t con = NULL;
>   #endif
>  @@ -227,11 +229,13 @@
>   	? JSVAL_TRUE : JSVAL_FALSE)
> 
>   static JSBool
>  -rpmsx_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsx_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>   #if defined(WITH_SELINUX)
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsxClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       security_context_t con = NULL;
>       int myint = 0xdeadbeef;
>       JSBool ok = JS_TRUE;
>  @@ -339,18 +343,24 @@
>   }
> 
>   static JSBool
>  -rpmsx_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsx_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmsx_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmsxClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -359,8 +369,14 @@
>   }
> 
>   static JSBool
>  -rpmsx_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsx_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmsxClass, NULL);
>  @@ -372,15 +388,15 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_fn)))
>           goto exit;
> 
>  -    *rval = (sx && _fn && (_con = rpmsxLgetfilecon(sx, _fn)) != NULL)
>  -	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID;
>  +    JS_SET_RVAL(cx, vp, (sx && _fn && (_con = rpmsxLgetfilecon(sx, _fn)) != NULL)
>  +	? STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _con)) : JSVAL_VOID);
>       _con = _free(_con);
> 
>       ok = JS_TRUE;
> 
>   exit:
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmsys-js.c
>  ============================================================================
>  $ cvs diff -u -r1.8 -r1.9 rpmsys-js.c
>  --- rpm/js/rpmsys-js.c	17 Jan 2010 12:16:31 -0000	1.8
>  +++ rpm/js/rpmsys-js.c	3 Jun 2011 16:32:16 -0000	1.9
>  @@ -60,8 +60,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmsys_access(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_access(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -71,15 +77,21 @@
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "s/u", &_path, &_mode))) {
>   	mode_t mode = _mode;
>  -	*rval = (sys && !Access(_path, mode)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Access(_path, mode)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_chmod(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_chmod(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -89,15 +101,21 @@
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "su", &_path, &_mode))) {
>   	mode_t mode = _mode;
>  -	*rval = (sys && !Chmod(_path, mode)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Chmod(_path, mode)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_chown(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_chown(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -109,8 +127,8 @@
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "s/ii", &_path, &_uid, &_gid))) {
>   	uid_t uid = _uid;
>   	gid_t gid = _gid;
>  -	*rval = (sys && !Chown(_path, uid, gid)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Chown(_path, uid, gid)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
>  @@ -119,8 +137,14 @@
>   /* XXX Chroot */
> 
>   static JSBool
>  -rpmsys_creat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_creat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -132,8 +156,8 @@
>   	mode_t mode = _mode;
>   	int flags = O_CREAT|O_WRONLY|O_TRUNC;
>   	int fdno = -1;
>  -	*rval = (sys && (fdno = open(_path, flags, mode)) >= 0
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && (fdno = open(_path, flags, mode)) >= 0
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>   	if (fdno >= 0) close(fdno);
>       }
>       return ok;
>  @@ -145,8 +169,14 @@
>   /* XXX Fstat */
> 
>   static JSBool
>  -rpmsys_lchown(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_lchown(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -158,15 +188,21 @@
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "s/ii", &_path, &_uid, &_gid))) {
>   	uid_t uid = _uid;
>   	uid_t gid = _gid;
>  -	*rval = (sys && !Lchown(_path, uid, gid)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Lchown(_path, uid, gid)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_link(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_link(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _opath = NULL;
>  @@ -175,15 +211,21 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "ss", &_opath, &_npath))) {
>  -	*rval = (sys && !Link(_opath, _npath)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Link(_opath, _npath)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_lstat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_lstat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -199,20 +241,26 @@
>   	    if ((st = memcpy(xmalloc(nb), &sb, nb)) != NULL
>   	     && (o = JS_NewObject(cx, &rpmstClass, NULL, NULL)) != NULL
>   	     && JS_SetPrivate(cx, o, (void *)st))
>  -		*rval = OBJECT_TO_JSVAL(o);
>  +		JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	    else {
>   		if (st)	st = _free(st);
>  -		*rval = JSVAL_VOID;		/* XXX goofy? */
>  +		JS_SET_RVAL(cx, vp, JSVAL_VOID);		/* XXX goofy? */
>   	    }
>   	} else
>  -	    *rval = INT_TO_JSVAL(errno);	/* XXX goofy? */
>  +	    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(errno));	/* XXX goofy? */
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_mkdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_mkdir(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -222,15 +270,21 @@
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "s/u", &_path, &_mode))) {
>   	mode_t mode = _mode;
>  -	*rval = (sys && !Mkdir(_path, mode)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Mkdir(_path, mode)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_mkfifo(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_mkfifo(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -240,15 +294,21 @@
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "su", &_path, &_mode))) {
>   	mode_t mode = _mode;
>  -	*rval = (sys && !Mkfifo(_path, mode)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Mkfifo(_path, mode)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_mknod(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_mknod(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -260,15 +320,21 @@
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "suu", &_path, &_mode, &_dev))) {
>   	mode_t mode = _mode;
>   	dev_t dev = _dev;
>  -	*rval = (sys && !Mknod(_path, mode, dev)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Mknod(_path, mode, dev)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_readlink(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_readlink(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -282,9 +348,9 @@
> 
>   	if (sys && (rc = Readlink(_path, b, nb)) >= 0) {
>   	    b[rc] = '\0';
>  -	    *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, b));
>  +	    JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(JS_NewStringCopyZ(cx, b)));
>   	} else
>  -	    *rval = INT_TO_JSVAL(errno);
>  +	    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(errno));
>       }
>       return ok;
>   }
>  @@ -292,8 +358,14 @@
>   /* XXX Realpath */
> 
>   static JSBool
>  -rpmsys_rename(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_rename(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _opath = NULL;
>  @@ -302,15 +374,21 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "ss", &_opath, &_npath))) {
>  -	*rval = (sys && !Rename(_opath, _npath)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Rename(_opath, _npath)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_rmdir(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_rmdir(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -318,15 +396,21 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "s", &_path))) {
>  -	*rval = (sys && !Rmdir(_path)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Rmdir(_path)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_stat(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_stat(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -342,20 +426,26 @@
>   	    if ((st = memcpy(xmalloc(nb), &sb, nb)) != NULL
>   	     && (o = JS_NewObject(cx, &rpmstClass, NULL, NULL)) != NULL
>   	     && JS_SetPrivate(cx, o, (void *)st))
>  -		*rval = OBJECT_TO_JSVAL(o);
>  +		JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(o));
>   	    else {
>   		if (st)	st = _free(st);
>  -		*rval = JSVAL_VOID;		/* XXX goofy? */
>  +		JS_SET_RVAL(cx, vp, JSVAL_VOID);		/* XXX goofy? */
>   	    }
>   	} else
>  -	    *rval = INT_TO_JSVAL(errno);	/* XXX goofy? */
>  +	    JS_SET_RVAL(cx, vp, INT_TO_JSVAL(errno));	/* XXX goofy? */
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_symlink(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_symlink(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _opath = NULL;
>  @@ -364,15 +454,21 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "ss", &_opath, &_npath))) {
>  -	*rval = (sys && !Symlink(_opath, _npath)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Symlink(_opath, _npath)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
> 
>   static JSBool
>  -rpmsys_unlink(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_unlink(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>       rpmsys sys = ptr;
>       const char * _path = NULL;
>  @@ -380,8 +476,8 @@
> 
>   _METHOD_DEBUG_ENTRY(_debug);
>       if ((ok = JS_ConvertArguments(cx, argc, argv, "s", &_path))) {
>  -	*rval = (sys && !Unlink(_path)
>  -		? JSVAL_ZERO : INT_TO_JSVAL(errno));
>  +	JS_SET_RVAL(cx, vp, (sys && !Unlink(_path)
>  +		? JSVAL_ZERO : INT_TO_JSVAL(errno)));
>       }
>       return ok;
>   }
>  @@ -390,22 +486,22 @@
>   /* XXX Utimes */
> 
>   static JSFunctionSpec rpmsys_funcs[] = {
>  -    JS_FS("access",	rpmsys_access,		0,0,0),
>  -    JS_FS("chmod",	rpmsys_chmod,		0,0,0),
>  -    JS_FS("chown",	rpmsys_chown,		0,0,0),
>  -    JS_FS("creat",	rpmsys_creat,		0,0,0),
>  -    JS_FS("lchown",	rpmsys_lchown,		0,0,0),
>  -    JS_FS("link",	rpmsys_link,		0,0,0),
>  -    JS_FS("lstat",	rpmsys_lstat,		0,0,0),
>  -    JS_FS("mkdir",	rpmsys_mkdir,		0,0,0),
>  -    JS_FS("mkfifo",	rpmsys_mkfifo,		0,0,0),
>  -    JS_FS("mknod",	rpmsys_mknod,		0,0,0),
>  -    JS_FS("readlink",	rpmsys_readlink,	0,0,0),
>  -    JS_FS("rename",	rpmsys_rename,		0,0,0),
>  -    JS_FS("rmdir",	rpmsys_rmdir,		0,0,0),
>  -    JS_FS("stat",	rpmsys_stat,		0,0,0),
>  -    JS_FS("symlink",	rpmsys_symlink,		0,0,0),
>  -    JS_FS("unlink",	rpmsys_unlink,		0,0,0),
>  +    JS_FS("access",	rpmsys_access,		0,0),
>  +    JS_FS("chmod",	rpmsys_chmod,		0,0),
>  +    JS_FS("chown",	rpmsys_chown,		0,0),
>  +    JS_FS("creat",	rpmsys_creat,		0,0),
>  +    JS_FS("lchown",	rpmsys_lchown,		0,0),
>  +    JS_FS("link",	rpmsys_link,		0,0),
>  +    JS_FS("lstat",	rpmsys_lstat,		0,0),
>  +    JS_FS("mkdir",	rpmsys_mkdir,		0,0),
>  +    JS_FS("mkfifo",	rpmsys_mkfifo,		0,0),
>  +    JS_FS("mknod",	rpmsys_mknod,		0,0),
>  +    JS_FS("readlink",	rpmsys_readlink,	0,0),
>  +    JS_FS("rename",	rpmsys_rename,		0,0),
>  +    JS_FS("rmdir",	rpmsys_rmdir,		0,0),
>  +    JS_FS("stat",	rpmsys_stat,		0,0),
>  +    JS_FS("symlink",	rpmsys_symlink,		0,0),
>  +    JS_FS("unlink",	rpmsys_unlink,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -463,10 +559,12 @@
>   };
> 
>   static JSBool
>  -rpmsys_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsys_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -567,10 +665,12 @@
>   }
> 
>   static JSBool
>  -rpmsys_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmsys_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmsysClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -672,18 +772,24 @@
>   }
> 
>   static JSBool
>  -rpmsys_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmsys_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmsys_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmsysClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmte-js.c
>  ============================================================================
>  $ cvs diff -u -r1.19 -r1.20 rpmte-js.c
>  --- rpm/js/rpmte-js.c	17 Jan 2010 12:16:31 -0000	1.19
>  +++ rpm/js/rpmte-js.c	3 Jun 2011 16:32:16 -0000	1.20
>  @@ -36,8 +36,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmte_ds(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmte_ds(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmteClass, NULL);
>       rpmte te = ptr;
>       rpmTag tagN = RPMTAG_NAME;
>  @@ -50,14 +56,14 @@
>       {	rpmds ds = NULL;
>   	JSObject *dso = NULL;
>   	if ((ds = rpmteDS(te, tagN)) == NULL)
>  -	    *rval = JSVAL_NULL;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_NULL);
>   	else
>   	if ((dso = JS_NewObject(cx, &rpmdsClass, NULL, NULL)) != NULL
>   	 && JS_SetPrivate(cx, dso, rpmdsLink(ds, __FUNCTION__)))
>  -	    *rval = OBJECT_TO_JSVAL(dso);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(dso));
>   	else {
>   	    ds = rpmdsFree(ds);
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	}
>       }
>       ok = JS_TRUE;
>  @@ -66,8 +72,14 @@
>   }
> 
>   static JSBool
>  -rpmte_fi(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmte_fi(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmteClass, NULL);
>       rpmte te = ptr;
>       rpmTag tagN = RPMTAG_BASENAMES;
>  @@ -80,14 +92,14 @@
>       {	rpmfi fi = NULL;
>   	JSObject *fio = NULL;
>   	if ((fi = rpmteFI(te, tagN)) == NULL)
>  -	    *rval = JSVAL_NULL;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_NULL);
>   	else
>   	if ((fio = JS_NewObject(cx, &rpmfiClass, NULL, NULL)) != NULL
>   	 && JS_SetPrivate(cx, fio, rpmfiLink(fi, __FUNCTION__)))
>  -	    *rval = OBJECT_TO_JSVAL(fio);
>  +	    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(fio));
>   	else {
>   	    fi = rpmfiFree(fi);
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	}
>       }
>       ok = JS_TRUE;
>  @@ -96,8 +108,8 @@
>   }
> 
>   static JSFunctionSpec rpmte_funcs[] = {
>  -    JS_FS("ds",		rpmte_ds,		0,0,0),
>  -    JS_FS("fi",		rpmte_fi,		0,0,0),
>  +    JS_FS("ds",		rpmte_ds,		0,0),
>  +    JS_FS("fi",		rpmte_fi,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -160,11 +172,13 @@
>   };
> 
>   static JSBool
>  -rpmte_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmte_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmteClass, NULL);
>       rpmte te = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -258,10 +272,12 @@
>   }
> 
>   static JSBool
>  -rpmte_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmte_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmteClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -365,8 +381,14 @@
>   }
> 
>   static JSBool
>  -rpmte_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmte_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
>       JSObject *tso = NULL;
>       JSObject *hdro = NULL;
>  @@ -376,14 +398,14 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "o/o", &tso, &hdro)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	rpmts ts = JS_GetInstancePrivate(cx, tso, &rpmtsClass, NULL);
>   	if (rpmte_init(cx, obj, ts, hdro) == NULL)
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmteClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmts-js.c
>  ============================================================================
>  $ cvs diff -u -r1.33 -r1.34 rpmts-js.c
>  --- rpm/js/rpmts-js.c	13 Jan 2010 19:46:00 -0000	1.33
>  +++ rpm/js/rpmts-js.c	3 Jun 2011 16:32:16 -0000	1.34
>  @@ -82,8 +82,14 @@
> 
>   /* --- Object methods */
>   static JSBool
>  -rpmts_add(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_add(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       char * pkgN = 0;
>  @@ -117,13 +123,19 @@
> 
>       ok = JS_TRUE;
>   exit:
>  -    *rval = BOOLEAN_TO_JSVAL(ok);	/* XXX return error */
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));	/* XXX return error */
>       return ok;
>   }
> 
>   static JSBool
>  -rpmts_check(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_check(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -134,13 +146,19 @@
>   	(void) rpmcliInstallCheck(ts);	/* XXX print ps for now */
>       ok = JS_TRUE;
> 
>  -    *rval = BOOLEAN_TO_JSVAL(ok);	/* XXX return error */
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));	/* XXX return error */
>       return ok;
>   }
> 
>   static JSBool
>  -rpmts_order(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_order(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -151,13 +169,19 @@
>   	(void) rpmcliInstallOrder(ts);	/* XXX print ps for now */
>       ok = JS_TRUE;
> 
>  -    *rval = BOOLEAN_TO_JSVAL(ok);	/* XXX return error */
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));	/* XXX return error */
>       return ok;
>   }
> 
>   static JSBool
>  -rpmts_run(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_run(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -173,13 +197,19 @@
>   #endif
>       ok = JS_TRUE;
> 
>  -    *rval = BOOLEAN_TO_JSVAL(ok);	/* XXX return error */
>  +    JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ok));	/* XXX return error */
>       return ok;
>   }
> 
>   static JSBool
>  -rpmts_mi(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_mi(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       jsval tagid = JSVAL_VOID;
>  @@ -195,15 +225,18 @@
> 
>       if (!JSVAL_IS_VOID(tagid)) {
>   	/* XXX TODO: make sure both tag and key were specified. */
>  +	char * s = NULL;
>   	tag = JSVAL_IS_INT(tagid)
>   		? (rpmTag) JSVAL_TO_INT(tagid)
>  -		: tagValue(JS_GetStringBytes(JS_ValueToString(cx, tagid)));
>  +		: tagValue(s = JS_EncodeString(cx, JS_ValueToString(cx, tagid)));
>  +	if (s)
>  +	    JS_free(cx, s);
>       }
> 
>       if ((mio = rpmjs_NewMiObject(cx, ts, tag, kv)) == NULL)
>   	goto exit;
> 
>  -    *rval = OBJECT_TO_JSVAL(mio);
>  +    JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(mio));
>       ok = JS_TRUE;
> 
>   exit:
>  @@ -211,8 +244,14 @@
>   }
> 
>   static JSBool
>  -rpmts_dbrebuild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_dbrebuild(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -221,17 +260,23 @@
> 
>       /* XXX rebuild requires root. */
>       if (getuid())
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       else
>  -	*rval = (ts && !rpmtsRebuildDB(ts)) ? JSVAL_TRUE : JSVAL_FALSE;
>  +	JS_SET_RVAL(cx, vp, (ts && !rpmtsRebuildDB(ts)) ? JSVAL_TRUE : JSVAL_FALSE);
>       ok = JS_TRUE;
> 
>       return ok;
>   }
> 
>   static JSBool
>  -rpmts_dbkeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_dbkeys(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>       jsval tagid = JSVAL_VOID;
>  @@ -249,10 +294,13 @@
>           goto exit;
> 
>       if (!JSVAL_IS_VOID(tagid)) {
>  +	char * s = NULL;
>   	/* XXX TODO: make sure both tag and key were specified. */
>   	tag = JSVAL_IS_INT(tagid)
>   		? (rpmTag) JSVAL_TO_INT(tagid)
>  -		: tagValue(JS_GetStringBytes(JS_ValueToString(cx, tagid)));
>  +		: tagValue(s = JS_EncodeString(cx, JS_ValueToString(cx, tagid)));
>  +	if (s)
>  +	    JS_free(cx, s);
>       }
> 
>       if (JSVAL_IS_VOID(v))
>  @@ -260,12 +308,12 @@
>       else if (JSVAL_IS_NULL(v))
>   	_pat = NULL;
>       else if (JSVAL_IS_STRING(v))
>  -	_pat = JS_GetStringBytes(JS_ValueToString(cx, v));
>  +	_pat = JS_EncodeString(cx, JS_ValueToString(cx, v));
>   #ifdef	NOTYET
>       else if (JSVAL_IS_NUMBER(v)) {
>   	uint32_t _u = 0;
>   	if (!JS_ValueToECMAUint32(cx, v, &_u)) {
>  -	    *rval = JSVAL_VOID;
>  +	    JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	    goto exit;
>   	}
>       } else
>  @@ -274,7 +322,7 @@
> 
>       switch (_mode) {
>       default:
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>   	goto exit;
>   	break;
>       case RPMMIRE_DEFAULT:
>  @@ -289,14 +337,14 @@
>   	xx = rpmtsOpenDB(ts, O_RDONLY);
> 
>       if (rpmdbMireApply(rpmtsGetRdb(ts), tag, _mode, _pat, &_av))
>  -	*rval = JSVAL_VOID;
>  +	JS_SET_RVAL(cx, vp, JSVAL_VOID);
>       else if (_av == NULL || _av[0] == NULL)
>  -	*rval = JSVAL_NULL;
>  +	JS_SET_RVAL(cx, vp, JSVAL_NULL);
>       else {
>   	int _ac = argvCount(_av);
>   	int i;
>   	JSObject * arr = JS_NewArrayObject(cx, 0, NULL);
>  -	*rval = OBJECT_TO_JSVAL(arr);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(arr));
> 
>   	for (i = 0; i < _ac; i++) {
>   	    v = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, _av[i]));
>  @@ -305,19 +353,21 @@
>       }
> 
>   exit:
>  +    if (JSVAL_IS_STRING(v))
>  +	JS_free(cx, (char*)_pat);
>       ok = JS_TRUE;
>       _av = argvFree(_av);
>       return ok;
>   }
> 
>   static JSFunctionSpec rpmts_funcs[] = {
>  -    JS_FS("add",	rpmts_add,		0,0,0),
>  -    JS_FS("check",	rpmts_check,		0,0,0),
>  -    JS_FS("order",	rpmts_order,		0,0,0),
>  -    JS_FS("run",	rpmts_run,		0,0,0),
>  -    JS_FS("mi",		rpmts_mi,		0,0,0),
>  -    JS_FS("dbrebuild",	rpmts_dbrebuild,	0,0,0),
>  -    JS_FS("dbkeys",	rpmts_dbkeys,		0,0,0),
>  +    JS_FS("add",	rpmts_add,		0,0),
>  +    JS_FS("check",	rpmts_check,		0,0),
>  +    JS_FS("order",	rpmts_order,		0,0),
>  +    JS_FS("run",	rpmts_run,		0,0),
>  +    JS_FS("mi",		rpmts_mi,		0,0),
>  +    JS_FS("dbrebuild",	rpmts_dbrebuild,	0,0),
>  +    JS_FS("dbkeys",	rpmts_dbkeys,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -366,11 +416,13 @@
>   };
> 
>   static JSBool
>  -rpmts_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmts_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>   _PROP_DEBUG_ENTRY(_debug < 0);
> 
>  @@ -465,12 +517,15 @@
>   }
> 
>   static JSBool
>  -rpmts_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmts_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtsClass, NULL);
>       rpmts ts = (rpmts)ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       int myint;
>  +    char * s = NULL;
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -497,10 +552,10 @@
>   	(void) rpmtsSetARBGoal(ts, (uint32_t)myint);
>   	break;
>       case _ROOTDIR:
>  -	(void) rpmtsSetRootDir(ts, JS_GetStringBytes(JS_ValueToString(cx, *vp)));
>  +	(void) rpmtsSetRootDir(ts, s = JS_EncodeString(cx, JS_ValueToString(cx, *vp)));
>   	break;
>       case _CURRDIR:
>  -	(void) rpmtsSetCurrDir(ts, JS_GetStringBytes(JS_ValueToString(cx, *vp)));
>  +	(void) rpmtsSetCurrDir(ts, s =JS_EncodeString(cx, JS_ValueToString(cx, *vp)));
>   	break;
>       case _CHROOTDONE:
>   	if (!JS_ValueToInt32(cx, *vp, &myint))
>  @@ -541,6 +596,9 @@
>   	break;
>       }
> 
>  +    if (s)
>  +	JS_free(cx, s);
>  +
>       return JS_TRUE;
>   }
> 
>  @@ -598,7 +656,7 @@
>   JSClass rpmtsiClass = {
>       "Tsi",
>       JSCLASS_HAS_PRIVATE,
>  -    JS_PropertyStub,  JS_PropertyStub, JS_PropertyStub, JS_PropertyStub,
>  +    JS_PropertyStub,  JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
>       JS_EnumerateStub, JS_ResolveStub,  JS_ConvertStub,  rpmtsi_dtor,
>       JSCLASS_NO_OPTIONAL_MEMBERS
>   };
>  @@ -686,19 +744,25 @@
>   }
> 
>   static JSBool
>  -rpmts_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmts_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	if (rpmts_init(cx, obj) == NULL)
>   	    goto exit;
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmtsClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmtxn-js.c
>  ============================================================================
>  $ cvs diff -u -r1.11 -r1.12 rpmtxn-js.c
>  --- rpm/js/rpmtxn-js.c	10 Jan 2010 18:29:12 -0000	1.11
>  +++ rpm/js/rpmtxn-js.c	3 Jun 2011 16:32:16 -0000	1.12
>  @@ -43,8 +43,14 @@
>   /* --- Object methods */
> 
>   static JSBool
>  -rpmtxn_Abort(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmtxn_Abort(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtxnClass, NULL);
>       DB_TXN * txn = ptr;
>       JSBool ok = JS_FALSE;
>  @@ -52,13 +58,13 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (txn == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	int ret = txn->abort(txn);
>           if (ret)
>   	    fprintf(stderr, "DB_TXN->abort: %s", db_strerror(ret));
>           else
>  -            *rval = JSVAL_TRUE;
>  +            JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	txn = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -70,8 +76,14 @@
>   }
> 
>   static JSBool
>  -rpmtxn_Commit(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmtxn_Commit(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtxnClass, NULL);
>       DB_TXN * txn = ptr;
>       uint32_t _flags = 0;
>  @@ -80,7 +92,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (txn == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/u", &_flags)))
>   	goto exit;
>  @@ -89,7 +101,7 @@
>           if (ret)
>   	    fprintf(stderr, "DB_TXN->commit: %s", db_strerror(ret));
>           else
>  -            *rval = JSVAL_TRUE;
>  +            JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	txn = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -101,8 +113,14 @@
>   }
> 
>   static JSBool
>  -rpmtxn_Discard(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmtxn_Discard(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtxnClass, NULL);
>       DB_TXN * txn = ptr;
>       uint32_t _flags = 0;
>  @@ -111,13 +129,13 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (txn == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       {	int ret = txn->discard(txn, _flags);
>           if (ret)
>   	    fprintf(stderr, "DB_TXN->discard: %s", db_strerror(ret));
>           else
>  -            *rval = JSVAL_TRUE;
>  +            JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>   	txn = ptr = NULL;
>   	(void) JS_SetPrivate(cx, obj, ptr);
>       }
>  @@ -129,8 +147,14 @@
>   }
> 
>   static JSBool
>  -rpmtxn_Prepare(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmtxn_Prepare(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtxnClass, NULL);
>       DB_TXN * txn = ptr;
>   #if !defined(DB_GID_SIZE)
>  @@ -143,7 +167,7 @@
>   _METHOD_DEBUG_ENTRY(_debug);
> 
>       if (txn == NULL) goto exit;
>  -    *rval = JSVAL_FALSE;
>  +    JS_SET_RVAL(cx, vp, JSVAL_FALSE);
> 
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "s", &_s)))
>   	goto exit;
>  @@ -154,7 +178,7 @@
>           if (ret)
>   	    fprintf(stderr, "DB_TXN->prepare: %s", db_strerror(ret));
>           else
>  -            *rval = JSVAL_TRUE;
>  +            JS_SET_RVAL(cx, vp, JSVAL_TRUE);
>       }
> 
>       ok = JS_TRUE;
>  @@ -164,10 +188,10 @@
>   }
> 
>   static JSFunctionSpec rpmtxn_funcs[] = {
>  -    JS_FS("abort",	rpmtxn_Abort,		0,0,0),
>  -    JS_FS("commit",	rpmtxn_Commit,		0,0,0),
>  -    JS_FS("discard",	rpmtxn_Discard,		0,0,0),
>  -    JS_FS("prepare",	rpmtxn_Prepare,		0,0,0),
>  +    JS_FS("abort",	rpmtxn_Abort,		0,0),
>  +    JS_FS("commit",	rpmtxn_Commit,		0,0),
>  +    JS_FS("discard",	rpmtxn_Discard,		0,0),
>  +    JS_FS("prepare",	rpmtxn_Prepare,		0,0),
>       JS_FS_END
>   };
> 
>  @@ -194,11 +218,13 @@
>   };
> 
>   static JSBool
>  -rpmtxn_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmtxn_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtxnClass, NULL);
>       DB_TXN * txn = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -227,11 +253,13 @@
>   }
> 
>   static JSBool
>  -rpmtxn_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmtxn_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmtxnClass, NULL);
>       DB_TXN * txn = ptr;
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
>       uint32_t _flags = 0;
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>  @@ -244,8 +272,9 @@
>   	    *vp = JSVAL_VOID;
>   	break;
>       case _NAME:
>  -    {	const char * _s = JS_GetStringBytes(JS_ValueToString(cx, *vp));
>  +    {	char * _s = JS_EncodeString(cx, JS_ValueToString(cx, *vp));
>   	*vp = !txn->set_name(txn, _s) ? JSVAL_TRUE : JSVAL_FALSE;
>  +	JS_free(cx, _s);
>       }	break;
>   #define	_JUMP(_v, _lbl)	_##_v:	_flags = _v;	goto _lbl
>       case _JUMP(DB_SET_LOCK_TIMEOUT,		_set_timeout);
>  @@ -361,18 +390,24 @@
>   }
> 
>   static JSBool
>  -rpmtxn_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmtxn_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       JSBool ok = JS_FALSE;
> 
>   _CTOR_DEBUG_ENTRY(_debug);
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmtxn_init(cx, obj);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmtxnClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ -381,8 +416,14 @@
>   }
> 
>   static JSBool
>  -rpmtxn_call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmtxn_call(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       /* XXX obj is the global object so lookup "this" object. */
>       JSObject * o = JSVAL_TO_OBJECT(argv[-2]);
>       void * ptr = JS_GetInstancePrivate(cx, o, &rpmtxnClass, NULL);
>  @@ -407,7 +448,7 @@
>   #endif
> 
>   if (_debug)
>  -fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, rval, o, ptr);
>  +fprintf(stderr, "<== %s(%p,%p,%p[%u],%p) o %p ptr %p\n", __FUNCTION__, cx, obj, argv, (unsigned)argc, &JS_RVAL(cx, vp), o, ptr);
> 
>       return ok;
>   }
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/js/rpmxar-js.c
>  ============================================================================
>  $ cvs diff -u -r1.5 -r1.6 rpmxar-js.c
>  --- rpm/js/rpmxar-js.c	10 Jan 2010 18:29:12 -0000	1.5
>  +++ rpm/js/rpmxar-js.c	3 Jun 2011 16:32:16 -0000	1.6
>  @@ -57,10 +57,12 @@
>   };
> 
>   static JSBool
>  -rpmxar_getprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmxar_getprop(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmxarClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -78,10 +80,12 @@
>   }
> 
>   static JSBool
>  -rpmxar_setprop(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
>  +rpmxar_setprop(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval *vp)
>   {
>       void * ptr = JS_GetInstancePrivate(cx, obj, &rpmxarClass, NULL);
>  -    jsint tiny = JSVAL_TO_INT(id);
>  +    jsval idval;
>  +    JS_IdToValue(cx, id, &idval);
>  +    jsint tiny = JSVAL_TO_INT(idval);
> 
>       /* XXX the class has ptr == NULL, instances have ptr != NULL. */
>       if (ptr == NULL)
>  @@ -218,8 +222,14 @@
>   }
> 
>   static JSBool
>  -rpmxar_ctor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
>  +rpmxar_ctor(JSContext *cx, uintN argc, jsval *vp)
>   {
>  +    jsval *argv = JS_ARGV(cx , vp);
>  +    JSObject *obj = JS_NewObjectForConstructor(cx , vp);
>  +    if(!obj) {
>  +	JS_ReportError(cx , "Failed to create 'this' object");
>  +	return JS_FALSE;
>  +    }
>       const char * _fn = "popt-1.14.xar";
>       const char * _fmode = "r";
>       JSBool ok = JS_FALSE;
>  @@ -229,12 +239,12 @@
>       if (!(ok = JS_ConvertArguments(cx, argc, argv, "/ss", &_fn, &_fmode)))
>   	goto exit;
> 
>  -    if (JS_IsConstructing(cx)) {
>  +    if (JS_IsConstructing(cx, vp)) {
>   	(void) rpmxar_init(cx, obj, _fn, _fmode);
>       } else {
>   	if ((obj = JS_NewObject(cx, &rpmxarClass, NULL, NULL)) == NULL)
>   	    goto exit;
>  -	*rval = OBJECT_TO_JSVAL(obj);
>  +	JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
>       }
>       ok = JS_TRUE;
> 
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-cvs@rpm5.org



  • application/pkcs7-signature attachment: smime.p7s
Received on Fri Jun 3 18:35:24 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.