mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibWeb: Make factory method of Geometry::DOMPoint fallible
This commit is contained in:
parent
459959b297
commit
530ec85c4a
3 changed files with 6 additions and 5 deletions
|
@ -7,12 +7,13 @@
|
|||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Geometry/DOMPoint.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
|
||||
namespace Web::Geometry {
|
||||
|
||||
JS::NonnullGCPtr<DOMPoint> DOMPoint::construct_impl(JS::Realm& realm, double x, double y, double z, double w)
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> DOMPoint::construct_impl(JS::Realm& realm, double x, double y, double z, double w)
|
||||
{
|
||||
return realm.heap().allocate<DOMPoint>(realm, realm, x, y, z, w).release_allocated_value_but_fixme_should_propagate_errors();
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMPoint>(realm, realm, x, y, z, w));
|
||||
}
|
||||
|
||||
DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w)
|
||||
|
@ -24,7 +25,7 @@ DOMPoint::DOMPoint(JS::Realm& realm, double x, double y, double z, double w)
|
|||
JS::NonnullGCPtr<DOMPoint> DOMPoint::from_point(JS::VM& vm, DOMPointInit const& other)
|
||||
{
|
||||
// The fromPoint(other) static method on DOMPoint must create a DOMPoint from the dictionary other.
|
||||
return construct_impl(*vm.current_realm(), other.x, other.y, other.z, other.w);
|
||||
return construct_impl(*vm.current_realm(), other.x, other.y, other.z, other.w).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
DOMPoint::~DOMPoint() = default;
|
||||
|
|
|
@ -16,7 +16,7 @@ class DOMPoint final : public DOMPointReadOnly {
|
|||
WEB_PLATFORM_OBJECT(DOMPoint, DOMPointReadOnly);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<DOMPoint> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
|
||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
|
||||
|
||||
static JS::NonnullGCPtr<DOMPoint> from_point(JS::VM&, DOMPointInit const&);
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ float SVGGeometryElement::get_total_length()
|
|||
JS::NonnullGCPtr<Geometry::DOMPoint> SVGGeometryElement::get_point_at_length(float distance)
|
||||
{
|
||||
(void)distance;
|
||||
return Geometry::DOMPoint::construct_impl(realm(), 0, 0, 0, 0);
|
||||
return Geometry::DOMPoint::construct_impl(realm(), 0, 0, 0, 0).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue