mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 00:31:14 +00:00
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.
This commit is contained in:
parent
0ca1b4b123
commit
9743849ddb
Notes:
sideshowbarker
2024-07-17 08:37:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/9743849ddb
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue