Skip to main content

Bug Tracker

Side navigation

#5688 closed bug (fixed)

Opened December 20, 2009 01:28AM UTC

Closed December 31, 2009 05:50AM UTC

Last modified December 31, 2009 05:57AM UTC

Too much recursion errors

Reported by: ixpleo Owned by:
Priority: major Milestone: 1.4
Component: event Version: 1.4a2
Keywords: Cc:
Blocked by: Blocking:
Description

When dropping 1.4a2 into a live application, I get "too much recursion" errors showing up in the Firefox console. This also occured with 1.4a1. I've attached a patch the needs review. Details below.

The original error is reported on Line 1486, but replacing the isFunction() call with !toString.call(proxy) === "[object Function]" fixes this.

The error then moves to Line 1801 - another isFunction() call fixed the same way as above.

The error finally moves to Line 1807:

var handler = name == "one" ? jQuery.event.proxy( fn, function( event ) {

The isFunction() function doesn't seem to be the original problem, but rather the call to this.one(). I'm not familiar enough with jQuery core to say for sure, but it looks like this is leading to jQuery.each("one"...) recursion. Remove the call to this.one() fixed the issue for em.

I have attached a patch that fixes the "too much recursion" bug for me - but I am not sure what the implications are of this fix. It definitely needs review by someone who is more familiar with jQuery core than I am.

Attachments (1)
  • too_much_recursion.patch (0.5 KB) - added by ixpleo December 20, 2009 01:29AM UTC.

    Patch for "too much recursion" error.

Change History (9)

Changed December 20, 2009 02:27AM UTC by dmethvin comment:1

Can you provide a test case? We need to know the cause of the problem, as well as a solution.

Changed December 20, 2009 02:54AM UTC by MelTraX comment:2

I have the same problem. The error occurs in line 1486 but that doesn't seem to be the problem. The recursion is somewhere else.

It can easily be triggered with "$(window).bind('unload', function() {});". I can't suggest a solution though.

Changed December 20, 2009 03:56AM UTC by ixpleo comment:3

After looking at MelTraX's post and looking at the testing I did to come up with the patch, it seems that it is a call to unload() that creates the recursive loop (either directly to unload() or calling unload via bind() as in MelTraX's example). Here's why:

Line 1811 in 1.4a2:

return type === "unload" ? this.one(type, data, handler, thisObject) : this.each(function() {

jQuery.event.add( this, type, handler, data );

});

My fix was to replace this entire statement with just returning the this.each call. When you call unload, it triggers a call to this.one() on line 1811 which is where the recursion is occurring. Even though my patch removes the portion about "unload", unload() events still work.

Do you need me to upload a test case with a call to unload - or this is description enough?

Changed December 20, 2009 11:51PM UTC by malsup comment:4

I see the same problem when testing the form plugin: http://jquery.malsup.com/test/1.4a2.png

Changed December 21, 2009 12:14AM UTC by malsup comment:5

Changed December 23, 2009 09:36PM UTC by Guiswa comment:6

Changed December 31, 2009 05:50AM UTC by john comment:7

component: coreevent
resolution: → fixed
status: newclosed
version: 1.4a11.4a2

Changed December 31, 2009 05:55AM UTC by john comment:8

version: 1.4a21.4a3

Changed December 31, 2009 05:57AM UTC by john comment:9

version: 1.4a31.4a2