Bug 997894 - Part 2: Replace existing externally rooted PropDesc sites with Rooted<PropDesc>. (r=terrence)

This commit is contained in:
Eric Faust
2014-06-03 12:05:48 -07:00
parent d92c03e91f
commit d3376f59e1
5 changed files with 60 additions and 145 deletions

View File

@@ -263,8 +263,7 @@ js::NewPropertyDescriptorObject(JSContext *cx, Handle<PropertyDescriptor> desc,
return true;
}
/* We have our own property, so start creating the descriptor. */
AutoPropDescRooter d(cx);
Rooted<PropDesc> d(cx);
d.initFromPropertyDescriptor(desc);
if (!d.makeObject(cx))
@@ -1062,13 +1061,12 @@ bool
js::DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id, HandleValue descriptor,
bool *bp)
{
AutoPropDescArrayRooter descs(cx);
PropDesc *desc = descs.append();
if (!desc || !desc->initialize(cx, descriptor))
Rooted<PropDesc> desc(cx);
if (!desc.initialize(cx, descriptor))
return false;
bool rval;
if (!DefineProperty(cx, obj, id, *desc, true, &rval))
if (!DefineProperty(cx, obj, id, desc, true, &rval))
return false;
*bp = !!rval;
return true;
@@ -1078,15 +1076,12 @@ bool
js::DefineOwnProperty(JSContext *cx, HandleObject obj, HandleId id,
Handle<PropertyDescriptor> descriptor, bool *bp)
{
AutoPropDescArrayRooter descs(cx);
PropDesc *desc = descs.append();
if (!desc)
return false;
Rooted<PropDesc> desc(cx);
desc->initFromPropertyDescriptor(descriptor);
desc.initFromPropertyDescriptor(descriptor);
bool rval;
if (!DefineProperty(cx, obj, id, *desc, true, &rval))
if (!DefineProperty(cx, obj, id, desc, true, &rval))
return false;
*bp = !!rval;
return true;