فهرست منبع

LibWeb: Make factory method of XHR::XMLHttpRequest fallible

Kenneth Myhra 2 سال پیش
والد
کامیت
f28b8431bf
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 2 2
      Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp
  2. 1 1
      Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h

+ 2 - 2
Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

@@ -41,11 +41,11 @@
 
 
 namespace Web::XHR {
 namespace Web::XHR {
 
 
-JS::NonnullGCPtr<XMLHttpRequest> XMLHttpRequest::construct_impl(JS::Realm& realm)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<XMLHttpRequest>> XMLHttpRequest::construct_impl(JS::Realm& realm)
 {
 {
     auto& window = verify_cast<HTML::Window>(realm.global_object());
     auto& window = verify_cast<HTML::Window>(realm.global_object());
     auto author_request_headers = Fetch::Infrastructure::HeaderList::create(realm.vm());
     auto author_request_headers = Fetch::Infrastructure::HeaderList::create(realm.vm());
-    return realm.heap().allocate<XMLHttpRequest>(realm, window, *author_request_headers).release_allocated_value_but_fixme_should_propagate_errors();
+    return MUST_OR_THROW_OOM(realm.heap().allocate<XMLHttpRequest>(realm, window, *author_request_headers));
 }
 }
 
 
 XMLHttpRequest::XMLHttpRequest(HTML::Window& window, Fetch::Infrastructure::HeaderList& author_request_headers)
 XMLHttpRequest::XMLHttpRequest(HTML::Window& window, Fetch::Infrastructure::HeaderList& author_request_headers)

+ 1 - 1
Userland/Libraries/LibWeb/XHR/XMLHttpRequest.h

@@ -38,7 +38,7 @@ public:
         Done = 4,
         Done = 4,
     };
     };
 
 
-    static JS::NonnullGCPtr<XMLHttpRequest> construct_impl(JS::Realm&);
+    static WebIDL::ExceptionOr<JS::NonnullGCPtr<XMLHttpRequest>> construct_impl(JS::Realm&);
 
 
     virtual ~XMLHttpRequest() override;
     virtual ~XMLHttpRequest() override;