summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-03-05 14:04:14 +0100
committerLinus Groh <mail@linusgroh.de>2023-03-05 18:25:59 +0000
commitab6bd946d872408c18be271cade530fd870a2273 (patch)
tree4dc4de5bbe9898b16f78b473ff00b5b4bfe7bc03
parentfe6b82b01c846f44bc2024e44f740cca187a3f0d (diff)
downloadserenity-ab6bd946d872408c18be271cade530fd870a2273.zip
LibWeb: Port ProgressEvent to new String
-rw-r--r--Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp8
-rw-r--r--Userland/Libraries/LibWeb/XHR/ProgressEvent.h7
-rw-r--r--Userland/Libraries/LibWeb/XHR/ProgressEvent.idl2
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp2
4 files changed, 10 insertions, 9 deletions
diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp
index 9ec273db27..5aed107de6 100644
--- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp
+++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp
@@ -9,18 +9,18 @@
namespace Web::XHR {
-WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> ProgressEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> ProgressEvent::create(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
{
return MUST_OR_THROW_OOM(realm.heap().allocate<ProgressEvent>(realm, realm, event_name, event_init));
}
-WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> ProgressEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> ProgressEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
-ProgressEvent::ProgressEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
- : Event(realm, event_name, event_init)
+ProgressEvent::ProgressEvent(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
+ : Event(realm, event_name.to_deprecated_fly_string(), event_init)
, m_length_computable(event_init.length_computable)
, m_loaded(event_init.loaded)
, m_total(event_init.total)
diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.h b/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
index aa0364e196..3fdd0bcf23 100644
--- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
+++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
@@ -6,6 +6,7 @@
#pragma once
+#include <AK/FlyString.h>
#include <LibWeb/DOM/Event.h>
namespace Web::XHR {
@@ -23,8 +24,8 @@ class ProgressEvent final : public DOM::Event {
WEB_PLATFORM_OBJECT(ProgressEvent, DOM::Event);
public:
- static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init);
- static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init);
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> create(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> construct_impl(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
virtual ~ProgressEvent() override;
@@ -33,7 +34,7 @@ public:
u64 total() const { return m_total; }
private:
- ProgressEvent(JS::Realm&, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init);
+ ProgressEvent(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.idl b/Userland/Libraries/LibWeb/XHR/ProgressEvent.idl
index 169228cd20..c1e736b196 100644
--- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.idl
+++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.idl
@@ -1,7 +1,7 @@
#import <DOM/Event.idl>
// https://xhr.spec.whatwg.org/#interface-progressevent
-[Exposed=(Window,Worker)]
+[Exposed=(Window,Worker), UseNewAKString]
interface ProgressEvent : Event {
constructor(DOMString type, optional ProgressEventInit eventInitDict = {});
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index 72c526ef6e..86c6e1de8f 100644
--- a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
+++ b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
@@ -83,7 +83,7 @@ void XMLHttpRequest::fire_progress_event(DeprecatedString const& event_name, u64
event_init.length_computable = true;
event_init.loaded = transmitted;
event_init.total = length;
- dispatch_event(*ProgressEvent::create(realm(), event_name, event_init).release_value_but_fixme_should_propagate_errors());
+ dispatch_event(*ProgressEvent::create(realm(), String::from_deprecated_string(event_name).release_value_but_fixme_should_propagate_errors(), event_init).release_value_but_fixme_should_propagate_errors());
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetext