Bug 879079 - Fix static rooting analysis failures from calls to defineOwnProperty; r=sfink

--HG--
extra : rebase_source : c8c491faef16ad0e1ebc4e624a54d85fd0a47029
This commit is contained in:
Terrence Cole 2013-06-05 15:08:41 -07:00
parent 9ef66bd85c
commit 62f495cd92
5 changed files with 19 additions and 19 deletions

View File

@ -408,7 +408,8 @@ DefineAccessor(JSContext *cx, unsigned argc, Value *vp)
RootedObject thisObj(cx, &args.thisv().toObject());
JSBool dummy;
if (!js_DefineOwnProperty(cx, thisObj, id, ObjectValue(*descObj), &dummy))
RootedValue descObjValue(cx, ObjectValue(*descObj));
if (!DefineOwnProperty(cx, thisObj, id, descObjValue, &dummy))
return false;
args.rval().setUndefined();
@ -855,10 +856,8 @@ obj_defineProperty(JSContext *cx, unsigned argc, Value *vp)
if (!ValueToId<CanGC>(cx, args.handleOrUndefinedAt(1), &id))
return JS_FALSE;
const Value descval = args.get(2);
JSBool junk;
if (!js_DefineOwnProperty(cx, obj, id, descval, &junk))
if (!DefineOwnProperty(cx, obj, id, args.handleOrUndefinedAt(2), &junk))
return false;
args.rval().setObject(*obj);

View File

@ -4006,15 +4006,16 @@ JS_DefineUCPropertyWithTinyId(JSContext *cx, JSObject *objArg, const jschar *nam
}
JS_PUBLIC_API(JSBool)
JS_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg, jsval descriptor, JSBool *bp)
JS_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg, jsval descriptorArg, JSBool *bp)
{
RootedObject obj(cx, objArg);
RootedId id(cx, idArg);
RootedValue descriptor(cx, descriptorArg);
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, id, descriptor);
return js_DefineOwnProperty(cx, obj, id, descriptor, bp);
return DefineOwnProperty(cx, obj, id, descriptor, bp);
}
JS_PUBLIC_API(JSObject *)

View File

@ -1093,7 +1093,7 @@ js_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg,
if (descriptor.attrs & JSPROP_SETTER)
assertSameCompartment(cx, CastAsObjectJsval(descriptor.setter));
return js_DefineOwnProperty(cx, HandleObject(obj), id, descriptor, bp);
return DefineOwnProperty(cx, HandleObject(obj), id, descriptor, bp);
}
JS_FRIEND_API(JSBool)

View File

@ -999,8 +999,8 @@ js::DefineProperty(JSContext *cx, HandleObject obj, HandleId id, const PropDesc
}
JSBool
js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &descriptor,
JSBool *bp)
js::DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue descriptor,
JSBool *bp)
{
AutoPropDescArrayRooter descs(cx);
PropDesc *desc = descs.append();
@ -1015,8 +1015,8 @@ js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, const Value &
}
JSBool
js_DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id,
const PropertyDescriptor &descriptor, JSBool *bp)
js::DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id,
const PropertyDescriptor &descriptor, JSBool *bp)
{
AutoPropDescArrayRooter descs(cx);
PropDesc *desc = descs.append();

View File

@ -1177,16 +1177,16 @@ js_AddNativeProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JSPropertyOp getter, JSStrictPropertyOp setter, uint32_t slot,
unsigned attrs, unsigned flags, int shortid);
extern JSBool
js_DefineOwnProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
const JS::Value &descriptor, JSBool *bp);
extern JSBool
js_DefineOwnProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
const js::PropertyDescriptor &descriptor, JSBool *bp);
namespace js {
extern JSBool
DefineOwnProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
JS::HandleValue descriptor, JSBool *bp);
extern JSBool
DefineOwnProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id,
const js::PropertyDescriptor &descriptor, JSBool *bp);
/*
* The NewObjectKind allows an allocation site to specify the type properties
* and lifetime requirements that must be fixed at allocation time.