Bug 258870 - ElementInternals.setFormValue(<nullish value>) doesn't clear submission value
Summary: ElementInternals.setFormValue(<nullish value>) doesn't clear submission value
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Alexey Shvayka
URL:
Keywords: InRadar
Depends on:
Blocks: 154907
  Show dependency treegraph
 
Reported: 2023-07-05 01:42 PDT by fayti1703
Modified: 2023-07-18 07:31 PDT (History)
4 users (show)

See Also:


Attachments
Testcase (785 bytes, text/html)
2023-07-05 01:42 PDT, fayti1703
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description fayti1703 2023-07-05 01:42:35 PDT
Created attachment 466930 [details]
Testcase

Trying to remove a form-associated custom element's value via `.internals.setFormValue(null)` fails silently -- the old value appears during form submission and `FormData` construction on the parent form.

I've attached a test-case to demonstrate the issue. (Firefox 114 and Chrome 114 pass)
Comment 1 Alexey Shvayka 2023-07-05 12:05:53 PDT
(In reply to fayti1703 from comment #0)
> Created attachment 466930 [details]
> Testcase
> 
> Trying to remove a form-associated custom element's value via
> `.internals.setFormValue(null)` fails silently -- the old value appears
> during form submission and `FormData` construction on the parent form.
> 
> I've attached a test-case to demonstrate the issue. (Firefox 114 and Chrome
> 114 pass)

Thank you for the test case, I will take a look today.
Comment 2 Radar WebKit Bug Importer 2023-07-05 12:18:34 PDT
<rdar://problem/111802198>
Comment 3 Alexey Shvayka 2023-07-05 12:43:40 PDT
Oh it seems with current bindings generator implementation, for `optional FormValue? state`, we can't differentiate between explicit `null` / `undefined` and a missing argument.

I am aware the bug is about first parameter, `value`, yet this fact ^^ affects the approach on how to fix it.
Comment 4 Alexey Shvayka 2023-07-11 07:38:56 PDT
Pull request: https://github.com/WebKit/WebKit/pull/15741
Comment 5 EWS 2023-07-18 07:31:21 PDT
Committed 266126@main (b691e0b9a450): <https://commits.webkit.org/266126@main>

Reviewed commits have been landed. Closing PR #15741 and removing active labels.