mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
LibJS: Make ObjectPrototype an immutable prototype exotic object
To make this happen, this patch implements the SetImmutablePrototype abstract operation (as a method on Object) and then overrides [[SetPrototypeOf]] on ObjectPrototype.
This commit is contained in:
parent
fac8f9a94d
commit
cb20baebae
5 changed files with 41 additions and 0 deletions
|
@ -870,6 +870,26 @@ MarkedValueList Object::internal_own_property_keys() const
|
|||
return keys;
|
||||
}
|
||||
|
||||
// 10.4.7.2 SetImmutablePrototype ( O, V ), https://tc39.es/ecma262/#sec-set-immutable-prototype
|
||||
bool Object::set_immutable_prototype(Object* prototype)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
|
||||
// 1. Assert: Either Type(V) is Object or Type(V) is Null.
|
||||
|
||||
// 2. Let current be ? O.[[GetPrototypeOf]]().
|
||||
auto* current = internal_get_prototype_of();
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
// 3. If SameValue(V, current) is true, return true.
|
||||
if (prototype == current)
|
||||
return true;
|
||||
|
||||
// 4. Return false.
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<ValueAndAttributes> Object::storage_get(PropertyName const& property_name, CallNativeProperty call_native_property) const
|
||||
{
|
||||
VERIFY(property_name.is_valid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue