diff --git a/Libraries/LibWeb/HTML/ErrorEvent.cpp b/Libraries/LibWeb/HTML/ErrorEvent.cpp
index 9005bbb479..76a19b02d7 100644
--- a/Libraries/LibWeb/HTML/ErrorEvent.cpp
+++ b/Libraries/LibWeb/HTML/ErrorEvent.cpp
@@ -14,12 +14,14 @@ GC_DEFINE_ALLOCATOR(ErrorEvent);
GC::Ref ErrorEvent::create(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
{
- return realm.create(realm, event_name, event_init);
+ auto event = realm.create(realm, event_name, event_init);
+ event->set_is_trusted(true);
+ return event;
}
WebIDL::ExceptionOr> ErrorEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
{
- return create(realm, event_name, event_init);
+ return realm.create(realm, event_name, event_init);
}
ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/addEventListener.txt b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/addEventListener.txt
new file mode 100644
index 0000000000..41bf5503d2
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/html/webappapis/scripting/processing-model-2/addEventListener.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Pass
+Pass window.onerror - addEventListener
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/processing-model-2/addEventListener.html b/Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/processing-model-2/addEventListener.html
new file mode 100644
index 0000000000..f3e1986e38
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/html/webappapis/scripting/processing-model-2/addEventListener.html
@@ -0,0 +1,32 @@
+
+
+
+ window.onerror - addEventListener
+
+
+
+
+
+
+
+
+
+
+