<?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>243949</bug_id>
          
          <creation_ts>2022-08-15 12:41:13 -0700</creation_ts>
          <short_desc>iOS 15.6 compositing with z-index causes crash</short_desc>
          <delta_ts>2023-02-24 11:52:53 -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>Compositing</component>
          <version>Safari 15</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=244543</see_also>
          <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="Liam DeBeasi">ldebeasi</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>hanskrywaa</cc>
    
    <cc>jameson</cc>
    
    <cc>lollollipop878</cc>
    
    <cc>majainle</cc>
    
    <cc>mattwoodrow</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1891412</commentid>
    <comment_count>0</comment_count>
      <attachid>461639</attachid>
    <who name="Liam DeBeasi">ldebeasi</who>
    <bug_when>2022-08-15 12:41:13 -0700</bug_when>
    <thetext>Created attachment 461639
Code reproduction

When compositing a large number of elements that have z-index, WebKit will crash. This behavior first appeared on iOS 15.6.

Steps to reproduce:

1. Open the code reproduction on a device running iOS 15.6.
2. Inspect the page and open the &quot;Layers&quot; tab in dev tools.
3. Tap the &quot;Crash&quot; button.
4. Observe that memory usage spikes and Safari reloads the page.

Other Information:

- I tested this on an iPhone 11 running iOS 15.6. In my tests, the memory usage spiked to over 1GB.
- This code reproduction does use a large number of elements. While using a smaller number of elements (such as 100) won&apos;t crash the browser, it will still cause the memory usage to spike.
- This issue can also been seen on Safari for macOS. On Safari 15.5, clicking the &quot;Crash&quot; button brings the memory usage up to 40mb. On STP 151, clicking the &quot;Crash&quot; button brings the memory usage up to over 700mb. (Tested on a 2021 MacBook Pro with M1 Pro)
- This issue also happens on WKWebView.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1891426</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-08-15 13:41:55 -0700</bug_when>
    <thetext>The testcase triggers backing store allocation on all the `div.native` but I&apos;m not sure why the ones outside the viewport have backing store.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1891428</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-08-15 13:42:48 -0700</bug_when>
    <thetext>&lt;rdar://problem/98686446&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1891572</commentid>
    <comment_count>3</comment_count>
      <attachid>461661</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-08-15 21:27:25 -0700</bug_when>
    <thetext>Created attachment 461661
Static testcase

We make backing store for all the layers because they are inside a large, animated element (&quot;container&quot;) so we keep all their backing stores alive.

There are several issues here:
1. The animation is a no-op, so we shouldn&apos;t consider it as something that extends backing store
2. z-index:-1 should not trigger backing store (`.native`) is a stacking context
3. Only `.container` should have backing while animating, because it&apos;s a stacking context.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897939</commentid>
    <comment_count>4</comment_count>
    <who name="Hans Krywalsky">hanskrywaa</who>
    <bug_when>2022-09-12 11:10:39 -0700</bug_when>
    <thetext>Still an issue with iOS 16, please fix as this is highly affecting users in one of our apps 😕</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898205</commentid>
    <comment_count>5</comment_count>
    <who name="">jameson</who>
    <bug_when>2022-09-13 06:14:02 -0700</bug_when>
    <thetext>This issue is also severely affecting our application and in some cases rendering it almost un-usable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898228</commentid>
    <comment_count>6</comment_count>
    <who name="">jameson</who>
    <bug_when>2022-09-13 07:05:31 -0700</bug_when>
    <thetext>Looks like this is still an issue in iOS 15.7 as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898352</commentid>
    <comment_count>7</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2022-09-13 15:27:25 -0700</bug_when>
    <thetext>I think the fix for https://bugs.webkit.org/show_bug.cgi?id=244543 will fix this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901483</commentid>
    <comment_count>8</comment_count>
    <who name="Maja">majainle</who>
    <bug_when>2022-09-27 06:50:19 -0700</bug_when>
    <thetext>I can confirm that I can reproduce this with 15.7 as well. Since our app is based on pinch zoom it makes it not usable at all. Would be nice if we can get this fixed soon.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1901576</commentid>
    <comment_count>9</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2022-09-27 11:00:50 -0700</bug_when>
    <thetext>&gt; I think the fix for https://bugs.webkit.org/show_bug.cgi?id=244543 will fix this.

Simon or Matt, would you mind confirming that it did?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1911063</commentid>
    <comment_count>10</comment_count>
    <who name="Liam DeBeasi">ldebeasi</who>
    <bug_when>2022-11-08 12:30:54 -0800</bug_when>
    <thetext>The issue seems to be resolved on STP 156 on macOS. However, the issue persists on iOS 16.2 beta 2. The memory usage spikes to over 2GB when following the original steps to reproduce on an iPhone 13.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1927852</commentid>
    <comment_count>11</comment_count>
    <who name="PaulPlay">lollollipop878</who>
    <bug_when>2023-01-24 10:16:27 -0800</bug_when>
    <thetext>I experience the same issue with cordova on 16.2</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1936611</commentid>
    <comment_count>12</comment_count>
    <who name="Liam DeBeasi">ldebeasi</who>
    <bug_when>2023-02-24 11:52:53 -0800</bug_when>
    <thetext>This no longer reproduces on iOS 16.3.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>461639</attachid>
            <date>2022-08-15 12:41:13 -0700</date>
            <delta_ts>2022-08-15 12:41:13 -0700</delta_ts>
            <desc>Code reproduction</desc>
            <filename>index.html</filename>
            <type>text/html</type>
            <size>1341</size>
            <attacher name="Liam DeBeasi">ldebeasi</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hhcnNldD0iVVRGLTgi
