1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

LibJS: Convert ArrayBuffer construction to ThrowCompletionOr

This also allows us to create TypedArrays with an existing buffer thus
clearing up an additional FIXME in TextEncoder.
This commit is contained in:
davidot 2022-02-07 13:34:32 +01:00 committed by Linus Groh
parent 4136cbdb09
commit de90d54be0
7 changed files with 30 additions and 26 deletions

View file

@ -20,9 +20,10 @@ RefPtr<ImageData> ImageData::create_with_size(JS::GlobalObject& global_object, i
dbgln("Creating ImageData with {}x{}", width, height);
auto* data = JS::Uint8ClampedArray::create(global_object, width * height * 4);
if (!data)
auto data_or_error = JS::Uint8ClampedArray::create(global_object, width * height * 4);
if (data_or_error.is_error())
return nullptr;
auto* data = data_or_error.release_value();
auto data_handle = JS::make_handle(data);