1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:17:44 +00:00

LibWeb: Validate arguments when creating DOMPoint from matrix transform

Previously, it was possible to create a DOMPoint from a matrix
transform with inconsistent arguments. A TypeError is now thrown in
this case.
This commit is contained in:
Tim Ledbetter 2024-02-17 08:09:53 +00:00 committed by Jelle Raaijmakers
parent c5d1ec4dea
commit fe66aeb225
3 changed files with 14 additions and 2 deletions

View file

@ -41,7 +41,7 @@ DOMPointReadOnly::~DOMPointReadOnly() = default;
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> DOMPointReadOnly::matrix_transform(DOMMatrixInit& matrix) const
{
// 1. Let matrixObject be the result of invoking create a DOMMatrix from the dictionary matrix.
auto matrix_object = TRY(DOMMatrix::create_from_dom_matrix_2d_init(realm(), matrix));
auto matrix_object = TRY(DOMMatrix::create_from_dom_matrix_init(realm(), matrix));
// 2. Return the result of invoking transform a point with a matrix, given the current point and matrixObject. The current point does not get modified.
return matrix_object->transform_point(*this);