Merge "Follow-up 4107d1d4: avoid JS errors when trying to call mw.track() from jquery...
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 18 Sep 2017 20:37:02 +0000 (20:37 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 18 Sep 2017 20:37:03 +0000 (20:37 +0000)
resources/lib/jquery/jquery.migrate.js

index 12212ff..70512e0 100644 (file)
@@ -83,7 +83,9 @@ function migrateWarn( msg ) {
                warnedAbout[ msg ] = true;
                jQuery.migrateWarnings.push( msg );
                // PATCH: Add instrumentation for statistics --Krinkle
-               mw.track( "mw.deprecate", "jquery-migrate" );
+               if ( window.mw && window.mw.track ) {
+                       window.mw.track( "mw.deprecate", "jquery-migrate" );
+               }
                if ( console && console.warn && !jQuery.migrateMute ) {
                        console.warn( "JQMIGRATE: " + msg );
                        if ( jQuery.migrateTrace && console.trace ) {