mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:17:34 +00:00
LibWeb: Port {Mouse,UI,Wheel,}Event to new String
This ports MouseEvent, UIEvent, WheelEvent, and Event to new String. They all had a dependency to T::create() in WebDriverConnection::fire_an_event() and therefore had to be ported in the same commit.
This commit is contained in:
parent
e0002aa993
commit
ad5cbdc51b
48 changed files with 160 additions and 160 deletions
|
@ -1187,7 +1187,7 @@ WebIDL::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_ind
|
|||
// and the newURL attribute initialized to newURL.
|
||||
|
||||
// FIXME: Implement a proper HashChangeEvent class.
|
||||
auto event = DOM::Event::create(verify_cast<HTML::Window>(relevant_global_object(*new_document)).realm(), HTML::EventNames::hashchange.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto event = DOM::Event::create(verify_cast<HTML::Window>(relevant_global_object(*new_document)).realm(), HTML::EventNames::hashchange).release_value_but_fixme_should_propagate_errors();
|
||||
new_document->dispatch_event(event);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> CloseEvent::construct_impl(JS:
|
|||
}
|
||||
|
||||
CloseEvent::CloseEvent(JS::Realm& realm, FlyString const& event_name, CloseEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_was_clean(event_init.was_clean)
|
||||
, m_code(event_init.code)
|
||||
, m_reason(event_init.reason)
|
||||
|
|
|
@ -20,7 +20,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<ErrorEvent>> ErrorEvent::construct_impl(JS:
|
|||
}
|
||||
|
||||
ErrorEvent::ErrorEvent(JS::Realm& realm, FlyString const& event_name, ErrorEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string())
|
||||
: DOM::Event(realm, event_name)
|
||||
, m_message(event_init.message)
|
||||
, m_filename(event_init.filename)
|
||||
, m_lineno(event_init.lineno)
|
||||
|
|
|
@ -65,7 +65,7 @@ static void run_focus_update_steps(Vector<JS::Handle<DOM::Node>> old_chain, Vect
|
|||
// with related blur target as the related target.
|
||||
if (blur_event_target) {
|
||||
// FIXME: Implement the "fire a focus event" spec operation.
|
||||
auto blur_event = UIEvents::FocusEvent::create(blur_event_target->realm(), HTML::EventNames::blur.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto blur_event = UIEvents::FocusEvent::create(blur_event_target->realm(), HTML::EventNames::blur).release_value_but_fixme_should_propagate_errors();
|
||||
blur_event->set_related_target(related_blur_target);
|
||||
blur_event_target->dispatch_event(blur_event);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ static void run_focus_update_steps(Vector<JS::Handle<DOM::Node>> old_chain, Vect
|
|||
// with related focus target as the related target.
|
||||
if (focus_event_target) {
|
||||
// FIXME: Implement the "fire a focus event" spec operation.
|
||||
auto focus_event = UIEvents::FocusEvent::create(focus_event_target->realm(), HTML::EventNames::focus.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto focus_event = UIEvents::FocusEvent::create(focus_event_target->realm(), HTML::EventNames::focus).release_value_but_fixme_should_propagate_errors();
|
||||
focus_event->set_related_target(related_focus_target);
|
||||
focus_event_target->dispatch_event(focus_event);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> FormDataEvent::construct_im
|
|||
}
|
||||
|
||||
FormDataEvent::FormDataEvent(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_form_data(event_init.form_data)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ bool HTMLElement::fire_a_synthetic_pointer_event(DeprecatedFlyString const& type
|
|||
// 1. Let event be the result of creating an event using PointerEvent.
|
||||
// 2. Initialize event's type attribute to e.
|
||||
// FIXME: Actually create a PointerEvent!
|
||||
auto event = UIEvents::MouseEvent::create(realm(), type).release_value_but_fixme_should_propagate_errors();
|
||||
auto event = UIEvents::MouseEvent::create(realm(), FlyString::from_deprecated_fly_string(type).release_value()).release_value_but_fixme_should_propagate_errors();
|
||||
|
||||
// 3. Initialize event's bubbles and cancelable attributes to true.
|
||||
event->set_bubbles(true);
|
||||
|
|
|
@ -156,7 +156,7 @@ ErrorOr<void> HTMLFormElement::submit_form(JS::GCPtr<HTMLElement> submitter, boo
|
|||
void HTMLFormElement::reset_form()
|
||||
{
|
||||
// 1. Let reset be the result of firing an event named reset at form, with the bubbles and cancelable attributes initialized to true.
|
||||
auto reset_event = DOM::Event::create(realm(), HTML::EventNames::reset.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto reset_event = DOM::Event::create(realm(), HTML::EventNames::reset).release_value_but_fixme_should_propagate_errors();
|
||||
reset_event->set_bubbles(true);
|
||||
reset_event->set_cancelable(true);
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ void run_iframe_load_event_steps(HTML::HTMLIFrameElement& element)
|
|||
// FIXME: 4. Set childDocument's iframe load in progress flag.
|
||||
|
||||
// 5. Fire an event named load at element.
|
||||
element.dispatch_event(DOM::Event::create(element.realm(), HTML::EventNames::load.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
element.dispatch_event(DOM::Event::create(element.realm(), HTML::EventNames::load).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
// FIXME: 6. Unset childDocument's iframe load in progress flag.
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q
|
|||
set_needs_style_update(true);
|
||||
this->document().set_needs_layout();
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), EventNames::load.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), EventNames::load).release_value_but_fixme_should_propagate_errors());
|
||||
m_load_event_delayer.clear();
|
||||
});
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q
|
|||
set_needs_style_update(true);
|
||||
this->document().set_needs_layout();
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
m_load_event_delayer.clear();
|
||||
});
|
||||
};
|
||||
|
|
|
@ -156,11 +156,11 @@ void HTMLInputElement::update_the_file_selection(JS::NonnullGCPtr<FileAPI::FileL
|
|||
this->set_files(files.ptr());
|
||||
|
||||
// 2. Fire an event named input at the input element, with the bubbles and composed attributes initialized to true.
|
||||
auto input_event = DOM::Event::create(this->realm(), EventNames::input.to_deprecated_fly_string(), { .bubbles = true, .composed = true }).release_value_but_fixme_should_propagate_errors();
|
||||
auto input_event = DOM::Event::create(this->realm(), EventNames::input, { .bubbles = true, .composed = true }).release_value_but_fixme_should_propagate_errors();
|
||||
this->dispatch_event(input_event);
|
||||
|
||||
// 3. Fire an event named change at the input element, with the bubbles attribute initialized to true.
|
||||
auto change_event = DOM::Event::create(this->realm(), EventNames::change.to_deprecated_fly_string(), { .bubbles = true }).release_value_but_fixme_should_propagate_errors();
|
||||
auto change_event = DOM::Event::create(this->realm(), EventNames::change, { .bubbles = true }).release_value_but_fixme_should_propagate_errors();
|
||||
this->dispatch_event(change_event);
|
||||
});
|
||||
}
|
||||
|
@ -247,13 +247,13 @@ ErrorOr<void> HTMLInputElement::run_input_activation_behavior()
|
|||
return {};
|
||||
|
||||
// 2. Fire an event named input at the element with the bubbles and composed attributes initialized to true.
|
||||
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input).release_value_but_fixme_should_propagate_errors();
|
||||
input_event->set_bubbles(true);
|
||||
input_event->set_composed(true);
|
||||
dispatch_event(input_event);
|
||||
|
||||
// 3. Fire an event named change at the element with the bubbles attribute initialized to true.
|
||||
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change).release_value_but_fixme_should_propagate_errors();
|
||||
change_event->set_bubbles(true);
|
||||
dispatch_event(*change_event);
|
||||
} else if (type_state() == TypeAttributeState::SubmitButton) {
|
||||
|
@ -271,7 +271,7 @@ ErrorOr<void> HTMLInputElement::run_input_activation_behavior()
|
|||
} else if (type_state() == TypeAttributeState::FileUpload) {
|
||||
show_the_picker_if_applicable(*this);
|
||||
} else {
|
||||
dispatch_event(DOM::Event::create(realm(), EventNames::change.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), EventNames::change).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
||||
return {};
|
||||
|
@ -286,13 +286,13 @@ void HTMLInputElement::did_edit_text_node(Badge<BrowsingContext>)
|
|||
// NOTE: This is a bit ad-hoc, but basically implements part of "4.10.5.5 Common event behaviors"
|
||||
// https://html.spec.whatwg.org/multipage/input.html#common-input-element-events
|
||||
queue_an_element_task(HTML::Task::Source::UserInteraction, [this] {
|
||||
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto input_event = DOM::Event::create(realm(), HTML::EventNames::input).release_value_but_fixme_should_propagate_errors();
|
||||
input_event->set_bubbles(true);
|
||||
input_event->set_composed(true);
|
||||
dispatch_event(*input_event);
|
||||
|
||||
// FIXME: This should only fire when the input is "committed", whatever that means.
|
||||
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto change_event = DOM::Event::create(realm(), HTML::EventNames::change).release_value_but_fixme_should_propagate_errors();
|
||||
change_event->set_bubbles(true);
|
||||
dispatch_event(change_event);
|
||||
});
|
||||
|
|
|
@ -403,11 +403,11 @@ void HTMLLinkElement::process_stylesheet_resource(bool success, Fetch::Infrastru
|
|||
}
|
||||
|
||||
// 2. Fire an event named load at el.
|
||||
dispatch_event(*DOM::Event::create(realm(), HTML::EventNames::load.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(*DOM::Event::create(realm(), HTML::EventNames::load).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
// 5. Otherwise, fire an event named error at el.
|
||||
else {
|
||||
dispatch_event(*DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(*DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
||||
// FIXME: 6. If el contributes a script-blocking style sheet, then:
|
||||
|
|
|
@ -117,7 +117,7 @@ void HTMLMediaElement::set_duration(double duration)
|
|||
if (!isnan(duration)) {
|
||||
// FIXME: Handle seeking to the end of the media resource when needed.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::durationchange.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::durationchange).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::load_element()
|
|||
// fire an event named abort at the media element.
|
||||
if (m_network_state == NetworkState::Loading || m_network_state == NetworkState::Idle) {
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::abort.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::abort).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::load_element()
|
|||
if (m_network_state != NetworkState::Empty) {
|
||||
// 1. Queue a media element task given the media element to fire an event named emptied at the media element.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::emptied.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::emptied).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
|
||||
// 2. If a fetching process is in progress for the media element, the user agent should stop it.
|
||||
|
@ -247,7 +247,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::select_resource()
|
|||
|
||||
// 8. ⌛ Queue a media element task given the media element to fire an event named loadstart at the media element.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::loadstart.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::loadstart).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
|
||||
// 9. Run the appropriate steps from the following list:
|
||||
|
@ -584,7 +584,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void()>
|
|||
TrackEventInit event_init {};
|
||||
event_init.track = video_track;
|
||||
|
||||
auto event = TRY(TrackEvent::create(realm, TRY_OR_THROW_OOM(vm, FlyString::from_deprecated_fly_string(HTML::EventNames::addtrack.to_deprecated_fly_string())), event_init));
|
||||
auto event = TRY(TrackEvent::create(realm, HTML::EventNames::addtrack, event_init));
|
||||
m_video_tracks->dispatch_event(event);
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void()>
|
|||
video_element.set_video_height(video_track->pixel_height());
|
||||
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::resize.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::resize).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -634,11 +634,11 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::process_media_data(Function<void()>
|
|||
// -> Once the entire media resource has been fetched (but potentially before any of it has been decoded)
|
||||
if (video_track != nullptr) {
|
||||
// Fire an event named progress at the media element.
|
||||
dispatch_event(TRY(DOM::Event::create(this->realm(), HTML::EventNames::progress.to_deprecated_fly_string())));
|
||||
dispatch_event(TRY(DOM::Event::create(this->realm(), HTML::EventNames::progress)));
|
||||
|
||||
// Set the networkState to NETWORK_IDLE and fire an event named suspend at the media element.
|
||||
m_network_state = NetworkState::Idle;
|
||||
dispatch_event(TRY(DOM::Event::create(this->realm(), HTML::EventNames::suspend.to_deprecated_fly_string())));
|
||||
dispatch_event(TRY(DOM::Event::create(this->realm(), HTML::EventNames::suspend)));
|
||||
|
||||
// If the user agent ever discards any media data and then needs to resume the network activity to obtain it again, then it must queue a media
|
||||
// element task given the media element to set the networkState to NETWORK_LOADING.
|
||||
|
@ -668,7 +668,7 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::handle_media_source_failure()
|
|||
// FIXME: 4. Set the element's show poster flag to true.
|
||||
|
||||
// 5. Fire an event named error at the media element.
|
||||
dispatch_event(TRY(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string())));
|
||||
dispatch_event(TRY(DOM::Event::create(realm(), HTML::EventNames::error)));
|
||||
|
||||
// FIXME: 6. Reject pending play promises with promises and a "NotSupportedError" DOMException.
|
||||
// FIXME: 7. Set the element's delaying-the-load-event flag to false. This stops delaying the load event.
|
||||
|
@ -695,7 +695,7 @@ void HTMLMediaElement::set_ready_state(ReadyState ready_state)
|
|||
if (m_ready_state == ReadyState::HaveNothing && ready_state == ReadyState::HaveMetadata) {
|
||||
// Queue a media element task given the media element to fire an event named loadedmetadata at the element.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::loadedmetadata.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::loadedmetadata).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
|
||||
return;
|
||||
|
@ -709,7 +709,7 @@ void HTMLMediaElement::set_ready_state(ReadyState ready_state)
|
|||
m_first_data_load_event_since_load_start = false;
|
||||
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::loadeddata.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::loadeddata).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ void HTMLMediaElement::set_ready_state(ReadyState ready_state)
|
|||
if (m_ready_state <= ReadyState::HaveCurrentData && ready_state == ReadyState::HaveFutureData) {
|
||||
// The user agent must queue a media element task given the media element to fire an event named canplay at the element.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::canplay.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::canplay).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
|
||||
// FIXME: If the element's paused attribute is false, the user agent must notify about playing for the element.
|
||||
|
@ -745,13 +745,13 @@ void HTMLMediaElement::set_ready_state(ReadyState ready_state)
|
|||
if (m_ready_state <= ReadyState::HaveCurrentData) {
|
||||
// FIXME: Handle the paused attribute.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::canplay.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::canplay).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
|
||||
// The user agent must queue a media element task given the media element to fire an event named canplaythrough at the element.
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::canplaythrough.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::canplaythrough).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
|
||||
// FIXME: If the element is not eligible for autoplay, then the user agent must abort these substeps.
|
||||
|
|
|
@ -124,7 +124,7 @@ void HTMLObjectElement::queue_element_task_to_run_object_representation_steps()
|
|||
|
||||
// 3. If that failed, fire an event named error at the element, then jump to the step below labeled fallback.
|
||||
if (!url.is_valid()) {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
return run_object_representation_fallback_steps();
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ void HTMLObjectElement::queue_element_task_to_run_object_representation_steps()
|
|||
void HTMLObjectElement::resource_did_fail()
|
||||
{
|
||||
// 4.7. If the load failed (e.g. there was an HTTP 404 error, there was a DNS error), fire an event named error at the element, then jump to the step below labeled fallback.
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
run_object_representation_fallback_steps();
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ void HTMLObjectElement::run_object_representation_completed_steps(Representation
|
|||
// 4.11. If the object element does not represent its nested browsing context, then once the resource is completely loaded, queue an element task on the DOM manipulation task source given the object element to fire an event named load at the element.
|
||||
if (representation != Representation::NestedBrowsingContext) {
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [&]() {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::load.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::load).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void HTMLScriptElement::execute_script()
|
|||
// 3. If el's result is null, then fire an event named error at el, and return.
|
||||
if (m_result.has<ResultState::Null>()) {
|
||||
dbgln("HTMLScriptElement: Refusing to run script because the element's result is null.");
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ void HTMLScriptElement::execute_script()
|
|||
|
||||
// 8. If el's from an external file is true, then fire an event named load at el.
|
||||
if (m_from_an_external_file)
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::load.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::load).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-a-script
|
||||
|
@ -294,7 +294,7 @@ void HTMLScriptElement::prepare_script()
|
|||
if (m_script_type == ScriptType::ImportMap) {
|
||||
// then queue an element task on the DOM manipulation task source given el to fire an event named error at el, and return.
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ void HTMLScriptElement::prepare_script()
|
|||
if (src.is_empty()) {
|
||||
dbgln("HTMLScriptElement: Refusing to run script because the src attribute is empty.");
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void HTMLScriptElement::prepare_script()
|
|||
if (!url.is_valid()) {
|
||||
dbgln("HTMLScriptElement: Refusing to run script because the src URL '{}' is invalid.", url);
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [this] {
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
dispatch_event(DOM::Event::create(realm(), HTML::EventNames::error).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> MessageEvent::construct_impl
|
|||
}
|
||||
|
||||
MessageEvent::MessageEvent(JS::Realm& realm, FlyString const& event_name, MessageEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_data(event_init.data)
|
||||
, m_origin(event_init.origin)
|
||||
, m_last_event_id(event_init.last_event_id)
|
||||
|
|
|
@ -20,7 +20,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> PageTransitionEvent::
|
|||
}
|
||||
|
||||
PageTransitionEvent::PageTransitionEvent(JS::Realm& realm, FlyString const& event_name, PageTransitionEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_persisted(event_init.persisted)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -256,7 +256,7 @@ void HTMLParser::the_end()
|
|||
document->load_timing_info().dom_content_loaded_event_start_time = HighResolutionTime::unsafe_shared_current_time();
|
||||
|
||||
// 2. Fire an event named DOMContentLoaded at the Document object, with its bubbles attribute initialized to true.
|
||||
auto content_loaded_event = DOM::Event::create(document->realm(), HTML::EventNames::DOMContentLoaded.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors();
|
||||
auto content_loaded_event = DOM::Event::create(document->realm(), HTML::EventNames::DOMContentLoaded).release_value_but_fixme_should_propagate_errors();
|
||||
content_loaded_event->set_bubbles(true);
|
||||
document->dispatch_event(content_loaded_event);
|
||||
|
||||
|
@ -297,7 +297,7 @@ void HTMLParser::the_end()
|
|||
// 5. Fire an event named load at window, with legacy target override flag set.
|
||||
// FIXME: The legacy target override flag is currently set by a virtual override of dispatch_event()
|
||||
// We should reorganize this so that the flag appears explicitly here instead.
|
||||
window->dispatch_event(DOM::Event::create(document->realm(), HTML::EventNames::load.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
window->dispatch_event(DOM::Event::create(document->realm(), HTML::EventNames::load).release_value_but_fixme_should_propagate_errors());
|
||||
|
||||
// FIXME: 6. Invoke WebDriver BiDi load complete with the Document's browsing context, and a new WebDriver BiDi navigation status whose id is the Document object's navigation id, status is "complete", and url is the Document object's URL.
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> PromiseRejectionEve
|
|||
}
|
||||
|
||||
PromiseRejectionEvent::PromiseRejectionEvent(JS::Realm& realm, FlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_promise(const_cast<JS::Promise*>(event_init.promise.cell()))
|
||||
, m_reason(event_init.reason)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> SubmitEvent::construct_impl(J
|
|||
}
|
||||
|
||||
SubmitEvent::SubmitEvent(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_submitter(event_init.submitter)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<TrackEvent>> TrackEvent::construct_impl(JS:
|
|||
}
|
||||
|
||||
TrackEvent::TrackEvent(JS::Realm& realm, FlyString const& event_name, TrackEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_track(event_init.track)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ void VideoTrack::set_selected(bool selected)
|
|||
|
||||
if (previously_unselected_track_is_selected || selected_track_was_unselected_without_another_selection) {
|
||||
m_media_element->queue_a_media_element_task([this]() {
|
||||
m_video_track_list->dispatch_event(DOM::Event::create(realm(), HTML::EventNames::change.to_deprecated_fly_string()).release_value_but_fixme_should_propagate_errors());
|
||||
m_video_track_list->dispatch_event(DOM::Event::create(realm(), HTML::EventNames::change).release_value_but_fixme_should_propagate_errors());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue