Bug 274575
| Summary: | Canvas drawImage() API does not throw an exception when the image is in broken state | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Karl Dubost <karlcow> |
| Component: | Canvas | Assignee: | Said Abou-Hallawa <sabouhallawa> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | sabouhallawa, webkit-bug-importer |
| Priority: | P2 | Keywords: | BrowserCompat, InRadar, WPTImpact |
| Version: | Other | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://wpt.live/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.nonexistent.html | ||
Karl Dubost
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
The test assertion:
assert_throws_dom(
"INVALID_STATE_ERR",
function "function() { ctx.drawImage(img, 0, 0); }"
)
Radar WebKit Bug Importer
<rdar://problem/128588063>
Karl Dubost
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
Pull request: https://github.com/WebKit/WebKit/pull/29003
EWS
Committed 279319@main (6cd33ff4b3a1): <https://commits.webkit.org/279319@main>
Reviewed commits have been landed. Closing PR #29003 and removing active labels.