build: Replace jscs+jshint with eslint
[lhc/web/wiklou.git] / resources / src / mediawiki / api / upload.js
index 3c8b3f6..bf839ad 100644 (file)
@@ -34,7 +34,8 @@
         * @return {string}
         */
        function getFirstKey( obj ) {
-               for ( var key in obj ) {
+               var key;
+               for ( key in obj ) {
                        if ( obj.hasOwnProperty( key ) ) {
                                return key;
                        }
                        this[ this.needToken() ? 'postWithEditToken' : 'post' ]( data, {
                                // Use FormData (if we got here, we know that it's available)
                                contentType: 'multipart/form-data',
+                               // No timeout (default from mw.Api is 30 seconds)
+                               timeout: 0,
                                // Provide upload progress notifications
                                xhr: function () {
                                        var xhr = $.ajaxSettings.xhr();
                        }
 
                        function finishUpload( moreData ) {
-                               api.uploadFromStash( filekey, $.extend( data, moreData ) );
+                               return api.uploadFromStash( filekey, $.extend( data, moreData ) );
                        }
 
                        return this.upload( file, { stash: true, filename: data.filename } ).then(