Browse Source

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.
Luke Wilde 2 years ago
parent
commit
1b6492d0fb

+ 1 - 1
Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp

@@ -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);
 )~~~");
             }