<?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>266473</bug_id>
          
          <creation_ts>2023-12-15 04:56:29 -0800</creation_ts>
          <short_desc>Performance severely degraded when drawing a canvas into another canvas while Advanced Tracking and Fingerprinting Protection is enabled</short_desc>
          <delta_ts>2024-01-12 10:47:30 -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 17</version>
          <rep_platform>All</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>266181</dup_id>
          
          <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="Paul Neave">paul.neave</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>dino</cc>
    
    <cc>m_finkel</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1999883</commentid>
    <comment_count>0</comment_count>
      <attachid>469061</attachid>
    <who name="Paul Neave">paul.neave</who>
    <bug_when>2023-12-15 04:56:29 -0800</bug_when>
    <thetext>Created attachment 469061
Example HTML file

When using context.drawImage() to draw a 2D canvas into another 2D canvas, performance is severely degraded when the Advanced Tracking and Fingerprinting Protection settings is enabled in Safari 17.

Please try this following example is Safari 17 in a private tab (HTML file attached to this report).

`
&lt;html&gt;
&lt;body&gt;
&lt;canvas id=&quot;canvas&quot;&gt;&lt;/canvas&gt;
&lt;script&gt;

const width = 800;
const height = 800;

const canvas = document.getElementById(&apos;canvas&apos;);
canvas.width = width;
canvas.height = height;
const context = canvas.getContext(&apos;2d&apos;);

const imageCanvas = document.createElement(&apos;canvas&apos;);
imageCanvas.width = width;
imageCanvas.height = height;
const imageContext = imageCanvas.getContext(&apos;2d&apos;);
imageContext.fillStyle = &apos;red&apos;;
imageContext.fillRect(0, 0, width, height);

console.time(&apos;drawImage&apos;);
context.drawImage(imageCanvas, 0, 0);
console.timeEnd(&apos;drawImage&apos;);

&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
`

Open the JavaScript console in Safari to see the timings for the operation. Then toggle the &quot;Use advanced tracking and fingerprinting protection&quot; setting, under Settings &gt; Advanced &gt; Privacy, and reload the page.

On my Mac I see ~0.015 ms with Advanced Tracking and Fingerprinting Protection disabled. When it is enabled, I see the operation takes ~90 ms, a 6000x performance regression. Websites that use this technique are now unusable.

This issue is affecting many users since Advanced Tracking and Fingerprinting Protection is now enabled by default for private tabs in Safari 17.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2000219</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-12-16 16:28:35 -0800</bug_when>
    <thetext>Please let us know if this still reproduces with Safari 17.2 (I cannot reproduce).

*** This bug has been marked as a duplicate of bug 263129 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2000384</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Neave">paul.neave</who>
    <bug_when>2023-12-18 06:31:32 -0800</bug_when>
    <thetext>No, this is not fixed in iOS 17.2. Running the example shows:

Normal tab: ~0.05 ms
Private tab: ~60 ms</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2000458</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2023-12-18 10:14:08 -0800</bug_when>
    <thetext>Hmm, I don&apos;t know what I did wrong, but now I&apos;m reproducing this on macOS, even though I&apos;m performing the same steps as the other day, and didn&apos;t change any preferences.

Re-opening.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2000459</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-12-18 10:14:27 -0800</bug_when>
    <thetext>&lt;rdar://problem/119821737&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2004728</commentid>
    <comment_count>5</comment_count>
    <who name="Matthew Finkel">m_finkel</who>
    <bug_when>2024-01-12 10:47:30 -0800</bug_when>
    <thetext>Thanks for reporting this issue. I&apos;m duping it to a slightly older bug for resolution.

*** This bug has been marked as a duplicate of bug 266181 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>469061</attachid>
            <date>2023-12-15 04:56:29 -0800</date>
            <delta_ts>2023-12-15 04:56:29 -0800</delta_ts>
            <desc>Example HTML file</desc>
            <filename>safari-canvas-private-bug.html</filename>
            <type>text/html</type>
            <size>594</size>
            <attacher name="Paul Neave">paul.neave</attacher>
            
              <data encoding="base64">PGh0bWw+Cjxib2R5PgoJPGNhbnZhcyBpZD0iY2FudmFzIj48L2NhbnZhcz4KCTxzY3JpcHQ+Cgpj
b25zdCB3aWR0aCA9IDgwMDsKY29uc3QgaGVpZ2h0ID0gODAwOwoKY29uc3QgY2FudmFzID0gZG9j
dW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhbnZhcycpOwpjYW52YXMud2lkdGggPSB3aWR0aDsKY2Fu
dmFzLmhlaWdodCA9IGhlaWdodDsKY29uc3QgY29udGV4dCA9IGNhbnZhcy5nZXRDb250ZXh0KCcy
ZCcpOwoKY29uc3QgaW1hZ2VDYW52YXMgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdjYW52YXMn
KTsKaW1hZ2VDYW52YXMud2lkdGggPSB3aWR0aDsKaW1hZ2VDYW52YXMuaGVpZ2h0ID0gaGVpZ2h0
Owpjb25zdCBpbWFnZUNvbnRleHQgPSBpbWFnZUNhbnZhcy5nZXRDb250ZXh0KCcyZCcpOwppbWFn
ZUNvbnRleHQuZmlsbFN0eWxlID0gJ3JlZCc7CmltYWdlQ29udGV4dC5maWxsUmVjdCgwLCAwLCB3
aWR0aCwgaGVpZ2h0KTsKCmNvbnNvbGUudGltZSgnZHJhd0ltYWdlJyk7CmNvbnRleHQuZHJhd0lt
YWdlKGltYWdlQ2FudmFzLCAwLCAwKTsKY29uc29sZS50aW1lRW5kKCdkcmF3SW1hZ2UnKTsKCgk8
L3NjcmlwdD4KPC9ib2R5Pgo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>