summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-02-15 20:38:53 +0100
committerLinus Groh <mail@linusgroh.de>2023-02-18 00:52:47 +0100
commit84c7af4dcb9227ade86b6a5c057de936b77c9e45 (patch)
tree127391c9deb9f584219d4d1b0e2346dd3d6dfda2 /Userland/Libraries/LibWeb
parent35622606c195c0f85973425ceb9cb0b4616d30d4 (diff)
downloadserenity-84c7af4dcb9227ade86b6a5c057de936b77c9e45.zip
LibWeb: Make factory method of XHR::ProgressEvent fallible
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp6
-rw-r--r--Userland/Libraries/LibWeb/XHR/ProgressEvent.h4
-rw-r--r--Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp
index 86befaa11d..9ec273db27 100644
--- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp
+++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.cpp
@@ -9,12 +9,12 @@
namespace Web::XHR {
-ProgressEvent* ProgressEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> ProgressEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
{
- return realm.heap().allocate<ProgressEvent>(realm, realm, event_name, event_init).release_allocated_value_but_fixme_should_propagate_errors();
+ return MUST_OR_THROW_OOM(realm.heap().allocate<ProgressEvent>(realm, realm, event_name, event_init));
}
-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, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
diff --git a/Userland/Libraries/LibWeb/XHR/ProgressEvent.h b/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
index 47f0b353ee..aa0364e196 100644
--- a/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
+++ b/Userland/Libraries/LibWeb/XHR/ProgressEvent.h
@@ -23,8 +23,8 @@ class ProgressEvent final : public DOM::Event {
WEB_PLATFORM_OBJECT(ProgressEvent, DOM::Event);
public:
- static ProgressEvent* create(JS::Realm&, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init);
- static ProgressEvent* construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, ProgressEventInit const& event_init);
+ 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);
virtual ~ProgressEvent() override;
diff --git a/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp b/Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
index c38035d260..1580c93d30 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));
+ dispatch_event(*ProgressEvent::create(realm(), event_name, event_init).release_value_but_fixme_should_propagate_errors());
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetext