<?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>274214</bug_id>
          
          <creation_ts>2024-05-15 09:00:44 -0700</creation_ts>
          <short_desc>Constructed FormData object should not contain entries for the Image Button submitter by default</short_desc>
          <delta_ts>2024-05-17 20:36:08 -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>Forms</component>
          <version>Safari 16</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=239070</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=274277</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jon Jensen">jenseng</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>akeerthi</cc>
    
    <cc>cdumez</cc>
    
    <cc>karlcow</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
    
    <cc>zsun</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2035556</commentid>
    <comment_count>0</comment_count>
    <who name="Jon Jensen">jenseng</who>
    <bug_when>2024-05-15 09:00:44 -0700</bug_when>
    <thetext>Overview:
When a `FormData` object is constructed in a submit handler, it automatically contains entries for the Image Button submitter even if the `submitter` parameter is not passed to the constructor. This does not happen with regular (non-image) submitters. This also does not happen in Chromium or Gecko.

This is related to https://bugs.webkit.org/show_bug.cgi?id=239070, but was not resolved by https://commits.webkit.org/r293444

Steps to Reproduce:

1. Create a page with the following content:
&gt; &lt;script&gt;
&gt;   function onSubmit(event) {
&gt;     event.preventDefault();
&gt;     const formData = new FormData(event.target);
&gt;     console.log(new URLSearchParams(formData).toString());
&gt;   }
&gt; &lt;/script&gt;
&gt; &lt;form onsubmit=&quot;onSubmit(event)&quot;&gt;
&gt;   &lt;input
&gt;     name=&quot;submitter&quot;
&gt;     type=&quot;image&quot;
&gt;     name=&quot;input&quot;
&gt;     href=&quot;/some/image.png&quot;
&gt;     alt=&quot;Image Button&quot;
&gt;   /&gt;
&gt; &lt;/form&gt;

```
2. Click the `Image Button`

Actual Results:
Something like `submitter.x=10&amp;submitter.y=4` is logged

Expected Results:
An empty string should be logged. The submitter should only be included in the FormData object if it is explicitly passed to the constructor. See https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData#submitter</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035687</commentid>
    <comment_count>1</comment_count>
      <attachid>471419</attachid>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2024-05-15 21:12:40 -0700</bug_when>
    <thetext>Created attachment 471419
testcase

Adding the testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035699</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-05-15 22:13:02 -0700</bug_when>
    <thetext>&lt;rdar://problem/128176811&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035764</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-16 05:44:40 -0700</bug_when>
    <thetext>This is even earlier attempt of bug 239070 which tried to extend WPT test as well for image.

https://bugs.webkit.org/show_bug.cgi?id=234069

Also later `image` changes from bug 234069 were not carried into 239070. So it might be just reapplying 234069 (image specific changes)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035766</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-16 05:54:12 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #3)
&gt; This is even earlier attempt of bug 239070 which tried to extend WPT test as
&gt; well for image.
&gt; 
&gt; https://bugs.webkit.org/show_bug.cgi?id=234069
&gt; 
&gt; Also later `image` changes from bug 234069 were not carried into 239070. So
&gt; it might be just reapplying 234069 (image specific changes)?

Confirmed on local build that just doing `image` specific changes from bug 234069 fixes this test case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035769</commentid>
    <comment_count>5</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-16 06:08:02 -0700</bug_when>
    <thetext>Next steps should be - take tests from bug 234069 and upload them on WPT - so if we introduce this behavior - we don&apos;t regress leading to:

rdar://88359001

and then once test lands then do this changes and ensure that WPT passes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035797</commentid>
    <comment_count>6</comment_count>
    <who name="Jon Jensen">jenseng</who>
    <bug_when>2024-05-16 08:13:23 -0700</bug_when>
    <thetext>Opened a PR to add wpts around this: https://github.com/web-platform-tests/wpt/pull/46316</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2035798</commentid>
    <comment_count>7</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-16 08:14:49 -0700</bug_when>
    <thetext>(In reply to Jon Jensen from comment #6)
&gt; Opened a PR to add wpts around this:
&gt; https://github.com/web-platform-tests/wpt/pull/46316

Perfect! Once this get merged, I will add it to WebKit repo and then do PR to fix it and confirm whether it fixes everything and don&apos;t regress any behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2036023</commentid>
    <comment_count>8</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-17 09:21:40 -0700</bug_when>
    <thetext>Draft PR - https://github.com/WebKit/WebKit/pull/28713

^ I will check bit more locally to confirm it does not cause similar regression as in bug 239070

I synced the tests in bug 274277.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2036029</commentid>
    <comment_count>9</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-05-17 09:36:15 -0700</bug_when>
    <thetext>(In reply to Ahmad Saleem from comment #8)
&gt; Draft PR - https://github.com/WebKit/WebKit/pull/28713
&gt; 
&gt; ^ I will check bit more locally to confirm it does not cause similar
&gt; regression as in bug 239070
&gt; 
&gt; I synced the tests in bug 274277.

I took tests from: https://github.com/web-platform-tests/wpt/pull/32916

and confirmed that they pass and don&apos;t lead to regression as in rdar://88359001.

Got following on local:

PASS Image submit button should submit the right coordinates on mouse clicks
PASS With multiple image submit buttons, the correct one should be used</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2036187</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-05-17 20:36:06 -0700</bug_when>
    <thetext>Committed 278944@main (69eafe9632ca): &lt;https://commits.webkit.org/278944@main&gt;

Reviewed commits have been landed. Closing PR #28713 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>471419</attachid>
            <date>2024-05-15 21:12:40 -0700</date>
            <delta_ts>2024-05-15 21:12:40 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>testcase.html</filename>
            <type>text/html</type>
            <size>1221</size>
            <attacher name="Karl Dubost">karlcow</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KCjxoZWFkPgogICAgPG1ldGEgY2hhcnNl
dD0iVVRGLTgiPgogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiCiAgICAgICAgICBjb250ZW50PSJ3
aWR0aD1kZXZpY2Utd2lkdGgsIGluaXRpYWw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gICAgICBj
b25zdCBtc2cgPSAiRkFJTDogZm9ybURhdGEgc2hvdWxkIHJldHVybiBhbiBlbXB0eSBzdHJpbmcu
IEFjdHVhbCB2YWx1ZTogIiArIGFjdHVhbDsKICAgICAgICAgICAgICAgIHJlc3VsdC50ZXh0Q29u
dGVudCA9IG1zZzsKICAgICAgICAgICAgICAgIHJlc3VsdC5zdHlsZS5iYWNrZ3JvdW5kQ29sb3Ig
PSAiI0ZGQ0NDQiI7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgCiAgICAgICAgfQoKICAgIDwv
c2NyaXB0Pgo8L2JvZHk+Cgo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>