r88680 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88679‎ | r88680 | r88681 >
Date:20:26, 23 May 2011
Author:krinkle
Status:ok
Tags:
Comment:
Adapt UW to account for the change in jQuery's behaviour since jQuery 1.5.2. jQuery attempts to interact with the API by passing a callback parameter (to avoid having to parse JSON strings which is likely slower than just calling a callback).

Since the API assumes the origin to be an anonymous user if the callback-parameter is passed we have to override this when dealing with the API (since uploading requires the user to be logged in).

Setting jsonp:false will do this. See also:
http://api.jquery.com/jQuery.ajax/ (scroll to "jsonp" setting and the note about jQuery 1.5)


(Follow-up r88607: Upgrade jQuery 1.4.4 to 1.5.2)
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.Api.edit.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.Api.edit.js
@@ -80,7 +80,14 @@
8181 }
8282 };
8383
84 - var ajaxOptions = { 'ok': ok, 'err': err };
 84+ var ajaxOptions = {
 85+ 'ok': ok,
 86+ 'err': err,
 87+ // Due to the API assuming we're logged out if we pass the callback-parameter,
 88+ // we have to disable jQuery's callback system, and instead parse JSON string,
 89+ // by setting 'jsonp' to false.
 90+ 'jsonp': false
 91+ };
8592
8693 api.get( parameters, ajaxOptions );
8794 },

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88607Update our jQuery from 1.4.4 to the latest version of 1.5 (1.5.2). See also b...krinkle21:54, 22 May 2011

Status & tagging log