1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:37:34 +00:00

LibJS: Fix small issues in Array.prototype.concat

This commit is contained in:
davidot 2021-06-19 14:58:11 +02:00 committed by Linus Groh
parent 91de1135a5
commit 9d1fd403af
2 changed files with 12 additions and 2 deletions

View file

@ -531,7 +531,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat)
if (!spreadable.is_undefined())
return spreadable.to_boolean();
return object->is_array();
return val.is_array(global_object);
};
auto append_to_new_array = [&vm, &is_concat_spreadable, &new_array, &global_object, &n](Value arg) {
@ -546,7 +546,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat)
if (vm.exception())
return;
if (length + k > MAX_ARRAY_LIKE_INDEX) {
if (n + length > MAX_ARRAY_LIKE_INDEX) {
vm.throw_exception<TypeError>(global_object, ErrorType::ArrayMaxSize);
return;
}