From: Timo Tijhof Date: Tue, 4 Sep 2018 01:05:00 +0000 (+0100) Subject: resourceloader: Remove unused string[] module logic in register() X-Git-Tag: 1.34.0-rc.0~4200^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=3dccd204dae9530c1a15d18b7987763660e16cb1;p=lhc%2Fweb%2Fwiklou.git resourceloader: Remove unused string[] module logic in register() There are two signatures for this method that we test, document, and use: 1. register( name, version, ... ) 2. register( [ [name,version,...], [name,version,..], ... ] ) But the code was also allowing a third kind that is never used, and also not documented anywhere or tested. 3. register( [ name, name, ... ] ) Change-Id: I3ed69117affd83d03c4c629d352f19bad50395c9 --- diff --git a/resources/src/startup/mediawiki.js b/resources/src/startup/mediawiki.js index f927aade54..2f196dead1 100644 --- a/resources/src/startup/mediawiki.js +++ b/resources/src/startup/mediawiki.js @@ -1760,14 +1760,10 @@ // Allow multiple registration if ( typeof module === 'object' ) { resolveIndexedDependencies( module ); + // module is an array of arrays for ( i = 0; i < module.length; i++ ) { // module is an array of module names - if ( typeof module[ i ] === 'string' ) { - mw.loader.register( module[ i ] ); - // module is an array of arrays - } else if ( typeof module[ i ] === 'object' ) { - mw.loader.register.apply( mw.loader, module[ i ] ); - } + mw.loader.register.apply( mw.loader, module[ i ] ); } return; }