diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp index 7fd578fca0..3dca3459c9 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/BindingsGenerator/IDLGenerators.cpp @@ -133,7 +133,7 @@ static DeprecatedString union_type_to_variant(UnionType const& union_type, Inter CppType idl_type_name_to_cpp_type(Type const& type, Interface const& interface) { - if (is_platform_object(type)) + if (is_platform_object(type) || type.name() == "WindowProxy"sv) return { .name = DeprecatedString::formatted("JS::Handle<{}>", type.name()), .sequence_storage_type = SequenceStorageType::MarkedVector }; if (is_javascript_builtin(type)) @@ -1103,6 +1103,21 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter )~~~"); } + bool includes_window_proxy = false; + for (auto& type : types) { + if (type->name() == "WindowProxy"sv) { + includes_window_proxy = true; + break; + } + } + + if (includes_window_proxy) { + union_generator.append(R"~~~( + if (is(@js_name@@js_suffix@_object)) + return JS::make_handle(static_cast(@js_name@@js_suffix@_object)); +)~~~"); + } + // 6. If Type(V) is Object and V has an [[ArrayBufferData]] internal slot, then // 1. If types includes ArrayBuffer, then return the result of converting V to ArrayBuffer. for (auto& type : types) { @@ -3514,6 +3529,7 @@ void generate_constructor_implementation(IDL::Interface const& interface, String #elif __has_include() # include #endif +#include #include )~~~");