- Widget Hotcat is enabled in Gadget settings
- In Special:UploadFile page
- File validation is enabled and loaded.
It seems that not all interface languages have this feature on.Update: It seems that file validation depends on some RL module that takes long time to load.
- Select a random file and wait for file validation
- Select another file
- Function
setup_upload
, which is responsible for presenting category controls in upload page, should not be fired multiple times.
- Hotcat was re-loaded with unexpected additional category edit control, regardless of its previous state.
- Check callstack.
If file validation is enabled, MediaWiki will send a XHR request to server. A callback is fired when such request finishes. Leveraging DOM operation, the client is able to display preview, present a warning or do something else according to server's response.
MediaWiki client-side JavaScript framework contains a hook that provides the ability to monitor page content changes. Hotcat relies on this hook for initialization. When the hook is triggered, Hotcat clears existing initialization flag and kicks off DOM operations.
So in this case, when file validation finished, the upload form was changed to reflect validation status (file deduplication, preview, etc.). Then the content hook was fired. Finally, Hotcat was constantly reloaded, regardless of its previous status.
Use a global variable (which acts as a lock) instead of a local variable to determine the eligibility of a full initialization.
A patched version is available at here.
Fast publish - Reversion 10 (2017/3/29)