#5688 closed bug (fixed)
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)
Change History (10)
Changed 13 years ago by
Attachment: | too_much_recursion.patch added |
---|
comment:1 Changed 13 years ago by
Can you provide a test case? We need to know the cause of the problem, as well as a solution.
comment:2 Changed 13 years ago by
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.
comment:3 Changed 13 years ago by
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?
comment:4 Changed 13 years ago by
I see the same problem when testing the form plugin: http://jquery.malsup.com/test/1.4a2.png
comment:6 Changed 13 years ago by
It appears that this is the commit in question:
http://github.com/jquery/jquery/commit/1bac61655b6c323ab4bcfc65b0d95c1587dd8503
comment:7 Changed 13 years ago by
Component: | core → event |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Version: | 1.4a1 → 1.4a2 |
comment:8 Changed 13 years ago by
Version: | 1.4a2 → 1.4a3 |
---|
comment:9 Changed 13 years ago by
Version: | 1.4a3 → 1.4a2 |
---|
Patch for "too much recursion" error.