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

Ticket #9226 (new defect)

Opened 3 years ago

Last modified 2 years ago

[PATCH] Ajax.Request _complete flag not being reset

Reported by: bgreenlee Assigned to: sam
Priority: normal Milestone: 2.x
Component: Prototype Version: edge
Severity: major Keywords:
Cc:

Description

I noticed when upgrading our app from Prototype 1.5.0_rc0 to 1.5.1.1 that our RJS broke--JS returned by Ajax.Requests was not getting evaled. It turned out to be because the _complete flag was not getting reset to false. I can't seem to reproduce this issue in the tests, but it happens if you have more than one Ajax.Request on a page. Moving the initialization of _complete into initialize solves this problem.

Attachments

fix_ajax_request_complete.diff (491 bytes) - added by bgreenlee on 08/09/07 13:32:13.
patch to move initialization of _complete in Ajax.Request to initialize

Change History

08/09/07 13:32:13 changed by bgreenlee

  • attachment fix_ajax_request_complete.diff added.

patch to move initialization of _complete in Ajax.Request to initialize

04/17/08 05:25:45 changed by jdalton

Can you retest with Prototype 1.6.0.2?

06/07/08 00:54:52 changed by bgreenlee

The problem still exists in 1.6.0.2. The fix is the same. Should I submit another patch over on GitHub?

06/07/08 01:22:07 changed by jdalton

Yes and please supply a failing test, because our unit tests are not picking up any errors.

06/07/08 01:24:10 changed by jdalton

Please submit a ticket in Lighthouse: http://www.prototypejs.org/contribute

06/27/08 14:21:24 changed by jdalton

I think it might be something else because this simple example shows:

var Base = Class.create({
  initialize: function(options) {
    this.options = options || {};
  }
});

var Something = Class.create(Base, {
  _complete: false,
  
  initialize: function($super, options){
    $super(options);
  },

  markComplete: function() {
    this._complete = true;
  }
});

var smth = new Something();
console.log(smth._complete); // false

smth.markComplete();
console.log(smth._complete); // true

var smth2 = new Something();
console.log(smth2._complete); // false

That _complete is false for every new instance.

Or even:

var a = new Ajax.Request();
a._complete = true;
var b = new Ajax.Request();
console.log(b._complete) //false

06/27/08 14:34:55 changed by bgreenlee

I'm not exactly sure how it is happening; like I said, I haven't been able to come up w/ a failing test case. I do know, though, that on our site, without my patch, JS code returned by Ajax.Request calls was not getting evaled after the first call--e.g. we have a session timeout pinger that makes a request every minute while a page is open, and only the first ping response will be evaled.