resourceloader: Remove redundant type-checks in internal code
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 28 Aug 2015 23:12:07 +0000 (01:12 +0200)
committerOri.livneh <ori@wikimedia.org>
Tue, 1 Sep 2015 16:33:15 +0000 (16:33 +0000)
The private 'execute()' method only runs for modules that have been
implemented by mw.loader.implement, which already throws if 'messages'
or 'style' is set to a non-object value.

The execute() code for 'templates' already has this check removed.

Change-Id: I65b8a87500388d3d2ca6e495e1e50179639ba27a

resources/src/mediawiki/mediawiki.js

index 2632902..2621a97 100644 (file)
                                registry[module].state = 'loading';
 
                                // Add localizations to message system
-                               if ( $.isPlainObject( registry[module].messages ) ) {
+                               if ( registry[module].messages ) {
                                        mw.messages.set( registry[module].messages );
                                }
 
                                // * back-compat: { <media>: [url, ..] }
                                // * { "css": [css, ..] }
                                // * { "url": { <media>: [url, ..] } }
-                               if ( $.isPlainObject( registry[module].style ) ) {
+                               if ( registry[module].style ) {
                                        for ( key in registry[module].style ) {
                                                value = registry[module].style[key];
                                                media = undefined;