summaryrefslogtreecommitdiff
path: root/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp')
-rw-r--r--Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
index 8b9f70f1b7..9861f8215d 100644
--- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
+++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator.cpp
@@ -1139,6 +1139,14 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
}
auto @cpp_name@ = JS::make_handle(&static_cast<JS::Promise&>(@js_name@@js_suffix@.as_object()));
)~~~");
+ } else if (parameter.type->name == "BufferSource") {
+ scoped_generator.append(R"~~~(
+ if (!@js_name@@js_suffix@.is_object() || !(is<JS::TypedArrayBase>(@js_name@@js_suffix@.as_object()) || is<JS::ArrayBuffer>(@js_name@@js_suffix@.as_object()) || is<JS::DataView>(@js_name@@js_suffix@.as_object())))
+ return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "@parameter.type.name@");
+
+ // TODO: Should we make this a Variant?
+ auto @cpp_name@ = JS::make_handle(&@js_name@@js_suffix@.as_object());
+)~~~");
} else if (parameter.type->name == "any") {
if (!optional) {
scoped_generator.append(R"~~~(
@@ -2756,6 +2764,7 @@ void generate_prototype_implementation(IDL::Interface const& interface)
generator.append(R"~~~(
#include <AK/Function.h>
#include <LibJS/Runtime/Array.h>
+#include <LibJS/Runtime/DataView.h>
#include <LibJS/Runtime/Error.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/GlobalObject.h>