On French wiki, an user reported the following error:
Exception in module-execute in module skins.vector.user:
ReferenceError: obtenir is not defined
obtenir() is a function that is defined in our MediaWiki:Common.js, and this function is very often used in users' personal JavaScripts (common.js, vector.js, etc.).
In theory a mw.loader.using('site') should be used, but there is no need for in practice (which is great as obtenir() is meant to be short and simple to use), as the MediaWiki:Common.js is always loaded before users' JavaScripts, and I think this order will always be ensured to be as so, as changing this order would break so many users' JavaScripts.
But when the user uses Vector 2022, currently the user's vector.js may be loaded before the site's MediaWiki:Common.js, causing the above error.
Here is the explanation:
- skin vector-2022 loads script module skins.vector.user
- module skins.vector.user executes class VectorResourceLoaderUserModule
- class VectorResourceLoaderUserModule loads the user's vector.js
- user's vector.js is executed, without ensuring the site's scripts have been executed beforehand.
To fix the issue, we have to ensure that if the user's vector.js is executed, it has a dependency on the site's scripts (namely: MediaWiki:Common.js and MediaWiki:Vector-2022.js, not sure of the name of the latter).
@Jdlrobson I think the issue is of high priority, as JavaScript may be broken for many users currently.
QA steps
- Create MediaWiki:Common.js, MediaWiki:Vector-2022.js, MediaWiki:Vector.js, User:xx/vector-2022.js, User:xx/vector.js with console.log to display its name.
- Check the console, the output order should be as above.