Krinkle has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364006 )

Change subject: mw.loader: Log unknown modules in load() to console
......................................................................

mw.loader: Log unknown modules in load() to console

Follows-up If8ff31b530dfbd882. Now that we have resolveStubbornly,
we don't need to filter out unknown modules ahead of time.

Aside from removing the needless filter condition, it also has
the benefit of causing a message to be logged to the console,
which can help discover problems. Previously these were silently
ignored.

Change-Id: I700db4931dfd0a412a8eca66c4a74b8831ab0086
---
M resources/src/mediawiki/mediawiki.js
M tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
2 files changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/06/364006/1

diff --git a/resources/src/mediawiki/mediawiki.js 
b/resources/src/mediawiki/mediawiki.js
index 91e75d9..01ab322 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -2083,7 +2083,7 @@
                                        // Filter out top-level modules that 
are unknown or failed to load before.
                                        filtered = $.grep( modules, function ( 
module ) {
                                                var state = mw.loader.getState( 
module );
-                                               return state !== null && state 
!== 'error' && state !== 'missing';
+                                               return state !== 'error' && 
state !== 'missing';
                                        } );
                                        // Resolve remaining list using the 
known dependency tree.
                                        // This also filters out modules with 
unknown dependencies. (T36853)
diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js 
b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
index 9dc9e5d..a00b3cb 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
@@ -230,9 +230,25 @@
                ).always( done );
        } );
 
-       QUnit.test( '.load() - Error: Unregistered (ignored)', function ( 
assert ) {
-               assert.expect( 0 );
-               mw.loader.load( 'test.using.unreg2' );
+       QUnit.test( '.load() - Error: Unregistered', function ( assert ) {
+               var capture = [];
+               this.sandbox.stub( mw, 'track', function ( topic, data ) {
+                       capture.push( {
+                               topic: topic,
+                               error: data.exception && data.exception.message,
+                               source: data.source
+                       } );
+               } );
+
+               mw.loader.load( 'test.load.unreg' );
+               assert.deepEqual(
+                       [ {
+                               topic: 'resourceloader.exception',
+                               error: 'Unknown dependency: test.load.unreg',
+                               source: 'resolve'
+                       } ],
+                       capture
+               );
        } );
 
        // Regression test for T36853

-- 
To view, visit https://gerrit.wikimedia.org/r/364006
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I700db4931dfd0a412a8eca66c4a74b8831ab0086
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to