1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:48:12 +00:00

LibWeb: Make factory method of Geometry::DOMRectList fallible

This commit is contained in:
Kenneth Myhra 2023-02-19 18:16:49 +01:00 committed by Andreas Kling
parent 4de5dc7a86
commit 9b190b9509
3 changed files with 6 additions and 5 deletions

View file

@ -8,15 +8,16 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Geometry/DOMRect.h>
#include <LibWeb/Geometry/DOMRectList.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::Geometry {
JS::NonnullGCPtr<DOMRectList> DOMRectList::create(JS::Realm& realm, Vector<JS::Handle<DOMRect>> rect_handles)
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMRectList>> DOMRectList::create(JS::Realm& realm, Vector<JS::Handle<DOMRect>> rect_handles)
{
Vector<JS::NonnullGCPtr<DOMRect>> rects;
for (auto& rect : rect_handles)
rects.append(*rect);
return realm.heap().allocate<DOMRectList>(realm, realm, move(rects)).release_allocated_value_but_fixme_should_propagate_errors();
return MUST_OR_THROW_OOM(realm.heap().allocate<DOMRectList>(realm, realm, move(rects)));
}
DOMRectList::DOMRectList(JS::Realm& realm, Vector<JS::NonnullGCPtr<DOMRect>> rects)