Bug 1153475 - Always ignore desc.object() in DefineProperty functions that take a PropertyDescriptor argument. r=efaust.
This commit is contained in:
@@ -128,14 +128,20 @@ js::InformalValueTypeName(const Value& v)
|
||||
}
|
||||
|
||||
bool
|
||||
js::FromPropertyDescriptor(JSContext* cx, Handle<PropertyDescriptor> desc,
|
||||
MutableHandleValue vp)
|
||||
js::FromPropertyDescriptor(JSContext* cx, Handle<PropertyDescriptor> desc, MutableHandleValue vp)
|
||||
{
|
||||
if (!desc.object()) {
|
||||
vp.setUndefined();
|
||||
return true;
|
||||
}
|
||||
|
||||
return FromPropertyDescriptorToObject(cx, desc, vp);
|
||||
}
|
||||
|
||||
bool
|
||||
js::FromPropertyDescriptorToObject(JSContext* cx, Handle<PropertyDescriptor> desc,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
RootedObject obj(cx, NewBuiltinClassInstance<PlainObject>(cx));
|
||||
if (!obj)
|
||||
return false;
|
||||
@@ -968,8 +974,6 @@ js::SetIntegrityLevel(JSContext* cx, HandleObject obj, IntegrityLevel level)
|
||||
desc.setAttributes(AllowConfigureAndWritable | JSPROP_PERMANENT | JSPROP_READONLY);
|
||||
}
|
||||
|
||||
desc.object().set(obj);
|
||||
|
||||
// 8.a.i-ii. / 9.a.iii.3-4
|
||||
if (!StandardDefineProperty(cx, obj, id, desc))
|
||||
return false;
|
||||
@@ -3081,7 +3085,7 @@ js::DefineProperty(ExclusiveContext* cx, HandleObject obj, HandleId id, HandleVa
|
||||
MOZ_ASSERT(!(attrs & JSPROP_PROPOP_ACCESSORS));
|
||||
|
||||
Rooted<PropertyDescriptor> desc(cx);
|
||||
desc.initFields(obj, value, attrs, getter, setter);
|
||||
desc.initFields(NullPtr(), value, attrs, getter, setter);
|
||||
if (DefinePropertyOp op = obj->getOps()->defineProperty) {
|
||||
if (!cx->shouldBeJSContext())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user