mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1148750, part 7 - Fill in configurable and enumerable. r=efaust.
This changes MutableHandle<PropertyDescriptor>::setEnumerable() to take a boolean argument, and makes it unconditionally clear JSPROP_IGNORE_ENUMERATE, as a convenience. A similar setConfigurable() method is also added.
This commit is contained in:
parent
2c94987b4d
commit
259f08b290
@ -2701,7 +2701,14 @@ class MutablePropertyDescriptorOperations : public PropertyDescriptorOperations<
|
||||
value().set(v);
|
||||
}
|
||||
|
||||
void setEnumerable() { desc()->attrs |= JSPROP_ENUMERATE; }
|
||||
void setConfigurable(bool configurable) {
|
||||
setAttributes((desc()->attrs & ~(JSPROP_IGNORE_PERMANENT | JSPROP_PERMANENT)) |
|
||||
(configurable ? 0 : JSPROP_PERMANENT));
|
||||
}
|
||||
void setEnumerable(bool enumerable) {
|
||||
setAttributes((desc()->attrs & ~(JSPROP_IGNORE_ENUMERATE | JSPROP_ENUMERATE)) |
|
||||
(enumerable ? JSPROP_ENUMERATE : 0));
|
||||
}
|
||||
void setAttributes(unsigned attrs) { desc()->attrs = attrs; }
|
||||
|
||||
void setGetter(JSGetterOp op) {
|
||||
|
@ -1190,7 +1190,7 @@ CheckAccessorRedefinition(ExclusiveContext* cx, HandleObject obj, HandleShape sh
|
||||
}
|
||||
|
||||
static bool
|
||||
AddOrChangeProperty(ExclusiveContext *cx, HandleNativeObject obj, HandleId id,
|
||||
AddOrChangeProperty(ExclusiveContext* cx, HandleNativeObject obj, HandleId id,
|
||||
Handle<PropertyDescriptor> desc)
|
||||
{
|
||||
desc.assertComplete();
|
||||
@ -1370,6 +1370,12 @@ js::NativeDefineProperty(ExclusiveContext* cx, HandleNativeObject obj, HandleId
|
||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||
}
|
||||
|
||||
// Fill in desc.[[Configurable]] and desc.[[Enumerable]] if missing.
|
||||
if (!desc.hasConfigurable())
|
||||
desc.setConfigurable(IsConfigurable(shapeAttrs));
|
||||
if (!desc.hasEnumerable())
|
||||
desc.setEnumerable(IsEnumerable(shapeAttrs));
|
||||
|
||||
// If defining a getter or setter, we must check for its counterpart and
|
||||
// update the attributes and property ops. A getter or setter is really
|
||||
// only half of a property.
|
||||
|
Loading…
Reference in New Issue
Block a user