1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00

LibWeb: Move DOMException from DOM/ to WebIDL/

This commit is contained in:
Linus Groh 2022-09-25 17:28:46 +01:00
parent ad04d7ac9b
commit bbaa05fcf9
49 changed files with 206 additions and 203 deletions

View file

@ -275,11 +275,11 @@ WebIDL::ExceptionOr<JS::GCPtr<ImageData>> CanvasRenderingContext2D::get_image_da
{
// 1. If either the sw or sh arguments are zero, then throw an "IndexSizeError" DOMException.
if (width == 0 || height == 0)
return DOM::IndexSizeError::create(global_object(), "Width and height must not be zero");
return WebIDL::IndexSizeError::create(global_object(), "Width and height must not be zero");
// 2. If the CanvasRenderingContext2D's origin-clean flag is set to false, then throw a "SecurityError" DOMException.
if (!m_origin_clean)
return DOM::SecurityError::create(global_object(), "CanvasRenderingContext2D is not origin-clean");
return WebIDL::SecurityError::create(global_object(), "CanvasRenderingContext2D is not origin-clean");
// 3. Let imageData be a new ImageData object.
// 4. Initialize imageData given sw, sh, settings set to settings, and defaultColorSpace set to this's color space.
@ -497,7 +497,7 @@ WebIDL::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasI
[](JS::Handle<HTMLCanvasElement> const& canvas_element) -> WebIDL::ExceptionOr<Optional<CanvasImageSourceUsability>> {
// If image has either a horizontal dimension or a vertical dimension equal to zero, then throw an "InvalidStateError" DOMException.
if (canvas_element->width() == 0 || canvas_element->height() == 0)
return DOM::InvalidStateError::create(canvas_element->global_object(), "Canvas width or height is zero");
return WebIDL::InvalidStateError::create(canvas_element->global_object(), "Canvas width or height is zero");
return Optional<CanvasImageSourceUsability> {};
}));
if (usability.has_value())