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

LibJS: Reorder and add missing name & length properties to Built-ins

The specification dicatates that each built-in will have a length and
name property. (defined in that order)
This commit is contained in:
Idan Horowitz 2021-07-08 02:49:53 +03:00 committed by Linus Groh
parent 7e4b0681e1
commit eeb4c1eec9
16 changed files with 32 additions and 29 deletions

View file

@ -93,6 +93,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
vm.enqueue_promise_job(*job);
return js_undefined();
});
resolve_function->define_direct_property(vm.names.name, js_string(vm, vm.names.resolve.as_string()), Attribute::Configurable);
// 27.2.1.3.1 Promise Reject Functions, https://tc39.es/ecma262/#sec-promise-reject-functions
auto* reject_function = PromiseResolvingFunction::create(global_object(), *this, *already_resolved, [](auto& vm, auto&, auto& promise, auto& already_resolved) {
@ -103,6 +104,7 @@ Promise::ResolvingFunctions Promise::create_resolving_functions()
auto reason = vm.argument(0);
return promise.reject(reason);
});
reject_function->define_direct_property(vm.names.name, js_string(vm, vm.names.reject.as_string()), Attribute::Configurable);
return { *resolve_function, *reject_function };
}