mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
LibJS: Throw on detached viewed ArrayBuffer when validating TypedArrays
This commit is contained in:
parent
d5c836dd64
commit
2e9f665bda
1 changed files with 6 additions and 1 deletions
|
@ -53,7 +53,12 @@ static TypedArrayBase* typed_array_from(VM& vm, GlobalObject& global_object)
|
|||
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "TypedArray");
|
||||
return nullptr;
|
||||
}
|
||||
return static_cast<TypedArrayBase*>(this_object);
|
||||
auto* typed_array = static_cast<TypedArrayBase*>(this_object);
|
||||
if (typed_array->viewed_array_buffer()->is_detached()) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::DetachedArrayBuffer);
|
||||
return nullptr;
|
||||
}
|
||||
return typed_array;
|
||||
}
|
||||
|
||||
static Function* callback_from_args(GlobalObject& global_object, const String& name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue