mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 08:37:35 +00:00
LibJS: Add some assertions and tests for TypedArray limitations
This commit is contained in:
parent
0e3ee03e2b
commit
7a71d4b887
2 changed files with 21 additions and 0 deletions
|
@ -132,7 +132,10 @@ protected:
|
|||
TypedArray(u32 array_length, Object& prototype)
|
||||
: TypedArrayBase(prototype)
|
||||
{
|
||||
ASSERT(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T)));
|
||||
m_viewed_array_buffer = ArrayBuffer::create(global_object(), array_length * sizeof(T));
|
||||
if (array_length)
|
||||
ASSERT(data() != nullptr);
|
||||
m_array_length = array_length;
|
||||
m_byte_length = m_viewed_array_buffer->byte_length();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue