mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibWeb: Return undefined from generated setters, not an empty value
These now crash as VM::call() uses ThrowExceptionOr<T>, which refuses to hold an empty JS::Value as its non-exception result. We only need to return an empty value when should_return_empty() says so for the return value of throw_dom_exception_if_needed(). Co-authored-by: Luke Wilde <lukew@serenityos.org>
This commit is contained in:
parent
09bdb00eb0
commit
a1a164e6b8
Notes:
sideshowbarker
2024-07-18 03:30:16 +09:00
1 changed files with 5 additions and 2 deletions
|
@ -1739,12 +1739,15 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@attribute.setter_callback@)
|
|||
}
|
||||
} else {
|
||||
attribute_generator.append(R"~~~(
|
||||
[[maybe_unused]] auto retval = throw_dom_exception_if_needed(vm, global_object, [&] { return impl->set_@attribute.name:snakecase@(cpp_value); });
|
||||
auto result = throw_dom_exception_if_needed(vm, global_object, [&] { return impl->set_@attribute.name:snakecase@(cpp_value); });
|
||||
|
||||
if (should_return_empty(result))
|
||||
return JS::Value();
|
||||
)~~~");
|
||||
}
|
||||
|
||||
attribute_generator.append(R"~~~(
|
||||
return {};
|
||||
return JS::js_undefined();
|
||||
}
|
||||
)~~~");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue