From e74d8a600321eb3c00c300d0d3d367bc94cb4242 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Thu, 5 Dec 2024 10:19:28 +0000 Subject: [PATCH] LibWeb: Report exceptions that occur during resize observer callback --- .../LibWeb/ResizeObserver/ResizeObserver.cpp | 4 +-- .../callback-cross-realm-report-exception.txt | 6 ++++ ...callback-cross-realm-report-exception.html | 30 +++++++++++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/resize-observer/callback-cross-realm-report-exception.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/resize-observer/callback-cross-realm-report-exception.html diff --git a/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp b/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp index 0a26d455397..6100cfd1db9 100644 --- a/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp +++ b/Libraries/LibWeb/ResizeObserver/ResizeObserver.cpp @@ -109,9 +109,7 @@ void ResizeObserver::invoke_callback(ReadonlySpan> MUST(wrapped_records->create_data_property(property_index, record.ptr())); } - auto result = WebIDL::invoke_callback(callback, JS::js_undefined(), wrapped_records); - if (result.is_abrupt()) - HTML::report_exception(result, realm); + (void)WebIDL::invoke_callback(callback, JS::js_undefined(), WebIDL::ExceptionBehavior::Report, wrapped_records); } } diff --git a/Tests/LibWeb/Text/expected/wpt-import/resize-observer/callback-cross-realm-report-exception.txt b/Tests/LibWeb/Text/expected/wpt-import/resize-observer/callback-cross-realm-report-exception.txt new file mode 100644 index 00000000000..3ee00764f51 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/resize-observer/callback-cross-realm-report-exception.txt @@ -0,0 +1,6 @@ +Harness status: OK + +Found 1 tests + +1 Pass +Pass ResizeObserver reports the exception from its callback in the callback's global object \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/resize-observer/callback-cross-realm-report-exception.html b/Tests/LibWeb/Text/input/wpt-import/resize-observer/callback-cross-realm-report-exception.html new file mode 100644 index 00000000000..2e21fc61fc1 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/resize-observer/callback-cross-realm-report-exception.html @@ -0,0 +1,30 @@ + + +ResizeObserver reports the exception from its callback in the callback's global object + + + + + +