From 9743849ddb0df68edb1e8fbd21aa013d43668128 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 18 Sep 2022 12:50:01 +0200 Subject: [PATCH] LibWeb: Allow passing null to a nullable IDL union type This fixes an issue on Twitter where they were instantiating an IntersectionObserver with a null root. The root IDL type is `(Element or Document)?` so null needs to be allowed. --- .../CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp index e009eb0f7f..5f1d32e6e2 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/WrapperGenerator/IDLGenerators.cpp @@ -1334,7 +1334,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter if (!optional_default_value.has_value() || optional_default_value == "null"sv) { union_generator.append(R"~~~( Optional<@union_type@> @cpp_name@; - if (!@js_name@@js_suffix@.is_undefined()) + if (!@js_name@@js_suffix@.is_nullish()) @cpp_name@ = TRY(@js_name@@js_suffix@_to_variant(@js_name@@js_suffix@)); )~~~"); } else {