浏览代码

LibWeb: Make factory method of Geometry::DOMRectReadOnly fallible

Kenneth Myhra 2 年之前
父节点
当前提交
07db02cd2c

+ 3 - 2
Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.cpp

@@ -6,12 +6,13 @@
 
 
 #include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/Bindings/Intrinsics.h>
 #include <LibWeb/Geometry/DOMRectReadOnly.h>
 #include <LibWeb/Geometry/DOMRectReadOnly.h>
+#include <LibWeb/WebIDL/ExceptionOr.h>
 
 
 namespace Web::Geometry {
 namespace Web::Geometry {
 
 
-JS::NonnullGCPtr<DOMRectReadOnly> DOMRectReadOnly::construct_impl(JS::Realm& realm, double x, double y, double width, double height)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> DOMRectReadOnly::construct_impl(JS::Realm& realm, double x, double y, double width, double height)
 {
 {
-    return realm.heap().allocate<DOMRectReadOnly>(realm, realm, x, y, width, height).release_allocated_value_but_fixme_should_propagate_errors();
+    return MUST_OR_THROW_OOM(realm.heap().allocate<DOMRectReadOnly>(realm, realm, x, y, width, height));
 }
 }
 
 
 DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double width, double height)
 DOMRectReadOnly::DOMRectReadOnly(JS::Realm& realm, double x, double y, double width, double height)

+ 1 - 1
Userland/Libraries/LibWeb/Geometry/DOMRectReadOnly.h

@@ -17,7 +17,7 @@ class DOMRectReadOnly : public Bindings::PlatformObject {
     WEB_PLATFORM_OBJECT(DOMRectReadOnly, Bindings::PlatformObject);
     WEB_PLATFORM_OBJECT(DOMRectReadOnly, Bindings::PlatformObject);
 
 
 public:
 public:
-    static JS::NonnullGCPtr<DOMRectReadOnly> construct_impl(JS::Realm&, double x = 0, double y = 0, double width = 0, double height = 0);
+    static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectReadOnly>> construct_impl(JS::Realm&, double x = 0, double y = 0, double width = 0, double height = 0);
 
 
     virtual ~DOMRectReadOnly() override;
     virtual ~DOMRectReadOnly() override;