Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #10191: ajax.js.diff

File ajax.js.diff, 1.3 kB (added by kendsnyder, 2 years ago)

Patch

  • ajax.js

    old new  
    162162   
    163163  success: function() { 
    164164    var status = this.getStatus(); 
    165     return !status || (status >= 200 && status < 300)
     165    return status >= 200 && status < 300
    166166  }, 
    167167     
    168168  getStatus: function() { 
    169169    try { 
     170                        if (Prototype.Browser.IE && [1223, 12002, 12029, 12030, 12031, 12152] 
     171                                .include(this.transport.status)) return 0; 
    170172      return this.transport.status || 0; 
    171173    } catch (e) { return 0 }  
    172174  }, 
     
    177179    if (state == 'Complete') { 
    178180      try { 
    179181        this._complete = true; 
    180         (this.options['on' + response.status] 
    181          || this.options['on' + (this.success() ? 'Success' : 'Failure')] 
    182          || Prototype.emptyFunction)(response, response.headerJSON); 
     182                                if (window.location.protocol == 'file') 
     183                                        (this.options['onSuccess'] 
     184         || Prototype.emptyFunction)(response, response.headerJSON); 
     185                                else 
     186                                        (this.options['on' + response.status] 
     187                                        || this.options['on' + (this.success() ? 'Success' : 'Failure')] 
     188                                        || Prototype.emptyFunction)(response, response.headerJSON); 
    183189      } catch (e) { 
    184190        this.dispatchException(e); 
    185191      }