1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:47:34 +00:00

LibWeb: Make factory method of Geometry::DOMPointReadOnly fallible

This commit is contained in:
Kenneth Myhra 2023-02-19 18:11:05 +01:00 committed by Andreas Kling
parent 530ec85c4a
commit 4de5dc7a86
2 changed files with 6 additions and 5 deletions

View file

@ -7,12 +7,13 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Geometry/DOMPointReadOnly.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::Geometry {
JS::NonnullGCPtr<DOMPointReadOnly> DOMPointReadOnly::construct_impl(JS::Realm& realm, double x, double y, double z, double w)
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPointReadOnly>> DOMPointReadOnly::construct_impl(JS::Realm& realm, double x, double y, double z, double w)
{
return realm.heap().allocate<DOMPointReadOnly>(realm, realm, x, y, z, w).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMPointReadOnly>(realm, realm, x, y, z, w));
}
DOMPointReadOnly::DOMPointReadOnly(JS::Realm& realm, double x, double y, double z, double w)
@ -25,7 +26,7 @@ DOMPointReadOnly::DOMPointReadOnly(JS::Realm& realm, double x, double y, double
}
// https://drafts.fxtf.org/geometry/#dom-dompointreadonly-frompoint
JS::NonnullGCPtr<DOMPointReadOnly> DOMPointReadOnly::from_point(JS::VM& vm, DOMPointInit const& other)
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPointReadOnly>> DOMPointReadOnly::from_point(JS::VM& vm, DOMPointInit const& other)
{
// The fromPoint(other) static method on DOMPointReadOnly must create a DOMPointReadOnly from the dictionary other.
return construct_impl(*vm.current_realm(), other.x, other.y, other.z, other.w);

View file

@ -25,9 +25,9 @@ class DOMPointReadOnly : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DOMPointReadOnly, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<DOMPointReadOnly> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPointReadOnly>> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
static JS::NonnullGCPtr<DOMPointReadOnly> from_point(JS::VM&, DOMPointInit const&);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPointReadOnly>> from_point(JS::VM&, DOMPointInit const&);
virtual ~DOMPointReadOnly() override;