Merge "Perform a permission check on the title when changing the page language"
[lhc/web/wiklou.git] / includes / specials / SpecialJavaScriptTest.php
index dc6a619..17c64c8 100644 (file)
@@ -134,14 +134,26 @@ class SpecialJavaScriptTest extends SpecialPage {
                // Catch exceptions (such as "dependency missing" or "unknown module") so that we
                // always start QUnit. Re-throw so that they are caught and reported as global exceptions
                // by QUnit and Karma.
-               $code .= '(function () {'
-                       . 'var start = window.__karma__ ? window.__karma__.start : QUnit.start;'
-                       . 'try {'
-                       . 'mw.loader.using( ' . Xml::encodeJsVar( $modules ) . ' )'
-                       . '.always( start )'
-                       . '.fail( function ( e ) { throw e; } );'
-                       . '} catch ( e ) { start(); throw e; }'
-                       . '}());';
+               $modules = Xml::encodeJsVar( $modules );
+               $code .= <<<CODE
+(function () {
+       var start = window.__karma__ ? window.__karma__.start : QUnit.start;
+       try {
+               mw.loader.using( $modules )
+                       .always( function () {
+                               start();
+                       } )
+                       .fail( function ( e ) {
+                               setTimeout( function () {
+                                       throw e;
+                               } );
+                       } );
+       } catch ( e ) {
+               start();
+               throw e;
+       }
+}());
+CODE;
 
                header( 'Content-Type: text/javascript; charset=utf-8' );
                header( 'Cache-Control: private, no-cache, must-revalidate' );