mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Fire error event when script has an execution error
We now use the "report an exception" AO when a script has an execution error. This has mostly replaced the older "report the exception" AO in various specifications. Using this newer AO ensures that `window.onerror` is invoked when a script has an execution error.
This commit is contained in:
parent
994457d7af
commit
579a289d3d
Notes:
github-actions[bot]
2024-09-27 11:03:15 +00:00
Author: https://github.com/tcl3
Commit: 579a289d3d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1548
6 changed files with 35 additions and 4 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <LibWeb/HTML/HTMLSlotElement.h>
|
||||
#include <LibWeb/HTML/Scripting/ExceptionReporter.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
|
||||
#include <LibWeb/UIEvents/MouseEvent.h>
|
||||
#include <LibWeb/WebIDL/AbstractOperations.h>
|
||||
|
||||
|
@ -91,8 +92,10 @@ bool EventDispatcher::inner_invoke(Event& event, Vector<JS::Handle<DOM::DOMEvent
|
|||
|
||||
// If this throws an exception, then:
|
||||
if (result.is_error()) {
|
||||
// 1. Report the exception.
|
||||
HTML::report_exception(result, realm);
|
||||
// 1. Report exception for listener’s callback’s corresponding JavaScript object’s associated realm’s global object.
|
||||
auto* window_or_worker = dynamic_cast<HTML::WindowOrWorkerGlobalScopeMixin*>(&global);
|
||||
VERIFY(window_or_worker);
|
||||
window_or_worker->report_an_exception(*result.release_error().value());
|
||||
|
||||
// FIXME: 2. Set legacyOutputDidListenersThrowFlag if given. (Only used by IndexedDB currently)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue