LibWeb: Fix crash accessing 'empty' PromiseRejectionEvent reason

The 'reason' was getting initialized to 'empty' state when not
provided through the constructor, which results in a crash when
accessed through throw_dom_exception_if_needed in the generated
IDL getter.
This commit is contained in:
Shannon Booth 2024-12-03 03:05:15 +13:00 committed by Andreas Kling
commit 6ac018bcb6
Notes: github-actions[bot] 2024-12-02 23:20:42 +00:00
3 changed files with 62 additions and 1 deletions

View file

@ -17,7 +17,7 @@ namespace Web::HTML {
struct PromiseRejectionEventInit : public DOM::EventInit {
GC::Root<JS::Object> promise;
JS::Value reason;
JS::Value reason { JS::js_undefined() };
};
class PromiseRejectionEvent final : public DOM::Event {