ErrorEvent.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/HTML/ErrorEvent.h>
  7. #include <LibWeb/HTML/Window.h>
  8. namespace Web::HTML {
  9. ErrorEvent* ErrorEvent::create(HTML::Window& window_object, FlyString const& event_name, ErrorEventInit const& event_init)
  10. {
  11. return window_object.heap().allocate<ErrorEvent>(window_object.realm(), window_object, event_name, event_init);
  12. }
  13. ErrorEvent* ErrorEvent::create_with_global_object(HTML::Window& window_object, FlyString const& event_name, ErrorEventInit const& event_init)
  14. {
  15. return create(window_object, event_name, event_init);
  16. }
  17. ErrorEvent::ErrorEvent(HTML::Window& window_object, FlyString const& event_name, ErrorEventInit const& event_init)
  18. : DOM::Event(window_object, event_name)
  19. , m_message(event_init.message)
  20. , m_filename(event_init.filename)
  21. , m_lineno(event_init.lineno)
  22. , m_colno(event_init.colno)
  23. , m_error(event_init.error)
  24. {
  25. set_prototype(&window_object.cached_web_prototype("ErrorEvent"));
  26. }
  27. ErrorEvent::~ErrorEvent() = default;
  28. void ErrorEvent::visit_edges(Cell::Visitor& visitor)
  29. {
  30. Base::visit_edges(visitor);
  31. visitor.visit(m_error);
  32. }
  33. }