Bug 1168667 - Immediately convert unboxed objects to natives in PreventExtensions, and convert unboxed arrays as well as unboxed plain objects when required, r=jandem.
This commit is contained in:
@@ -663,7 +663,7 @@ js::StandardDefineProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
if (IsAnyTypedArray(obj))
|
||||
return DefinePropertyOnTypedArray(cx, obj, id, desc, result);
|
||||
|
||||
if (obj->is<UnboxedPlainObject>() && !UnboxedPlainObject::convertToNative(cx, obj))
|
||||
if (!MaybeConvertUnboxedObjectToNative(cx, obj))
|
||||
return false;
|
||||
|
||||
if (obj->getOps()->lookupProperty) {
|
||||
@@ -2956,7 +2956,7 @@ js::SetPrototype(JSContext* cx, HandleObject obj, HandleObject proto, JS::Object
|
||||
|
||||
// Convert unboxed objects to their native representations before changing
|
||||
// their prototype/group, as they depend on the group for their layout.
|
||||
if (obj->is<UnboxedPlainObject>() && !UnboxedPlainObject::convertToNative(cx, obj))
|
||||
if (!MaybeConvertUnboxedObjectToNative(cx, obj))
|
||||
return false;
|
||||
|
||||
Rooted<TaggedProto> taggedProto(cx, TaggedProto(proto));
|
||||
@@ -2982,6 +2982,9 @@ js::PreventExtensions(JSContext* cx, HandleObject obj, ObjectOpResult& result)
|
||||
if (!obj->nonProxyIsExtensible())
|
||||
return result.succeed();
|
||||
|
||||
if (!MaybeConvertUnboxedObjectToNative(cx, obj))
|
||||
return false;
|
||||
|
||||
// Force lazy properties to be resolved.
|
||||
AutoIdVector props(cx);
|
||||
if (!js::GetPropertyKeys(cx, obj, JSITER_HIDDEN | JSITER_OWNONLY, &props))
|
||||
|
||||
Reference in New Issue
Block a user