1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

LibJS: Pass Realm to define_native_{accessor,function}()

This is needed so that the allocated NativeFunction receives the correct
realm, usually forwarded from the Object's initialize() function, rather
than using the current realm.
This commit is contained in:
Linus Groh 2022-08-22 21:47:35 +01:00
parent 7c468b5a77
commit e3895e6c80
116 changed files with 893 additions and 890 deletions

View file

@ -1117,6 +1117,7 @@ Object* create_mapped_arguments_object(VM& vm, FunctionObject& function, Vector<
// 2. Let p be MakeArgSetter(name, env).
// 3. Perform ! map.[[DefineOwnProperty]](! ToString(𝔽(index)), PropertyDescriptor { [[Set]]: p, [[Get]]: g, [[Enumerable]]: false, [[Configurable]]: true }).
object->parameter_map().define_native_accessor(
realm,
PropertyKey { index },
[&environment, name](VM& vm) -> ThrowCompletionOr<Value> {
return MUST(environment.get_binding_value(vm, name, false));