Skip to content

Commit f28b843

Browse files
kennethmyhralinusg
authored andcommitted
LibWeb: Make factory method of XHR::XMLHttpRequest fallible
1 parent 719839b commit f28b843

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@
4141

4242
namespace Web::XHR {
4343

44-
JS::NonnullGCPtr<XMLHttpRequest> XMLHttpRequest::construct_impl(JS::Realm& realm)
44+
WebIDL::ExceptionOr<JS::NonnullGCPtr<XMLHttpRequest>> XMLHttpRequest::construct_impl(JS::Realm& realm)
4545
{
4646
auto& window = verify_cast<HTML::Window>(realm.global_object());
4747
auto author_request_headers = Fetch::Infrastructure::HeaderList::create(realm.vm());
48-
return realm.heap().allocate<XMLHttpRequest>(realm, window, *author_request_headers).release_allocated_value_but_fixme_should_propagate_errors();
48+
return MUST_OR_THROW_OOM(realm.heap().allocate<XMLHttpRequest>(realm, window, *author_request_headers));
4949
}
5050

5151
XMLHttpRequest::XMLHttpRequest(HTML::Window& window, Fetch::Infrastructure::HeaderList& author_request_headers)

Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class XMLHttpRequest final : public XMLHttpRequestEventTarget {
3838
Done = 4,
3939
};
4040

41-
static JS::NonnullGCPtr<XMLHttpRequest> construct_impl(JS::Realm&);
41+
static WebIDL::ExceptionOr<JS::NonnullGCPtr<XMLHttpRequest>> construct_impl(JS::Realm&);
4242

4343
virtual ~XMLHttpRequest() override;
4444

0 commit comments

Comments
 (0)