X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fmediawiki.api%2Fmediawiki.api.js;h=749086218eb18d0c4837a0180e018a8a79834a79;hb=bad8847147778997818a2cbdd8c1ea0d5fe7ac65;hp=6012d93e36d1abbe3f825c5d9d183ab56f462451;hpb=f12051919fd5c2d62cb9fa35f297486cea6bfa1a;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/mediawiki.api/mediawiki.api.js b/resources/mediawiki.api/mediawiki.api.js index 6012d93e36..749086218e 100644 --- a/resources/mediawiki.api/mediawiki.api.js +++ b/resources/mediawiki.api/mediawiki.api.js @@ -112,11 +112,13 @@ * * @param {Object} parameters * @param {Object} [ajaxOptions] - * @return {jQuery.Promise} Done: API response data. Fail: Error code + * @return {jQuery.Promise} Done: API response data and the jqXHR object. + * Fail: Error code */ ajax: function ( parameters, ajaxOptions ) { var token, apiDeferred = $.Deferred(), + msg = 'Use of mediawiki.api callback params is deprecated. Use the Promise instead.', xhr; parameters = $.extend( {}, this.defaults.parameters, parameters ); @@ -140,10 +142,14 @@ // Backwards compatibility: Before MediaWiki 1.20, // callbacks were done with the 'ok' and 'err' property in ajaxOptions. if ( ajaxOptions.ok ) { + mw.track( 'mw.deprecate', 'api.cbParam' ); + mw.log.warn( msg ); apiDeferred.done( ajaxOptions.ok ); delete ajaxOptions.ok; } if ( ajaxOptions.err ) { + mw.track( 'mw.deprecate', 'api.cbParam' ); + mw.log.warn( msg ); apiDeferred.fail( ajaxOptions.err ); delete ajaxOptions.err; } @@ -233,12 +239,6 @@ apiPromise = this.get( { action: 'tokens', type: type - }, { - // Due to the API assuming we're logged out if we pass the callback-parameter, - // we have to disable jQuery's callback system, and instead parse JSON string, - // by setting 'jsonp' to false. - // TODO: This concern seems genuine but no other module has it. Is it still - // needed and/or should we pass this by default? } ) .done( function ( data ) { // If token type is not available for this user,