User "Catrope" posted a comment on MediaWiki.r96978.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96978#c22442
Commit summary:

Fix the fixme on r88053: dependency handling was broken in debug mode in 
certain cases. More specifically, if A is a file module that depends on B, B is 
a wiki module that depends on C and C is a file module, the loading order is 
CBA (correct) in production mode but was BCA (wrong) in debug mode. Fixed this 
by URL-ifying scripts and styles for those modules in debug mode, as I said to 
on CR. What this means is that the initial debug=true request for a module will 
now always return arrays of URLs, never the JS or CSS itself. This was already 
the case for file modules (which returned arrays of URLs to the raw files), but 
not for other modules (which returned the JS and CSS itself). So for non-file 
modules, load.php?modules=foo&debug=true now returns some JS that instructs the 
loader to fetch the module's JS from 
load.php?modules=foo&debug=true&only=scripts and the CSS from ...&only=styles .

* Removed the magic behavior where ResourceLoaderModule::getScripts() and 
getStyles() could return an array of URLs where the documentation said they 
should return a JS/CSS string. Because I didn't restructure the calling code 
too much, the old magical behavior should still work.
* Instead, move this behavior to getScriptURLsForDebug() and 
getStyleURLsForDebug(). The default implementation constructs a single URL for 
a load.php request for the module with debug=true&only=scripts (or styles). The 
URL building code duplicates some things from 
OutputPage::makeResourceLoaderLink(), I'll clean that up later. 
ResourceLoaderFileModule overrides this method to return URLs to the raw files, 
using code that I removed from getScripts()/getStyles()
* Add ResourceLoaderModule::supportsURLLoading(), which returns true by default 
but may return false to indicate that a module does not support loading via a 
URL. This is needed to respect $this->debugRaw in ResourceLoaderFileModule (set 
to true for jquery and mediawiki), and obviously for the startup module as 
well, because we get bootstrapping problems otherwise (can't call 
mw.loader.implement() when the code for mw.loader isn't loaded yet)

Comment:

Hmm, this probably needs some tests too. I'll whip some up after I clean up the 
code duplication.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to