Serenity Operating System
at master 40 lines 1.2 kB view raw
1/* 2 * Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#include <LibWeb/Bindings/FormDataEventPrototype.h> 8#include <LibWeb/Bindings/Intrinsics.h> 9#include <LibWeb/HTML/FormDataEvent.h> 10 11namespace Web::HTML { 12 13WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> FormDataEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init) 14{ 15 return MUST_OR_THROW_OOM(realm.heap().allocate<FormDataEvent>(realm, realm, event_name, event_init)); 16} 17 18FormDataEvent::FormDataEvent(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init) 19 : DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init) 20 , m_form_data(event_init.form_data) 21{ 22} 23 24FormDataEvent::~FormDataEvent() = default; 25 26JS::ThrowCompletionOr<void> FormDataEvent::initialize(JS::Realm& realm) 27{ 28 MUST_OR_THROW_OOM(Base::initialize(realm)); 29 set_prototype(&Bindings::ensure_web_prototype<Bindings::FormDataEventPrototype>(realm, "FormDataEvent")); 30 31 return {}; 32} 33 34void FormDataEvent::visit_edges(Cell::Visitor& visitor) 35{ 36 Base::visit_edges(visitor); 37 visitor.visit(m_form_data); 38} 39 40}