Page MenuHomePhabricator

Dependencies break when mixing JS files and WikiModules, when debug=true
Closed, ResolvedPublic

Description

Author: jp.posma

Description:
When mixing Javascript files and ResourceLoaderWikiModule, the execution order is incorrect. JS scripts from ResourceLoaderWikiModule are loaded inline, and are executed before the files are executed.

When debug=false, there is no problem, as files are also included as inline JS (in load.php). The problem only occurs when mixing the two types of inclusion.

Can be reproduced by checking out r90873, installing WikiLove, adding a mw.log statement to MediaWiki:WikiLove.js and to extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js. Obviously the latter should be executed first, and then the site-specific JS can overwrite options. However, when setting debug=true, one will find that the latter is executed before MediaWiki:WikiLove.js, which is wrong.


Version: 1.17.x
Severity: normal

Details

Reference
bz29608

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:35 PM
bzimport set Reference to bz29608.
bzimport added a subscriber: Unknown Object (MLST).

Wasn't this also a CR comment + fixme on a revision somewhere?

(In reply to comment #1)

Wasn't this also a CR comment + fixme on a revision somewhere?

Found it: https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/88053#c17169

Summarized, afaik the solution is to do the same for wiki modules as we do for files in debug mode: Load them from a url, with only=scripts