<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>266918</bug_id>
          
          <creation_ts>2023-12-27 18:40:49 -0800</creation_ts>
          <short_desc>drawImage(detachedOffscreenCanvas) is supposed to throw</short_desc>
          <delta_ts>2024-02-13 02:52:13 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Canvas</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kaiido">tristan.fraipont</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dino</cc>
    
    <cc>heycam</cc>
    
    <cc>mattwoodrow</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2002117</commentid>
    <comment_count>0</comment_count>
    <who name="Kaiido">tristan.fraipont</who>
    <bug_when>2023-12-27 18:40:49 -0800</bug_when>
    <thetext>When transferring an OffscreenCanvas its width and height attributes become zero. Drawing such a detached OffscreenCanvas through a 2D context&apos;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/ &amp; https://jsfiddle.net/9zvx6bok/1/

In the first one we draw a detached OffscreenCanvas on a 2D context, where this shouldn&apos;t be possible since the reported dimensions are both zero.
In the second one, we do set the OffscreenCanvas&apos;s dimension to zero before detaching it. This one throws as expected, demonstrating that drawImage() checks the dimensions before the transfer happened.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2002483</commentid>
    <comment_count>1</comment_count>
    <who name="Kaiido">tristan.fraipont</who>
    <bug_when>2024-01-02 02:07:59 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/22297</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2002916</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-01-03 18:41:13 -0800</bug_when>
    <thetext>&lt;rdar://problem/120451062&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2013105</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-02-13 02:52:11 -0800</bug_when>
    <thetext>Committed 274534@main (5dbd0444ac2e): &lt;https://commits.webkit.org/274534@main&gt;

Reviewed commits have been landed. Closing PR #22297 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>