#12 ✓ resolved
Comron Sattari

Function#defer leaks memory in FF

Reported by Comron Sattari | April 15th, 2008 @ 01:12 AM | in 1.6.0.3

After recently upgrading to 1.6 from 1.5, I noticed that while testing my rails app with selenium in FF 2.0.0.13, many of our tests that depended on Ajax requests were failing intermittently. After a lot of digging around I found that the cause of the failures was the NS_ERROR_NOT_AVAILABLE error in Firefox.

The request does not violate SOP, and it was validated that Prototype 1.5.1.2 does not cause the error. Also, the rails app is responding 200, not 404. After diffing 1.5.1.2 source with 1.6.0.2 I noticed one difference that looked interesting to me.

     if (this.options.asynchronous)
             setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10);

became

      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);

I changed this line to

      if (this.options.asynchronous) this.respondToReadyState.bind(this).delay(0.01, 1);

and my problem went away. Is there any reason why the timeout was removed in favor of running the function immediately?

I've attached a diff that passes all the tests, not sure how to write a test for this specific problem.

Regards,

Comron

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

The Prototype JavaScript library.

Shared Ticket Bins

Attachments

Referenced by

Pages