From 9ee7d4d90a0f029e154c796c51650096143446e4 Mon Sep 17 00:00:00 2001 From: rmg-x Date: Sat, 9 Nov 2024 14:27:57 -0600 Subject: [PATCH] LibWeb: Add builtin Float16Array type and remove related FIXME --- Libraries/LibWeb/Crypto/Crypto.cpp | 1 - .../CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp | 3 ++- Tests/LibWeb/Text/expected/all-window-properties.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/Crypto/Crypto.cpp b/Libraries/LibWeb/Crypto/Crypto.cpp index 8485d3c7408..b7293039477 100644 --- a/Libraries/LibWeb/Crypto/Crypto.cpp +++ b/Libraries/LibWeb/Crypto/Crypto.cpp @@ -51,7 +51,6 @@ WebIDL::ExceptionOr> Crypto::get_random_valu return WebIDL::TypeMismatchError::create(realm(), "array must be one of Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array"_string); auto const& typed_array = *array->bufferable_object().get>(); - // Still need to exclude Float32Array, and potential future siblings like Float16Array: if (!typed_array.element_name().is_one_of("Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array", "Int32Array", "Uint32Array", "BigInt64Array", "BigUint64Array")) return WebIDL::TypeMismatchError::create(realm(), "array must be one of Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, BigInt64Array, or BigUint64Array"_string); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 1b41fee58bd..3d1728e7367 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -121,6 +121,7 @@ static bool is_javascript_builtin(Type const& type) // might simply need to add another type here. static constexpr Array types = { "ArrayBuffer"sv, + "Float16Array"sv, "Float32Array"sv, "Float64Array"sv, "Uint8Array"sv, @@ -1256,7 +1257,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter // 1. If types includes a typed array type whose name is the value of V’s [[TypedArrayName]] internal slot, then return the result of converting V to that type. // 2. If types includes object, then return the IDL value that is a reference to the object V. auto has_typed_array_name = any_of(types, [](auto const& type) { - return type->name().is_one_of("Int8Array"sv, "Int16Array"sv, "Int32Array"sv, "Uint8Array"sv, "Uint16Array"sv, "Uint32Array"sv, "Uint8ClampedArray"sv, "BigInt64Array"sv, "BigUint64Array", "Float32Array"sv, "Float64Array"sv); + return type->name().is_one_of("Int8Array"sv, "Int16Array"sv, "Int32Array"sv, "Uint8Array"sv, "Uint16Array"sv, "Uint32Array"sv, "Uint8ClampedArray"sv, "BigInt64Array"sv, "BigUint64Array", "Float16Array"sv, "Float32Array"sv, "Float64Array"sv); }); if (has_typed_array_name || includes_object) { diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt index 92fc025af76..5613d0a6c24 100644 --- a/Tests/LibWeb/Text/expected/all-window-properties.txt +++ b/Tests/LibWeb/Text/expected/all-window-properties.txt @@ -107,6 +107,7 @@ FileList FileReader FileSystemEntry FinalizationRegistry +Float16Array Float32Array Float64Array FocusEvent