Bug 1437507 - Fix JSObject::setFlags to call ensureShape before checking for dictionary mode. r=jandem, a=RyanVM

--HG--
extra : source : ca6b74831ec3db204e024b07f200b0d1ce93557e
extra : intermediate-source : 9d7c295d9570e294851908465f56ec0779547d2a
This commit is contained in:
Brian Hackett 2018-02-23 13:25:53 -05:00 committed by Roy Tam
commit 95d507d246

View file

@ -1214,6 +1214,10 @@ JSObject::setFlags(ExclusiveContext* cx, BaseShape::Flag flags, GenerateShape ge
RootedObject self(cx, this);
Shape* existingShape = self->ensureShape(cx);
if (!existingShape)
return false;
if (isNative() && as<NativeObject>().inDictionaryMode()) {
if (generateShape == GENERATE_SHAPE && !as<NativeObject>().generateOwnShape(cx))
return false;
@ -1227,10 +1231,6 @@ JSObject::setFlags(ExclusiveContext* cx, BaseShape::Flag flags, GenerateShape ge
return true;
}
Shape* existingShape = self->ensureShape(cx);
if (!existingShape)
return false;
Shape* newShape = Shape::setObjectFlags(cx, flags, self->taggedProto(), existingShape);
if (!newShape)
return false;