Original bug title:
VisualEditor: Inserting Media fails when caret is not positioned after initialization
And this is how to reproduce the issue:
- Go to https://www.mediawiki.org/wiki/Sandbox?veaction=edit
- Confirm the "This is our new tool ...."
- Reload the page
- Press "Insert"
- Press "Media" (dialog opens)
- Click one of the images.
Result:
Mozilla Firefox:
- POST https://www.mediawiki.org/w/api.php [HTTP/1.1 200 OK 281ms]
- TypeError: splice is undefined load.php:153
- Nothing happens except that the dialog is closed.
- Pressing "Insert" -> "Media" now does not open any dialog
Opera Next:
- Uncaught TypeError: Cannot read property 'apply' of undefined VM140:146
- Nothing happens except that the dialog is closed.
- Pressing "Insert" -> "Media" now does not open any dialog
- Stacktrace: http://pastebin.de/124262
Expected:
- Image inserted
- Being able to add further images to the page
Unrelated question:
- Why are you using FormData for this specific request?
Version: unspecified
Severity: normal
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=64759