mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
LibJS: Set Error message attributes to writable and configurable only
20.5.1.1 Error ( message ) When the Error function is called with argument message, the following steps are taken: [...] 3b. Let msgDesc be the PropertyDescriptor { [[Value]]: msg, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. 3c. Perform ! DefinePropertyOrThrow(O, "message", msgDesc).
This commit is contained in:
parent
0e38c9b2f7
commit
f218a4b548
1 changed files with 8 additions and 4 deletions
|
@ -14,8 +14,10 @@ Error* Error::create(GlobalObject& global_object, const String& message)
|
||||||
{
|
{
|
||||||
auto& vm = global_object.vm();
|
auto& vm = global_object.vm();
|
||||||
auto* error = global_object.heap().allocate<Error>(global_object, *global_object.error_prototype());
|
auto* error = global_object.heap().allocate<Error>(global_object, *global_object.error_prototype());
|
||||||
if (!message.is_null())
|
if (!message.is_null()) {
|
||||||
error->define_property(vm.names.message, js_string(vm, message));
|
u8 attr = Attribute::Writable | Attribute::Configurable;
|
||||||
|
error->define_property(vm.names.message, js_string(vm, message), attr);
|
||||||
|
}
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +31,10 @@ Error::Error(Object& prototype)
|
||||||
{ \
|
{ \
|
||||||
auto& vm = global_object.vm(); \
|
auto& vm = global_object.vm(); \
|
||||||
auto* error = global_object.heap().allocate<ClassName>(global_object, *global_object.snake_name##_prototype()); \
|
auto* error = global_object.heap().allocate<ClassName>(global_object, *global_object.snake_name##_prototype()); \
|
||||||
if (!message.is_null()) \
|
if (!message.is_null()) { \
|
||||||
error->define_property(vm.names.message, js_string(vm, message)); \
|
u8 attr = Attribute::Writable | Attribute::Configurable; \
|
||||||
|
error->define_property(vm.names.message, js_string(vm, message), attr); \
|
||||||
|
} \
|
||||||
return error; \
|
return error; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue