Truly independent web browser
LibWeb: Report event handler compile errors
Andreas Klingec2de1c4e1e7
diff --git a/Libraries/LibWeb/DOM/EventTarget.cpp b/Libraries/LibWeb/DOM/EventTarget.cppindex 39a76660563..2362d88c94a 100644--- a/Libraries/LibWeb/DOM/EventTarget.cpp+++ b/Libraries/LibWeb/DOM/EventTarget.cpp@@ -746,9 +746,15 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(Utf16FlySt// 1. Set eventHandler's value to null.event_handler->value = GC::Ptr<WebIDL::CallbackType> {};- // FIXME: 2. Report the error for the appropriate script and with the appropriate position (line number and column number) given by location, using settings object's global object.+ // 2. Let syntaxError be a new SyntaxError exception associated with settings object's realm which describes+ // the error while parsing. It should be based on location, where the script body originated.+ // FIXME: Base the error on location.+ auto syntax_error = JS::SyntaxError::create(settings_object.realm(), compiled_function.release_error());- // 3. Return null.+ // 3. Report an exception with syntaxError for settings object's global object.+ HTML::report_an_exception(settings_object.global_object(), syntax_error);++ // 4. Return null.return nullptr;}diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.txt b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.txtindex 50189f52107..de1800910bf 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-late.window.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Invalid uncompiled raw handlers should only be compiled when about to call them\ No newline at end of file+1 Pass+Pass Invalid uncompiled raw handlers should only be compiled when about to call them\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.txt b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.txtindex 46673440006..c3b26baaf4c 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-compiled-once.window.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Invalid uncompiled raw handlers should only be compiled once\ No newline at end of file+1 Pass+Pass Invalid uncompiled raw handlers should only be compiled once\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.txt b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.txtindex f96a7074987..c585df31bdc 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/invalid-uncompiled-raw-handler-keeps-position.window.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail Compiling invalid uncompiled raw handlers should keep the position in event listener list\ No newline at end of file+1 Pass+Pass Compiling invalid uncompiled raw handlers should keep the position in event listener list\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.txt b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.txtindex 59a3fe39d39..e62b5d4c2d2 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/compile-error-in-attribute.txt@@ -2,6 +2,6 @@ Harness status: OKFound 2 tests-2 Fail-Fail window.onerror - compile error in attribute-Fail window.onerror - compile error in attribute (column)\ No newline at end of file+2 Pass+Pass window.onerror - compile error in attribute+Pass window.onerror - compile error in attribute (column)\ No newline at end of file