From: jenkins-bot Date: Wed, 30 Nov 2016 02:03:14 +0000 (+0000) Subject: Merge "mediawiki.api: Fix getToken() incompat with jQuery 3.0" X-Git-Tag: 1.31.0-rc.0~4731 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=e8ec72c26d1b1ac9a55d2a4d4e24a1d98e400a22;hp=00c8d18575b353a826b64c351ece9e381c51f663;p=lhc%2Fweb%2Fwiklou.git Merge "mediawiki.api: Fix getToken() incompat with jQuery 3.0" --- diff --git a/resources/src/mediawiki/api.js b/resources/src/mediawiki/api.js index b9e05c368f..0c08ca4b69 100644 --- a/resources/src/mediawiki/api.js +++ b/resources/src/mediawiki/api.js @@ -334,8 +334,8 @@ } ); } - // Different error, pass on to let caller handle the error code - return this; + // Let caller handle the error code + return $.Deferred().rejectWith( this, arguments ); } ); } ).promise( { abort: function () { @@ -363,6 +363,10 @@ promiseGroup = promises[ this.defaults.ajax.url ]; d = promiseGroup && promiseGroup[ type + 'Token' ]; + if ( !promiseGroup ) { + promiseGroup = promises[ this.defaults.ajax.url ] = {}; + } + if ( !d ) { apiPromise = this.get( { action: 'query', @@ -382,16 +386,13 @@ // Clear promise. Do not cache errors. delete promiseGroup[ type + 'Token' ]; - // Pass on to allow the caller to handle the error - return this; + // Let caller handle the error code + return $.Deferred().rejectWith( this, arguments ); } ) // Attach abort handler .promise( { abort: apiPromise.abort } ); // Store deferred now so that we can use it again even if it isn't ready yet - if ( !promiseGroup ) { - promiseGroup = promises[ this.defaults.ajax.url ] = {}; - } promiseGroup[ type + 'Token' ] = d; }