IDLGenerators: Don't attempt to set null [PutForwards] attribute

Previously, attempting to set a `[PutForwards]` annotated attribute,
would crash if the associated getter returned null.
This commit is contained in:
Tim Ledbetter 2025-04-02 09:36:53 +01:00 committed by Sam Atkins
parent ac19b0cda8
commit b93d2b7be2
Notes: github-actions[bot] 2025-04-02 13:56:42 +00:00

View file

@ -4249,7 +4249,8 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@)
auto value = vm.argument(0);
auto receiver = TRY(throw_dom_exception_if_needed(vm, [&]() { return impl->@attribute.cpp_name@(); }));
TRY(receiver->set(JS::PropertyKey { "@put_forwards_identifier@"_fly_string, JS::PropertyKey::StringMayBeNumber::No }, value, JS::Object::ShouldThrowExceptions::Yes));
if (receiver != JS::js_null())
TRY(receiver->set(JS::PropertyKey { "@put_forwards_identifier@"_fly_string, JS::PropertyKey::StringMayBeNumber::No }, value, JS::Object::ShouldThrowExceptions::Yes));
return JS::js_undefined();
}