LibWeb: Allow prototype.{entries keys,value} to propagate errors

This allows the prototype.{entries keys,value} native functions
generated by the BindingsGenerator to propagate errors if needed.
This commit is contained in:
Kenneth Myhra 2023-02-19 15:50:22 +01:00 committed by Andreas Kling
parent 1f48081ee4
commit e776171d8f
Notes: sideshowbarker 2024-07-17 04:09:56 +09:00

View file

@ -2815,7 +2815,7 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::entries)
{
auto* impl = TRY(impl_from(vm));
return @iterator_name@::create(*impl, Object::PropertyKind::KeyAndValue).ptr();
return TRY(throw_dom_exception_if_needed(vm, [&] { return @iterator_name@::create(*impl, Object::PropertyKind::KeyAndValue); }));
}
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::for_each)
@ -2844,14 +2844,14 @@ JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::keys)
{
auto* impl = TRY(impl_from(vm));
return @iterator_name@::create(*impl, Object::PropertyKind::Key).ptr();
return TRY(throw_dom_exception_if_needed(vm, [&] { return @iterator_name@::create(*impl, Object::PropertyKind::Key); }));
}
JS_DEFINE_NATIVE_FUNCTION(@prototype_class@::values)
{
auto* impl = TRY(impl_from(vm));
return @iterator_name@::create(*impl, Object::PropertyKind::Value).ptr();
return TRY(throw_dom_exception_if_needed(vm, [&] { return @iterator_name@::create(*impl, Object::PropertyKind::Value); }));
}
)~~~");
}