r76067 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76066‎ | r76067 | r76068 >
Date:00:20, 5 November 2010
Author:neilk
Status:deferred
Tags:
Comment:
removed erroneous proxy check (we only need that when embedded in iframe, not when calling a different host); more careful checking of API output
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.Api.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.Api.js
@@ -27,14 +27,6 @@
2828
2929 this.url = options.url;
3030
31 - // deal with cases where we need an API proxy
32 - var apiUri = new mw.Uri( this.url );
33 - var scriptUri = new mw.Uri( window.location );
34 - if ( apiUri.host !== scriptUri.host ) {
35 - /* Ask mdale, his proxy was not being developed on wikimedia svn... somewhere on Kaltura servers */
36 - throw new Error( "unimplemented -- API proxy required.");
37 - }
38 -
3931 var _this = this;
4032
4133 /* We allow people to omit these default parameters from API requests */
@@ -137,10 +129,13 @@
138130 ajaxOptions.err( 'http-' + textStatus, { xhr: xhr, exception: exception } );
139131 };
140132
141 - /* success just means 200 OK; also check for API errors */
 133+ /* success just means 200 OK; also check for output and API errors */
142134 ajaxOptions.success = function( result ) {
143 - if ( result.error ) {
144 - ajaxOptions.err( result.error.code, result );
 135+ if ( mw.isEmpty( result ) ) {
 136+ ajaxOptions.err( "empty", "OK response but empty result (check HTTP headers?)" );
 137+ } else if ( result.error ) {
 138+ var code = mw.isDefined( result.error.code ) ? result.error.code : "unknown";
 139+ ajaxOptions.err( code, result );
145140 } else {
146141 ajaxOptions.ok( result );
147142 }

Status & tagging log