/* * Sencha touch for Chrome Extension * Copyright(c) 2010 makoto_kw * @license GNU GPL license v3 */ if (Ext) { Ext.apply(Ext.is, { ChromeExtension: true }); Ext.apply(Ext.Ajax, { onComplete: function(r){ var status = r.xhr.status, options = r.options, success = true, response; if (status == 0 || (status >= 200 && status < 300) || status == 304) { response = this.createResponse(r); this.fireEvent('requestcomplete', this, response, options); if (options.success) { if (!options.scope) { options.success(response, options); } else { options.success.call(options.scope, response, options); } } } else { success = false; switch (status) { case 12002: case 12029: case 12030: case 12031: case 12152: case 13030: response = this.createException(r); break; default: response = this.createResponse(r); } this.fireEvent('requestexception', this, response, options); if (options.failure) { if (!options.scope) { options.failure(response, options); } else { options.failure.call(options.scope, response, options); } } } if (options.callback) { if (!options.scope) { options.callback(options, success, response); } else { options.callback.call(options.scope, options, success, response); } } delete this.requests[r.id]; } }) }