mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibJS: Add generic InvalidLength error type
We have multiple array types now, so ArrayInvalidLength has been replaced with a generic InvalidLength. Also fixes a small issue in the Array constructor, it should throw RangeError for invalid lengths, not TypeError.
This commit is contained in:
parent
5e08ae4e14
commit
6de4f1fcb3
Notes:
sideshowbarker
2024-07-19 01:05:16 +09:00
Author: https://github.com/linusg
Commit: 6de4f1fcb3
Pull-request: https://github.com/SerenityOS/serenity/pull/4307
4 changed files with 4 additions and 4 deletions
|
@ -77,7 +77,7 @@ JS_DEFINE_NATIVE_SETTER(Array::length_setter)
|
|||
if (vm.exception())
|
||||
return;
|
||||
if (length.is_nan() || length.is_infinity() || length.as_double() < 0) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::ArrayInvalidLength);
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::InvalidLength, "array");
|
||||
return;
|
||||
}
|
||||
array->indexed_properties().set_array_like_size(length.as_double());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue