Page MenuHomePhabricator

mw.util is undefined in de.wiktionary's MediaWiki:Common.js; needs wrapping with mw.loader.using
Closed, InvalidPublic


Beginning on 27.04.2017 we have some problems with undefined objects in JavaScript in german wiktionary. First we saw an undefined "mwCustomEditButtons" and "is_opera" when editing. After supplying a work around in we end up with an undefined mw.util. On we are using mw.util.addCSS to add some special CSS. This doesn't work now. See also discussion:

Event Timeline

I manage to get that error when going to , in the Developer Tools of my web browser.
mw.util.addCSS is used in so that's the file to fix.

Have you tried forcing it to load by entering mw.loader.load( 'mw.util' ) already? See for more information how to potentially debug.

We also started seeing intermittent missing mw.util on donatewiki where we hadn't before. It was easy to fix by wrapping with mw.loader.using as described at

For the records, this issue is likely a result of T122755.

Aklapper renamed this task from mw.util is undefined to mw.util is undefined in de.wiktionary's MediaWiki:Common.js; needs wrapping with mw.loader.using.Apr 28 2017, 1:03 PM

As a solution has been given in T164013#3218483 and as this turns out to be a problem in a local script on one wiki, this is a matter to discuss and fix on the local wiki and not handled in Phabricator/Maniphest (until gets solved), as Phabricator/Maniphest is used for MediaWiki, MediaWiki extensions, or server configuration.
Hence closing this task as invalid (as it's a valid problem but out of scope for Phabricator) but please feel free to ask followup questions here if the proposed solution does not work for you! Thanks for your understanding.

For the records, is another example showing how this can be fixed.