Page MenuHomePhabricator

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

Description

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 https://de.wiktionary.org/wiki/MediaWiki:Onlyifediting.js we end up with an undefined mw.util. On https://de.wiktionary.org/wiki/Spezial:Letzte_Änderungen we are using mw.util.addCSS to add some special CSS. This doesn't work now. See also discussion: https://de.wiktionary.org/wiki/MediaWiki_Diskussion:Edittools#Fehler

Event Timeline

Hi,
I manage to get that error when going to https://de.wiktionary.org/wiki/Spezial:Letzte_Änderungen?debug=true , in the Developer Tools of my web browser.
mw.util.addCSS is used in https://de.wiktionary.org/wiki/MediaWiki:Common.js so that's the file to fix.

Have you tried forcing it to load by entering mw.loader.load( 'mw.util' ) already? See https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Client-side_errors 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 https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Client-side_.28dynamically.29

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 https://phabricator.wikimedia.org/T121470 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, https://ru.wikipedia.org/?diff=85108191&oldid=85095467 is another example showing how this can be fixed.