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:
parent
4136cbdb09
commit
de90d54be0
7 changed files with 30 additions and 26 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue