Bug 266918
| Summary: | drawImage(detachedOffscreenCanvas) is supposed to throw | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Kaiido <tristan.fraipont> |
| Component: | Canvas | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | dino, heycam, mattwoodrow, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Kaiido
When transferring an OffscreenCanvas its width and height attributes become zero. Drawing such a detached OffscreenCanvas through a 2D context's drawImage() method should thus throw a DOMException (from https://html.spec.whatwg.org/multipage/canvas.html#check-the-usability-of-the-image-argument).
However it seems the check for the image size still uses the dimension of the OffscreenCanvas from before it got detached as can be seen in both fiddles: https://jsfiddle.net/9zvx6bok/ & https://jsfiddle.net/9zvx6bok/1/
In the first one we draw a detached OffscreenCanvas on a 2D context, where this shouldn't be possible since the reported dimensions are both zero.
In the second one, we do set the OffscreenCanvas's dimension to zero before detaching it. This one throws as expected, demonstrating that drawImage() checks the dimensions before the transfer happened.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Kaiido
Pull request: https://github.com/WebKit/WebKit/pull/22297
Radar WebKit Bug Importer
<rdar://problem/120451062>
EWS
Committed 274534@main (5dbd0444ac2e): <https://commits.webkit.org/274534@main>
Reviewed commits have been landed. Closing PR #22297 and removing active labels.