WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
274575
Canvas drawImage() API does not throw an exception when the image is in broken state
https://bugs.webkit.org/show_bug.cgi?id=274575
Summary
Canvas drawImage() API does not throw an exception when the image is in broke...
Karl Dubost
Reported
2024-05-22 22:52:35 PDT
With STP 191 Go to
http://wpt.live/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent.html
Result: The test fails. It passes on Firefox and Chrome.
Attachments
Add attachment
proposed patch, testcase, etc.
Karl Dubost
Comment 1
2024-05-22 22:53:33 PDT
The test assertion: assert_throws_dom( "INVALID_STATE_ERR", function "function() { ctx.drawImage(img, 0, 0); }" )
Radar WebKit Bug Importer
Comment 2
2024-05-22 22:53:52 PDT
<
rdar://problem/128588063
>
Karl Dubost
Comment 3
2024-05-22 23:13:16 PDT
There's an image <img src="/images/not-found-at-all.png" id="not-found-at-all.png" class="resource"> Then var img = document.getElementById('not-found-at-all.png'); and ctx.drawImage(img, 0, 0); On Firefox Uncaught DOMException: CanvasRenderingContext2D.drawImage: Passed-in image is "broken" On Chrome it will return Uncaught DOMException: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The HTMLImageElement provided is in the 'broken' state. On Safari undefined It doesn't throw and there is no helpful message. That should be easy to fix.
https://searchfox.org/wubkat/rev/c2e64ba96fbed90353cfdea4b0c20a855a6c40bb/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp#1541-1559
Said Abou-Hallawa
Comment 4
2024-05-23 11:44:10 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/29003
EWS
Comment 5
2024-05-25 08:07:30 PDT
Committed
279319@main
(6cd33ff4b3a1): <
https://commits.webkit.org/279319@main
> Reviewed commits have been landed. Closing PR #29003 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug