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

LibJS: Move install_error_cause() from Object to Error

This is only used by Error and its subclasses, so it doesn't need to be
available to all objects.
This commit is contained in:
Linus Groh 2021-06-26 19:06:55 +01:00
parent a63cc2c6b9
commit dbda5a9a4c
4 changed files with 17 additions and 17 deletions

View file

@ -1125,21 +1125,6 @@ Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const
return {};
}
// 20.5.8.1 InstallErrorCause ( O, options ), https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause
void Object::install_error_cause(Value options)
{
auto& vm = this->vm();
if (!options.is_object())
return;
auto& options_object = options.as_object();
if (!options_object.has_property(vm.names.cause))
return;
auto cause = options_object.get(vm.names.cause).value_or(js_undefined());
if (vm.exception())
return;
define_property(vm.names.cause, cause, Attribute::Writable | Attribute::Configurable);
}
Value Object::invoke_internal(const StringOrSymbol& property_name, Optional<MarkedValueList> arguments)
{
auto& vm = this->vm();