Bug 828494 - Part a: Pass MutableHandleValue to GetOwnPropertyDescriptor; r=terrence

This commit is contained in:
Ms2ger 2013-01-11 09:43:00 +01:00
parent 8f1392bb58
commit 01f1ef559a
4 changed files with 11 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);