LibWeb: Replace incorrect empty Optional return with ByteBuffer

This function initially returned a ByteBuffer, so `return {}` was fine.
It was then changed to return Optional<ByteBuffer>, so we accidentally
started returning an empty Optional instead. Explicitly specify the
constructor name to fix this.

Thanks to DexesTTP for catching this!
This commit is contained in:
Linus Groh 2021-12-14 19:49:15 +00:00
parent 9090dea1e2
commit 5f993eecdb
Notes: sideshowbarker 2024-07-17 22:47:17 +09:00

View file

@ -105,7 +105,7 @@ Optional<ByteBuffer> get_buffer_source_copy(JS::Object const& buffer_source)
// 7. If ! IsDetachedBuffer(esArrayBuffer) is true, then return the empty byte sequence.
if (es_array_buffer->is_detached())
return {};
return ByteBuffer {};
// 8. Let bytes be a new byte sequence of length equal to length.
auto bytes = ByteBuffer::create_zeroed(length);