IC8+CiAgICA8dGl0bGU+ei1pbmRleCBjcmFzaDwvdGl0bGU+CiAgICA8bWV0YQogICAgICBuYW1l
PSJ2aWV3cG9ydCIKICAgICAgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNj
YWxlPTEuMCwgbWluaW11bS1zY2FsZT0xLjAiCiAgICAvPgogICAgPHN0eWxlPgogICAgICAuaXRl
bSAubmF0aXZlIHsKICAgICAgICBwb3NpdGlvbjogcmVsYXRpdmU7CiAgICAgICAgei1pbmRleDog
MTsKICAgICAgfQogICAgICAgIAogICAgICAuaXRlbSAubmF0aXZlOjphZnRlciB7CiAgICAgICAg
cG9zaXRpb246IHJlbGF0aXZlOwogICAgICAgIGNvbnRlbnQ6ICIiOwogICA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bnNmb3JtOiAndHJhbnNsYXRlM2QoMCwgMCwgMCknIH0sCiAgICAgICAgeyBv
ZmZzZXQ6IDEsIHRyYW5zZm9ybTogJ3RyYW5zbGF0ZTNkKDAsIDAsIDApJyB9CiAgICAgIF0sIDUw
MCk7CiAgICB9CiAgPC9zY3JpcHQ+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>461661</attachid>
            <date>2022-08-15 21:27:25 -0700</date>
            <delta_ts>2022-08-15 21:27:25 -0700</delta_ts>
            <desc>Static testcase</desc>
            <filename>many-negative-z-pseudos.html</filename>
            <type>text/html</type>
            <size>1176</size>
            <attacher name="Simon Fraser (smfr)">simon.fraser</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPG1ldGEgY2hhcnNldD0iVVRGLTgi
IC8+CiAgICA8dGl0bGU+ei1pbmRleCBjcmFzaDwvdGl0bGU+CiAgICA8bWV0YQogICAgICBuYW1l
PSJ2aWV3cG9ydCIKICAgICAgY29udGVudD0id2lkdGg9ZGV2aWNlLXdpZHRoLCBpbml0aWFsLXNj
YWxlPTEuMCwgbWluaW11bS1zY2FsZT0xLjAiCiAgICAvPgogICAgPHN0eWxlPgogICAgICAgIC5j
b250YWluZXIgewogICAgICAgICAgICB0cmFuc2Zvcm06IHRyYW5zbGF0ZTNkKDAsIDAsIDApOwog
ICAgICAgIH0KICAgICAgLml0ZW0gLm5hdGl2ZSB7CiAgICAgICAgcG9zaXRpb246IHJlbGF0aXZl
OwogICAgICAgIHotaW5kZXg6IDE7CiAgICAgIH0KICAgICAgICAKICAgICAgLml0ZW0gLm5hdGl2
ZTo6YWZ0ZXIgewogICAgICAgIHBvc2l0aW9uOiByZWxhdGl2ZTsKICAgICAgICBjb250ZW50OiAi
IjsKICAgICAgICB6LWluZGV4OiAtMTsKICAgICAgfQogICAgPC9zdHlsZT4KICA8L2hlYWQ+CiAg
PGJvZHk+CiAgICA8ZGl2IGNsYXNzPSJjb250YWluZXIiPgogICAgICA8ZGl2IGNsYXNzPSJpdGVt
Ij4KICAgICAgICA8ZGl2IGNsYXNzPSJuYXRpdmUiPgogICAgICAgICAgPGRpdiBjbGFzcz0iaW5u
ZXIiPgogICAgICAgICAgICA8aW1nIHNyYz0iaHR0cHM6Ly9waWNzdW0ucGhvdG9zLzIwMC8zMDAi
IC8+CiAgICAgICAgICA8L2Rpdj4KICAgICAgICA8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rp
dj4KICA8L2JvZHk+CiAgCiAgPHNjcmlwdD4KICAgIGNvbnN0IGNvbnRhaW5lciA9IGRvY3VtZW50
LnF1ZXJ5U2VsZWN0b3IoJy5jb250YWluZXInKTsKICAgIAogICAgbGV0IHRlbXBsYXRlID0gJyc7
CiAgICAKICAgIGZvciAobGV0IGkgPSAwOyBpIDwgMjA7IGkrKykgewogICAgICB0ZW1wbGF0ZSAr
PSBgCiAgICAgICAgPGRpdiBjbGFzcz0iaXRlbSI+CiAgICAgICAgICA8ZGl2IGNsYXNzPSJuYXRp
dmUiPgogICAgICAgICAgICA8ZGl2PgogICAgICAgICAgICAgIDxpbWcgc3JjPSJodHRwczovL3Bp
Y3N1bS5waG90b3MvMjAwLzMwMCIgLz4KICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICA8L2Rp
dj4KICAgICAgICA8L2Rpdj4KICAgICAgYAogICAgfQogICAgCiAgICBjb250YWluZXIuaW5uZXJI
VE1MID0gdGVtcGxhdGU7CiAgPC9zY3JpcHQ+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>