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

LibJS: Convert NativeFunction callback to ThrowCompletionOr

This commit is contained in:
Idan Horowitz 2021-10-19 22:53:27 +03:00 committed by Linus Groh
parent 20163c0584
commit ca27e5eff5
13 changed files with 91 additions and 65 deletions

View file

@ -201,8 +201,7 @@ void GlobalObject::initialize_global_object()
// 10.2.4.1 %ThrowTypeError% ( ), https://tc39.es/ecma262/#sec-%throwtypeerror%
m_throw_type_error_function = NativeFunction::create(global_object(), {}, [](VM& vm, GlobalObject& global_object) {
vm.throw_exception<TypeError>(global_object, ErrorType::RestrictedFunctionPropertiesAccess);
return Value();
return vm.throw_completion<TypeError>(global_object, ErrorType::RestrictedFunctionPropertiesAccess);
});
m_throw_type_error_function->define_direct_property(vm.names.length, Value(0), 0);
m_throw_type_error_function->define_direct_property(vm.names.name, js_string(vm, ""), 0);