1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

LibWeb: Port fire_a_page_transition_event() to new FlyString

This commit is contained in:
Kenneth Myhra 2023-04-09 11:17:42 +02:00 committed by Linus Groh
parent bf048da8cb
commit cbefab21be
6 changed files with 7 additions and 7 deletions

View file

@ -2327,7 +2327,7 @@ void Document::unload(bool recursive_flag, Optional<DocumentUnloadTimingInfo> un
m_page_showing = false;
// 2. Fire a page transition event named pagehide at document's relevant global object with document's salvageable state.
global_object().fire_a_page_transition_event(HTML::EventNames::pagehide.to_deprecated_fly_string(), m_salvageable);
global_object().fire_a_page_transition_event(HTML::EventNames::pagehide, m_salvageable);
// 3. Update the visibility state of newDocument to "hidden".
update_the_visibility_state(HTML::VisibilityState::Hidden);

View file

@ -1125,7 +1125,7 @@ WebIDL::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_ind
// 4. Fire a page transition event named pageshow at newDocument's relevant global object with true.
auto& window = verify_cast<HTML::Window>(relevant_global_object(*new_document));
window.fire_a_page_transition_event(HTML::EventNames::pageshow.to_deprecated_fly_string(), true);
window.fire_a_page_transition_event(HTML::EventNames::pageshow, true);
});
}

View file

@ -313,7 +313,7 @@ void HTMLParser::the_end()
document->set_page_showing(true);
// 11. Fire a page transition event named pageshow at window with false.
window->fire_a_page_transition_event(HTML::EventNames::pageshow.to_deprecated_fly_string(), false);
window->fire_a_page_transition_event(HTML::EventNames::pageshow, false);
// 12. Completely finish loading the Document.
document->completely_finish_loading();

View file

@ -567,14 +567,14 @@ Optional<CSS::MediaFeatureValue> Window::query_media_feature(CSS::MediaFeatureID
}
// https://html.spec.whatwg.org/#fire-a-page-transition-event
void Window::fire_a_page_transition_event(DeprecatedFlyString const& event_name, bool persisted)
void Window::fire_a_page_transition_event(FlyString const& event_name, bool persisted)
{
// To fire a page transition event named eventName at a Window window with a boolean persisted,
// fire an event named eventName at window, using PageTransitionEvent,
// with the persisted attribute initialized to persisted,
PageTransitionEventInit event_init {};
event_init.persisted = persisted;
auto event = PageTransitionEvent::create(associated_document().realm(), String::from_deprecated_string(event_name).release_value_but_fixme_should_propagate_errors(), event_init).release_value_but_fixme_should_propagate_errors();
auto event = PageTransitionEvent::create(associated_document().realm(), event_name, event_init).release_value_but_fixme_should_propagate_errors();
// ...the cancelable attribute initialized to true,
event->set_cancelable(true);

View file

@ -106,7 +106,7 @@ public:
Optional<CSS::MediaFeatureValue> query_media_feature(CSS::MediaFeatureID) const;
void fire_a_page_transition_event(DeprecatedFlyString const& event_name, bool persisted);
void fire_a_page_transition_event(FlyString const& event_name, bool persisted);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> local_storage();
WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> session_storage();

View file

@ -245,7 +245,7 @@ void XMLDocumentBuilder::document_end()
document->set_page_showing(true);
// Fire a page transition event named pageshow at window with false.
window->fire_a_page_transition_event(HTML::EventNames::pageshow.to_deprecated_fly_string(), false);
window->fire_a_page_transition_event(HTML::EventNames::pageshow, false);
// Completely finish loading the Document.
document->completely_finish_loading();