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 [[ https://fr.wikipedia.org/wiki/MediaWiki:Common.js | 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 [[ https://gerrit.wikimedia.org/g/mediawiki/skins/Vector/+/54897659fc3bb6b1ddf6cd60c91b625db79f5b3e/skin.json#27
| vector-2022 ]] loads script module `skins.vector.user`
# module [[ https://gerrit.wikimedia.org/g/mediawiki/skins/Vector/+/94d9445ba3c9332a786fe405778baa715f07b6bb/skin.json#144
| skins.vector.user ]] executes class `VectorResourceLoaderUserModule`
# class [[ https://gerrit.wikimedia.org/g/mediawiki/skins/Vector/+/54897659fc3bb6b1ddf6cd60c91b625db79f5b3e/includes/ResourceLoader/VectorResourceLoaderUserModule.php | 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, is has a dependency on the site's scripts (namely: [[ https://fr.wikipedia.org/wiki/MediaWiki:Common.js | MediaWiki:Common.js ]] and [[ https://fr.wikipedia.org/wiki/MediaWiki:Vector-2022.js | 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.