1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:07:44 +00:00

LibWeb: Port PageTransitionEvent to new String

This commit is contained in:
Kenneth Myhra 2023-03-04 21:05:43 +01:00 committed by Linus Groh
parent 03ceca4ca1
commit 97947fdffa
4 changed files with 10 additions and 9 deletions

View file

@ -9,18 +9,18 @@
namespace Web::HTML {
WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> PageTransitionEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init)
WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> PageTransitionEvent::create(JS::Realm& realm, FlyString const& event_name, PageTransitionEventInit const& event_init)
{
return MUST_OR_THROW_OOM(realm.heap().allocate<PageTransitionEvent>(realm, realm, event_name, event_init));
}
WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> PageTransitionEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init)
WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> PageTransitionEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, PageTransitionEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
PageTransitionEvent::PageTransitionEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init)
: DOM::Event(realm, event_name, event_init)
PageTransitionEvent::PageTransitionEvent(JS::Realm& realm, FlyString const& event_name, PageTransitionEventInit const& event_init)
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
, m_persisted(event_init.persisted)
{
}

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <LibWeb/DOM/Event.h>
namespace Web::HTML {
@ -18,10 +19,10 @@ class PageTransitionEvent final : public DOM::Event {
WEB_PLATFORM_OBJECT(PageTransitionEvent, DOM::Event);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> create(JS::Realm&, FlyString const& event_name, PageTransitionEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<PageTransitionEvent>> construct_impl(JS::Realm&, FlyString const& event_name, PageTransitionEventInit const& event_init);
PageTransitionEvent(JS::Realm&, DeprecatedFlyString const& event_name, PageTransitionEventInit const& event_init);
PageTransitionEvent(JS::Realm&, FlyString const& event_name, PageTransitionEventInit const& event_init);
virtual ~PageTransitionEvent() override;

View file

@ -1,7 +1,7 @@
#import <DOM/Event.idl>
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#pagetransitionevent
[Exposed=Window]
[Exposed=Window, UseNewAKString]
interface PageTransitionEvent : Event {
constructor(DOMString type, optional PageTransitionEventInit eventInitDict = {});

View file

@ -793,7 +793,7 @@ void Window::fire_a_page_transition_event(DeprecatedFlyString const& event_name,
// with the persisted attribute initialized to persisted,
HTML::PageTransitionEventInit event_init {};
event_init.persisted = persisted;
auto event = HTML::PageTransitionEvent::create(associated_document().realm(), event_name, event_init).release_value_but_fixme_should_propagate_errors();
auto event = HTML::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();
// ...the cancelable attribute initialized to true,
event->set_cancelable(true);