mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
LibWeb: Port ProgressEvent to new String
This commit is contained in:
parent
fe6b82b01c
commit
ab6bd946d8
4 changed files with 10 additions and 9 deletions
|
@ -9,18 +9,18 @@
|
||||||
|
|
||||||
namespace Web::XHR {
|
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));
|
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);
|
return create(realm, event_name, event_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProgressEvent::ProgressEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
|
ProgressEvent::ProgressEvent(JS::Realm& realm, FlyString const& event_name, ProgressEventInit const& event_init)
|
||||||
: Event(realm, event_name, event_init)
|
: Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||||
, m_length_computable(event_init.length_computable)
|
, m_length_computable(event_init.length_computable)
|
||||||
, m_loaded(event_init.loaded)
|
, m_loaded(event_init.loaded)
|
||||||
, m_total(event_init.total)
|
, m_total(event_init.total)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <AK/FlyString.h>
|
||||||
#include <LibWeb/DOM/Event.h>
|
#include <LibWeb/DOM/Event.h>
|
||||||
|
|
||||||
namespace Web::XHR {
|
namespace Web::XHR {
|
||||||
|
@ -23,8 +24,8 @@ class ProgressEvent final : public DOM::Event {
|
||||||
WEB_PLATFORM_OBJECT(ProgressEvent, DOM::Event);
|
WEB_PLATFORM_OBJECT(ProgressEvent, DOM::Event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> create(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&, DeprecatedFlyString 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;
|
virtual ~ProgressEvent() override;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public:
|
||||||
u64 total() const { return m_total; }
|
u64 total() const { return m_total; }
|
||||||
|
|
||||||
private:
|
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;
|
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#import <DOM/Event.idl>
|
#import <DOM/Event.idl>
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#interface-progressevent
|
// https://xhr.spec.whatwg.org/#interface-progressevent
|
||||||
[Exposed=(Window,Worker)]
|
[Exposed=(Window,Worker), UseNewAKString]
|
||||||
interface ProgressEvent : Event {
|
interface ProgressEvent : Event {
|
||||||
constructor(DOMString type, optional ProgressEventInit eventInitDict = {});
|
constructor(DOMString type, optional ProgressEventInit eventInitDict = {});
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ void XMLHttpRequest::fire_progress_event(DeprecatedString const& event_name, u64
|
||||||
event_init.length_computable = true;
|
event_init.length_computable = true;
|
||||||
event_init.loaded = transmitted;
|
event_init.loaded = transmitted;
|
||||||
event_init.total = length;
|
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
|
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetext
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue