mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +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
|
@ -19,7 +19,7 @@ TESTJS_GLOBAL_FUNCTION(read_binary_wasm_file, readBinaryWasmFile)
|
|||
if (file.is_error())
|
||||
return vm.throw_completion<JS::TypeError>(global_object, strerror(file.error().code()));
|
||||
auto contents = file.value()->read_all();
|
||||
auto array = JS::Uint8Array::create(global_object, contents.size());
|
||||
auto* array = TRY(JS::Uint8Array::create(global_object, contents.size()));
|
||||
contents.span().copy_to(array->data());
|
||||
return JS::Value(array);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue