mediawiki.api.uploadWithFormData: Implement in terms of existing mw.Api functionality
- mw.Api#ajax can already handle FormData, if instructed to, since d19432a332c21935d42087db706e50c5259063ea (which seems to have been a part of mobile uploads experiments).
- MobileFrontend's api.js already had code to provide upload progress events while using mw.Api, lifted it from there.
With this change, we should be able to just use mw.ForeignApi (being
added in Ic20b9682d28633baa87d22e6e9fb71ce507da58d) to upload to a
different wiki. (Assuming that the browser supports FormData.)
- Improve detection of whether we can use FormData: if we are given a HTMLInputElement, try to get a File from it before we fall back to iframe form upload.
- mediawiki.api.edit: In #postWithEditToken, pass through the ajaxOptions parameter to #postWithToken.