<?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>246526</bug_id>
          
          <creation_ts>2022-10-14 09:56:01 -0700</creation_ts>
          <short_desc>[Fetch API] Headers iteration should not happen on cached headers list</short_desc>
          <delta_ts>2022-10-19 02:00:46 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>WebKit Nightly Build</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>
          
          <blocked>151937</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Raphael Kubo da Costa (:rakuco)">rakuco</reporter>
          <assigned_to name="youenn fablet">youennf</assigned_to>
          <cc>achristensen</cc>
    
    <cc>annevk</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1905661</commentid>
    <comment_count>0</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2022-10-14 09:56:01 -0700</bug_when>
    <thetext>See https://github.com/web-platform-tests/wpt/pull/36455

FetchHeaders::Iterator seems to cache a FetchHeaders&apos; keys at the time iteration starts, so if the same instance is modified during iteration not all changes will be visible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1906037</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-10-17 00:01:56 -0700</bug_when>
    <thetext>&lt;rdar://problem/101235580&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1906042</commentid>
    <comment_count>2</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2022-10-17 00:50:07 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/5437</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1906048</commentid>
    <comment_count>3</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2022-10-17 01:38:40 -0700</bug_when>
    <thetext>Raphael, did you happen to check `FormData` and `URLSearchParams` as well? This might benefit from testing in each API with `iterable&lt;&gt;` given how it&apos;s implemented.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1906221</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-10-17 12:06:43 -0700</bug_when>
    <thetext>Committed 255639@main (68f5a2f24c94): &lt;https://commits.webkit.org/255639@main&gt;

Reviewed commits have been landed. Closing PR #5437 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1906548</commentid>
    <comment_count>5</comment_count>
    <who name="Raphael Kubo da Costa (:rakuco)">rakuco</who>
    <bug_when>2022-10-18 12:02:59 -0700</bug_when>
    <thetext>(In reply to Anne van Kesteren from comment #3)
&gt; Raphael, did you happen to check `FormData` and `URLSearchParams` as well?
&gt; This might benefit from testing in each API with `iterable&lt;&gt;` given how it&apos;s
&gt; implemented.

URLSearchParams is covered by https://github.com/web-platform-tests/wpt/blob/master/webidl/ecmascript-binding/iterator-invalidation-foreach.html (I actually based the Fetch tests on it).

I&apos;ve submitted https://github.com/web-platform-tests/wpt/pull/36532 to cover FormData.

I haven&apos;t checked it in depth, but I think all engines implement them correctly because their &quot;value pairs to iterate over&quot; are just their internal name-value lists.

Things get trickier with Headers because it&apos;s one of the few cases where the value pairs require modification to the internal data structure. AFAICS only a handful of interfaces do that: Headers, MediaKeyStatusMap (possibly), XRHand (also possibly), and StylePropertyMap (it&apos;s CSS so I have close to no idea :-).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1906729</commentid>
    <comment_count>6</comment_count>
    <who name="Anne van Kesteren">annevk</who>
    <bug_when>2022-10-19 02:00:46 -0700</bug_when>
    <thetext>Thanks Raphael, much appreciated!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>