LibWeb: Return typed array and ArrayBuffer for BufferSource in IDL union

Previous this ignored typed arrays and ArrayBuffer, hitting the
fallback JS -> C++ conversion case, typically stringifying them.
This commit is contained in:
Luke Wilde 2023-04-20 19:08:30 +01:00 committed by Andreas Kling
parent 1f863de9aa
commit 1b6492d0fb
Notes: sideshowbarker 2024-07-17 09:56:35 +09:00

View file

@ -1123,7 +1123,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
for (auto& type : types) {
if (type->name() == "BufferSource") {
union_generator.append(R"~~~(
if (is<JS::ArrayBuffer>(@js_name@@js_suffix@_object))
if (is<JS::TypedArrayBase>(@js_name@@js_suffix@_object) || is<JS::ArrayBuffer>(@js_name@@js_suffix@_object) || is<JS::DataView>(@js_name@@js_suffix@_object))
return JS::make_handle(@js_name@@js_suffix@_object);
)~~~");
}