LibJS: Handle Proxy with Array target in IsArray() abstract operation

This was missing from Value::is_array(), which is equivalent to the
spec's IsArray() abstract operation - it treats a Proxy value with an
Array target object as being an Array.
It can throw, so needs both the global object and an exception check
now.
This commit is contained in:
Linus Groh 2021-06-08 21:53:36 +01:00 committed by Andreas Kling
commit 83be39c91a
Notes: sideshowbarker 2024-07-18 12:35:55 +09:00
11 changed files with 52 additions and 24 deletions

View file

@ -142,7 +142,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from)
JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::is_array)
{
auto value = vm.argument(0);
return Value(value.is_array());
return Value(value.is_array(global_object));
}
JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::of)