Bug 1133081, part 3 - Switch from js::PropDesc to JSPropertyDescriptor for more odds and ends. r=efaust.

This commit is contained in:
Jason Orendorff
2015-02-13 19:08:21 -06:00
parent 02195cb3e6
commit 020c2fc3af
3 changed files with 49 additions and 25 deletions

View File

@@ -938,6 +938,29 @@ js::CheckPropertyDescriptorAccessors(JSContext *cx, Handle<PropertyDescriptor> d
return true;
}
void
js::CompletePropertyDescriptor(MutableHandle<PropertyDescriptor> desc)
{
if (desc.isGenericDescriptor() || desc.isDataDescriptor()) {
if (!desc.hasValue())
desc.value().setUndefined();
if (!desc.hasWritable())
desc.attributesRef() |= JSPROP_READONLY;
desc.attributesRef() &= ~(JSPROP_IGNORE_READONLY | JSPROP_IGNORE_VALUE);
} else {
if (!desc.hasGetterObject())
desc.setGetterObject(nullptr);
if (!desc.hasSetterObject())
desc.setSetterObject(nullptr);
desc.attributesRef() |= JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
}
if (!desc.hasEnumerable())
desc.attributesRef() &= ~JSPROP_ENUMERATE;
if (!desc.hasConfigurable())
desc.attributesRef() |= JSPROP_PERMANENT;
desc.attributesRef() &= ~(JSPROP_IGNORE_PERMANENT | JSPROP_IGNORE_ENUMERATE);
}
bool
js::ReadPropertyDescriptors(JSContext *cx, HandleObject props, bool checkAccessors,
AutoIdVector *ids, AutoPropertyDescriptorVector *descs)