mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 14:18:12 +00:00
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:
parent
9b35231453
commit
83be39c91a
11 changed files with 52 additions and 24 deletions
|
@ -72,7 +72,8 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw)
|
|||
vm.throw_exception<TypeError>(global_object, ErrorType::StringRawCannotConvert, raw.is_null() ? "null" : "undefined");
|
||||
return {};
|
||||
}
|
||||
if (!raw.is_array())
|
||||
// FIXME: This should use length_of_array_like() and work with any object
|
||||
if (!raw.is_object() || !raw.as_object().is_array())
|
||||
return js_string(vm, "");
|
||||
|
||||
auto* array = static_cast<Array*>(raw.to_object(global_object));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue