1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:27:35 +00:00

LibJS: Fix .length attributes of various native functions

Namely the Proxy revocation, Promise resolving, Promise then/catch
finally, and Promise GetCapabilitiesExecutor functions.
They were all missing an explicit 'Attribute::Configurable' argument
and therefore incorrectly used the default attributes (writable,
enumerable, configurable).
This commit is contained in:
Linus Groh 2021-06-17 13:10:06 +01:00
parent 631d36fd98
commit d1c109be96
4 changed files with 6 additions and 5 deletions

View file

@ -25,6 +25,7 @@ PromiseCapability new_promise_capability(GlobalObject& global_object, Value cons
Value reject { js_undefined() };
} promise_capability_functions;
// 27.2.1.5.1 GetCapabilitiesExecutor Functions, https://tc39.es/ecma262/#sec-getcapabilitiesexecutor-functions
auto* executor = NativeFunction::create(global_object, "", [&promise_capability_functions](auto& vm, auto& global_object) -> Value {
auto resolve = vm.argument(0);
auto reject = vm.argument(1);
@ -41,7 +42,7 @@ PromiseCapability new_promise_capability(GlobalObject& global_object, Value cons
promise_capability_functions.reject = reject;
return js_undefined();
});
executor->define_property(vm.names.length, Value(2));
executor->define_property(vm.names.length, Value(2), Attribute::Configurable);
MarkedValueList arguments(vm.heap());
arguments.append(executor);