1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Make ExceptionOr work with non-JS::Value types

Fixes #6075.
This commit is contained in:
AnotherTest 2021-04-13 23:48:25 +04:30 committed by Andreas Kling
parent d5def1cad0
commit 8ba2b5f36f
Notes: sideshowbarker 2024-07-18 20:24:34 +09:00
2 changed files with 43 additions and 8 deletions

View file

@ -1514,9 +1514,11 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::@function.name:snakecase@)
function_generator.set(".arguments", arguments_builder.string_view());
function_generator.append(R"~~~(
auto retval = throw_dom_exception_if_needed(vm, global_object, [&] { return impl->@function.cpp_name@(@.arguments@); });
if (should_return_empty(retval))
auto result = throw_dom_exception_if_needed(vm, global_object, [&] { return impl->@function.cpp_name@(@.arguments@); });
if (should_return_empty(result))
return JS::Value();
[[maybe_unused]] auto retval = result.release_value();
)~~~");
generate_return_statement(function.return_type);