From 8214371ad5f77f29e9cf581bb9c07e86c87522ff Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 5 Jan 2025 20:21:22 +1300 Subject: [PATCH] LibWeb/HTML: Default ErrorEvent error to undefined This was a change in the HTML spec, see: https://github.com/whatwg/html/commit/032523196 --- Libraries/LibWeb/HTML/ErrorEvent.h | 2 +- Libraries/LibWeb/HTML/ErrorEvent.idl | 3 +- .../document-synthetic-errorevent.txt | 10 ++++ .../document-synthetic-errorevent.html | 60 +++++++++++++++++++ 4 files changed, 73 insertions(+), 2 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.txt create mode 100644 Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html diff --git a/Libraries/LibWeb/HTML/ErrorEvent.h b/Libraries/LibWeb/HTML/ErrorEvent.h index 59a87f96237..296b7958c64 100644 --- a/Libraries/LibWeb/HTML/ErrorEvent.h +++ b/Libraries/LibWeb/HTML/ErrorEvent.h @@ -17,7 +17,7 @@ struct ErrorEventInit : public DOM::EventInit { String filename; u32 lineno { 0 }; u32 colno { 0 }; - JS::Value error { JS::js_null() }; + JS::Value error { JS::js_undefined() }; }; // https://html.spec.whatwg.org/multipage/webappapis.html#errorevent diff --git a/Libraries/LibWeb/HTML/ErrorEvent.idl b/Libraries/LibWeb/HTML/ErrorEvent.idl index 874cd60b334..38d758c0d96 100644 --- a/Libraries/LibWeb/HTML/ErrorEvent.idl +++ b/Libraries/LibWeb/HTML/ErrorEvent.idl @@ -12,10 +12,11 @@ interface ErrorEvent : Event { readonly attribute any error; }; +// https://html.spec.whatwg.org/#erroreventinit dictionary ErrorEventInit : EventInit { DOMString message = ""; USVString filename = ""; unsigned long lineno = 0; unsigned long colno = 0; - any error = null; + any error; }; diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.txt b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.txt new file mode 100644 index 00000000000..5c014ded090 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.txt @@ -0,0 +1,10 @@ +Harness status: OK + +Found 5 tests + +5 Pass +Pass error event is normal (return true does not cancel; one arg) on Document, with a synthetic ErrorEvent +Pass Initial values of ErrorEvent members +Pass error member can be set to null +Pass error member can be set to undefined +Pass error member can be set to arbitrary \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html b/Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html new file mode 100644 index 00000000000..e0df4394d6d --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/events/event-handler-processing-algorithm-error/document-synthetic-errorevent.html @@ -0,0 +1,60 @@ + + +Event handlers processing algorithm: error events + + + + + +
+ +