mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Throw error when calling drawImage() with a broken image
This commit is contained in:
parent
96b34ea744
commit
c4e56cc845
Notes:
github-actions[bot]
2025-10-22 08:46:24 +00:00
Author: https://github.com/tcl3
Commit: c4e56cc845
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6541
Reviewed-by: https://github.com/gmta ✅
8 changed files with 109 additions and 1 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
#include <LibWeb/HTML/ImageBitmap.h>
|
||||
#include <LibWeb/HTML/ImageData.h>
|
||||
#include <LibWeb/HTML/ImageRequest.h>
|
||||
#include <LibWeb/HTML/Path2D.h>
|
||||
#include <LibWeb/HTML/TextMetrics.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
|
|
@ -802,7 +803,9 @@ WebIDL::ExceptionOr<CanvasImageSourceUsability> check_usability_of_image(CanvasI
|
|||
auto usability = TRY(image.visit(
|
||||
// HTMLOrSVGImageElement
|
||||
[](GC::Root<HTMLImageElement> const& image_element) -> WebIDL::ExceptionOr<Optional<CanvasImageSourceUsability>> {
|
||||
// FIXME: If image's current request's state is broken, then throw an "InvalidStateError" DOMException.
|
||||
// If image's current request's state is broken, then throw an "InvalidStateError" DOMException.
|
||||
if (image_element->current_request().state() == HTML::ImageRequest::State::Broken)
|
||||
return WebIDL::InvalidStateError::create(image_element->realm(), "Image element state is broken"_utf16);
|
||||
|
||||
// If image is not fully decodable, then return bad.
|
||||
if (!image_element->immutable_bitmap())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue