mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +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:
committed by
Andreas Kling
parent
9b35231453
commit
83be39c91a
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user