mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibWeb: Handle nullish this_value when creating idl functions
This commit is contained in:
parent
13ef8469da
commit
60c228b914
1 changed files with 6 additions and 1 deletions
|
@ -2994,7 +2994,12 @@ void @prototype_class@::initialize(JS::GlobalObject& global_object)
|
||||||
generator.append(R"~~~(
|
generator.append(R"~~~(
|
||||||
static JS::ThrowCompletionOr<@fully_qualified_name@*> impl_from(JS::VM& vm, JS::GlobalObject& global_object)
|
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") {
|
if (interface.name == "EventTarget") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue