Backport of mrbkap's fix for bug 509075. r=mrbkap, a=dveditz
authorJohnny Stenback <jst@mozilla.com>
Mon, 27 Sep 2010 16:30:43 -0700
changeset 34616 6f77c13209a82651042af86cb17e784e465e0254
parent 34615 f2cfe1e0111fe4394ef1cdb0a755337e4f7901b3
child 34617 bf0d8cb609598d9f69875293ddc14cd9cf0f20e4
push id1590
push userjst@mozilla.com
push dateMon, 27 Sep 2010 23:31:05 +0000
reviewersmrbkap, dveditz
bugs509075
milestone1.9.2.11pre
Backport of mrbkap's fix for bug 509075. r=mrbkap, a=dveditz
js/src/xpconnect/src/xpcquickstubs.cpp
--- a/js/src/xpconnect/src/xpcquickstubs.cpp
+++ b/js/src/xpconnect/src/xpcquickstubs.cpp
@@ -231,26 +231,33 @@ ReifyPropertyOps(JSContext *cx, JSObject
         *setterobjp = setterobj;
     return JS_DefinePropertyById(cx, obj, interned_id, JSVAL_VOID,
                                  JS_DATA_TO_FUNC_PTR(JSPropertyOp, getterobj),
                                  JS_DATA_TO_FUNC_PTR(JSPropertyOp, setterobj),
                                  attrs);
 }
 
 static JSBool
-LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, jsval *vp)
+LookupGetterOrSetter(JSContext *cx, JSBool wantGetter, uintN argc, jsval *vp)
 {
     uintN attrs;
     JSBool found;
     JSPropertyOp getter, setter;
     JSObject *obj2;
     jsid interned_id;
     jsval v;
 
     XPC_QS_ASSERT_CONTEXT_OK(cx);
+
+    if(argc == 0)
+    {
+        JS_SET_RVAL(cx, vp, JSVAL_VOID);
+        return JS_TRUE;
+    }
+
     JSObject *obj = JS_THIS_OBJECT(cx, vp);
     if (!obj)
         return JS_FALSE;
     jsval idval = JS_ARGV(cx, vp)[0];
 
     const char *name = JSVAL_IS_STRING(idval)
                        ? JS_GetStringBytes(JSVAL_TO_STRING(idval))
                        : nsnull;
@@ -311,23 +318,23 @@ LookupGetterOrSetter(JSContext *cx, JSBo
     v = wantedobj ? OBJECT_TO_JSVAL(wantedobj) : JSVAL_VOID;
     JS_SET_RVAL(cx, vp, v);
     return JS_TRUE;
 }
 
 static JSBool
 SharedLookupGetter(JSContext *cx, uintN argc, jsval *vp)
 {
-    return LookupGetterOrSetter(cx, PR_TRUE, vp);
+    return LookupGetterOrSetter(cx, PR_TRUE, argc, vp);
 }
 
 static JSBool
 SharedLookupSetter(JSContext *cx, uintN argc, jsval *vp)
 {
-    return LookupGetterOrSetter(cx, PR_FALSE, vp);
+    return LookupGetterOrSetter(cx, PR_FALSE, argc, vp);
 }
 
 // XXX Hack! :-/
 JS_FRIEND_API(JSBool) js_obj_defineGetter(JSContext *cx, uintN argc, jsval *vp);
 JS_FRIEND_API(JSBool) js_obj_defineSetter(JSContext *cx, uintN argc, jsval *vp);
 
 static JSBool
 DefineGetterOrSetter(JSContext *cx, uintN argc, JSBool wantGetter, jsval *vp)