diff --git a/js/src/builtin/Object.cpp b/js/src/builtin/Object.cpp index 5e8e4e246e0..fe1f61ea7ca 100644 --- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -736,13 +736,14 @@ obj_create(JSContext *cx, unsigned argc, Value *vp) static JSBool obj_getOwnPropertyDescriptor(JSContext *cx, unsigned argc, Value *vp) { + CallArgs args = CallArgsFromVp(argc, vp); RootedObject obj(cx); if (!GetFirstArgumentAsObject(cx, argc, vp, "Object.getOwnPropertyDescriptor", &obj)) return JS_FALSE; RootedId id(cx); - if (!ValueToId(cx, argc >= 2 ? vp[3] : UndefinedValue(), &id)) + if (!ValueToId(cx, args.length() > 1 ? args[1] : UndefinedValue(), &id)) return JS_FALSE; - return GetOwnPropertyDescriptor(cx, obj, id, vp); + return GetOwnPropertyDescriptor(cx, obj, id, args.rval()); } static JSBool diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 046818235c0..e47d1dab7f1 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -4162,7 +4162,11 @@ JS_GetOwnPropertyDescriptor(JSContext *cx, JSObject *objArg, jsid idArg, jsval * AssertHeapIsIdle(cx); CHECK_REQUEST(cx); - return GetOwnPropertyDescriptor(cx, obj, id, vp); + RootedValue value(cx); + if (!GetOwnPropertyDescriptor(cx, obj, id, &value)) + return false; + *vp = value; + return true; } static JSBool diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index a3894f895f4..9da60b38dcb 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -293,11 +293,11 @@ js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, } bool -js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, Value *vp) +js::GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp) { AutoPropertyDescriptorRooter desc(cx); return GetOwnPropertyDescriptor(cx, obj, id, &desc) && - NewPropertyDescriptorObject(cx, &desc, vp); + NewPropertyDescriptorObject(cx, &desc, vp.address()); } bool diff --git a/js/src/jsobj.h b/js/src/jsobj.h index bce2fbe60e7..9920d949cea 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -1312,7 +1312,7 @@ bool GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, PropertyDescriptor *desc); bool -GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, Value *vp); +GetOwnPropertyDescriptor(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp); bool NewPropertyDescriptorObject(JSContext *cx, const PropertyDescriptor *desc, Value *vp);