mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibJS+LibWeb: Implement resizable ArrayBuffer support for TypedArray
This is (part of) a normative change in the ECMA-262 spec. See: https://github.com/tc39/ecma262/commit/a9ae96e
This commit is contained in:
committed by
Andreas Kling
parent
c7fec9424c
commit
9258d7b98a
@@ -13,7 +13,16 @@ namespace Web::WebIDL {
|
||||
|
||||
u32 BufferableObjectBase::byte_length() const
|
||||
{
|
||||
return m_bufferable_object.visit([](auto& obj) { return static_cast<u32>(obj->byte_length()); });
|
||||
return m_bufferable_object.visit(
|
||||
[](JS::NonnullGCPtr<JS::TypedArrayBase> typed_array) {
|
||||
auto typed_array_record = JS::make_typed_array_with_buffer_witness_record(typed_array, JS::ArrayBuffer::Order::SeqCst);
|
||||
return JS::typed_array_byte_length(typed_array_record);
|
||||
},
|
||||
[](JS::NonnullGCPtr<JS::DataView> data_view) {
|
||||
auto view_record = JS::make_data_view_with_buffer_witness_record(data_view, JS::ArrayBuffer::Order::SeqCst);
|
||||
return JS::get_view_byte_length(view_record);
|
||||
},
|
||||
[](JS::NonnullGCPtr<JS::ArrayBuffer> array_buffer) { return static_cast<u32>(array_buffer->byte_length()); });
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<JS::Object> BufferableObjectBase::raw_object()
|
||||
|
||||
Reference in New Issue
Block a user