mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
LibJS: Stop masking non-RangeError exceptions in TypedArray creation
Non-RangeError exceptions can be thrown by user implementations of valueOf (which are called by to_index), and the specification disallows changing the type of the thrown error.
This commit is contained in:
parent
3b81a7420e
commit
d713a84851
1 changed files with 5 additions and 3 deletions
|
@ -313,9 +313,11 @@ void TypedArrayBase::visit_edges(Visitor& visitor)
|
|||
\
|
||||
auto array_length = first_argument.to_index(global_object()); \
|
||||
if (vm.exception()) { \
|
||||
/* Re-throw more specific RangeError */ \
|
||||
vm.clear_exception(); \
|
||||
vm.throw_exception<RangeError>(global_object(), ErrorType::InvalidLength, "typed array"); \
|
||||
if (vm.exception()->value().is_object() && is<RangeError>(vm.exception()->value().as_object())) { \
|
||||
/* Re-throw more specific RangeError */ \
|
||||
vm.clear_exception(); \
|
||||
vm.throw_exception<RangeError>(global_object(), ErrorType::InvalidLength, "typed array"); \
|
||||
} \
|
||||
return {}; \
|
||||
} \
|
||||
if (array_length > NumericLimits<i32>::max() / sizeof(Type)) { \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue