From: Bartosz DziewoƄski Date: Thu, 27 Apr 2017 18:22:41 +0000 (+0200) Subject: SpecialJavaScriptTest: Make sure we don't catch our own exception X-Git-Tag: 1.31.0-rc.0~3396^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=d214edb945494a882d72c588e07b47736f9075fd SpecialJavaScriptTest: Make sure we don't catch our own exception If the jQuery promise returned by mw.loader.using() is rejected synchronously (e.g. because one of the modules has a dependency on non-existent module), the function passed to fail() also executes synchronously. Note that this is true also with jQuery 3. The exception it throws was caught by the catch() below, which resulted in start() being called twice, which resulted in QUnit throwing 'Uncaught Error: Called start() outside of a test context too many times' rather than actually starting. Change-Id: I5c6b50647c0af0fdec6547aaa59165f6b4a42642 --- diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php index 52064b79f5..17c64c8ede 100644 --- a/includes/specials/SpecialJavaScriptTest.php +++ b/includes/specials/SpecialJavaScriptTest.php @@ -143,7 +143,11 @@ class SpecialJavaScriptTest extends SpecialPage { .always( function () { start(); } ) - .fail( function ( e ) { throw e; } ); + .fail( function ( e ) { + setTimeout( function () { + throw e; + } ); + } ); } catch ( e ) { start(); throw e;