whatwg / xhr

XMLHttpRequest Standard
https://xhr.spec.whatwg.org/
Other
314 stars 129 forks source link

Add optional submitter argument to FormData constructor #366

Closed jenseng closed 1 year ago

jenseng commented 1 year ago

Closes #262, I went with the approach outlined here. Implementation/MDN issues have been filed, and some implementation-specific POCs have also been created (chromium, gecko, and jsdom).

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

annevk commented 1 year ago

@mfreed7 @rniwa @smaug---- tagging you here for visibility and to ensure nothing much changed here since 2019...

jenseng commented 1 year ago

@mfreed7 if it helps the discussion along, here's a first pass at a blink implementation (caveats: my first time working in Chromium, haven't written C/C++ in a decade, probably needs more testing, etc. 😅). From my quick manual test in the console it seems to be working: submitter-chromium

jenseng commented 1 year ago

@smaug---- here's the equivalent POC for gecko/FF. Same caveats apply as in the comment above :)

submitter-firefox

mfreed7 commented 1 year ago

@mfreed7 if it helps the discussion along, here's a first pass at a blink implementation (caveats: my first time working in Chromium, haven't written C/C++ in a decade, probably needs more testing, etc. 😅). From my quick manual test in the console it seems to be working:

Wow, this is the best ping I've received: "here's a prototype". Thanks!

I think we're generally still supportive of this proposal and this PR.

jenseng commented 1 year ago

👋 @rniwa I haven't forgotten about WebKit, I have a comparable patch there too, though I got stuck in XCode/dlopen hell so I haven't been able to test it just yet. Happy to send it your way if it helps.

cdumez commented 1 year ago

👋 @rniwa I haven't forgotten about WebKit, I have a comparable patch there too, though I got stuck in XCode/dlopen hell so I haven't been able to test it just yet. Happy to send it your way if it helps.

Looks good to me from WebKit side. I don't mind implementing it and working on getting whatever patch you have landed. This seems like a minor change and I can see how this could be useful.

annevk commented 1 year ago

@jenseng I think we're all good here. Just need to wait for HTML to be indexed by Reffy. The only outstanding task is filing implementation bugs (and linking them to this PR and the tests). Would you like to do that as well?

jenseng commented 1 year ago

@jenseng I think we're all good here. Just need to wait for HTML to be indexed by Reffy. The only outstanding task is filing implementation bugs (and linking them to this PR and the tests). Would you like to do that as well?

Sure thing, I'll do that in a bit here 👍

jenseng commented 1 year ago

There's one minor ambiguity around Image Button submitters that I'd like to clarify, see this comment on the WPT test PR

jenseng commented 1 year ago

Seems like the build is failing due to some webdriver-bidi export ambiguity around events, though I'm not sure why it didn't fail before 🤔 ... looks similar to these recent issues (https://github.com/w3c/webdriver-bidi/pull/348, https://github.com/w3c/webdriver-bidi/pull/349). Should I just do some link-defaults stuff in the current PR, or would it be better to get webdriver-bidi fixed?

edited, aha, I see @annevk is already on it

annevk commented 1 year ago

@jenseng if you file the relevant bugs today I will merge this tomorrow (addressing the webdriver-bidi issue locally). If you don't get around to filing the bugs I might be able to take that on as well. Thanks for all your work on this and guiding me through the design decisions and bug in the HTML Standard. 😊

jenseng commented 1 year ago

Ok issues have all been filed, thanks for your help on this @annevk!

jenseng commented 1 year ago

If anyone needs this in the meantime (or in older browsers), I made a polyfill that supports it with some form shenanigans 🙈