mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +00:00
LibWeb: Handle nullish this_value when creating idl functions
This commit is contained in:
parent
13ef8469da
commit
60c228b914
|
@ -2994,7 +2994,12 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
|||
generator.append(R"~~~(
|
||||
static JS::ThrowCompletionOr<@fully_qualified_name@*> impl_from(JS::VM& vm, JS::GlobalObject& global_object)
|
||||
{
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto this_value = vm.this_value(global_object);
|
||||
JS::Object* this_object = nullptr;
|
||||
if (this_value.is_nullish())
|
||||
this_object = &vm.current_realm()->global_object();
|
||||
else
|
||||
this_object = TRY(this_value.to_object(global_object));
|
||||
)~~~");
|
||||
|
||||
if (interface.name == "EventTarget") {
|
||||
|
|
Loading…
Reference in a new issue