mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:17:35 +00:00
LibWeb: Add support for the BufferSource IDL parameter type
This commit is contained in:
parent
841bd680fa
commit
976ab23b9c
1 changed files with 9 additions and 0 deletions
|
@ -1138,6 +1138,14 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
@js_name@@js_suffix@ = new_promise;
|
@js_name@@js_suffix@ = new_promise;
|
||||||
}
|
}
|
||||||
auto @cpp_name@ = JS::make_handle(&static_cast<JS::Promise&>(@js_name@@js_suffix@.as_object()));
|
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") {
|
} else if (parameter.type->name == "any") {
|
||||||
if (!optional) {
|
if (!optional) {
|
||||||
|
@ -2756,6 +2764,7 @@ void generate_prototype_implementation(IDL::Interface const& interface)
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
#include <AK/Function.h>
|
#include <AK/Function.h>
|
||||||
#include <LibJS/Runtime/Array.h>
|
#include <LibJS/Runtime/Array.h>
|
||||||
|
#include <LibJS/Runtime/DataView.h>
|
||||||
#include <LibJS/Runtime/Error.h>
|
#include <LibJS/Runtime/Error.h>
|
||||||
#include <LibJS/Runtime/FunctionObject.h>
|
#include <LibJS/Runtime/FunctionObject.h>
|
||||||
#include <LibJS/Runtime/GlobalObject.h>
|
#include <LibJS/Runtime/GlobalObject.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue