Bug 1002737 - Assert more about PropDesc definedness in various functions. (r=jorendorff)

This commit is contained in:
Eric Faust 2014-06-03 12:37:44 -07:00
parent 42141896c8
commit ec2494e5cc

View File

@ -275,6 +275,8 @@ js::NewPropertyDescriptorObject(JSContext *cx, Handle<PropertyDescriptor> desc,
void
PropDesc::initFromPropertyDescriptor(Handle<PropertyDescriptor> desc)
{
MOZ_ASSERT(isUndefined());
isUndefined_ = false;
descObj_ = nullptr;
attrs = uint8_t(desc.attributes());
@ -433,6 +435,8 @@ HasProperty(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp,
bool
PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
{
MOZ_ASSERT(isUndefined());
RootedValue v(cx, origval);
/* 8.10.5 step 1 */
@ -535,6 +539,8 @@ PropDesc::initialize(JSContext *cx, const Value &origval, bool checkAccessors)
void
PropDesc::complete()
{
MOZ_ASSERT(!isUndefined());
if (isGenericDescriptor() || isDataDescriptor()) {
if (!hasValue_) {
hasValue_ = true;