Side navigation
#7461 closed bug (fixed)
Opened November 10, 2010 06:34PM UTC
Closed January 09, 2011 05:24AM UTC
Last modified January 30, 2011 01:01AM UTC
$.ajax(this) no longer allows "retries".
Reported by: | mark@foxbomb.com | Owned by: | jaubourg |
---|---|---|---|
Priority: | high | Milestone: | 1.5 |
Component: | ajax | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In JQ 1.4.2, you can send an ajax request, and on error, resend it using $.ajax(this) as per "Defensive Ajax" article: http://zeroedandnoughted.com/defensive-ajax-and-ajax-retries-in-jquery
In 1.4.3, I get recursion errors.
Attachments (0)
Change History (10)
Changed November 10, 2010 07:00PM UTC by comment:1
component: | unfiled → ajax |
---|---|
milestone: | 1.5 |
owner: | → mark@foxbomb.com |
status: | new → pending |
Changed November 11, 2010 03:50AM UTC by comment:2
test case with workaround. Including this.context = undefined;
in the error handler before reissuing the ajax request works around the problem. Take it out and after the first ajax request it fails with max recursion exception.
This happens when jQuery on this line tries to merge ajaxSettings
with the ones passed in from the retry in the error handler. But as origSettings === origSettings.context === origSettings.context.context === ....
the deep copy won't stop.
This recursive dependency is caused on this line when in the original ajax request no context
was provided it becomes s.context = s
. Seems to have been introduced with the rewrites in #dcf0fa
Changed November 19, 2010 03:05AM UTC by comment:3
I like the elegance of retrying with $.ajax(this); if we're supporting it the unit tests should definitely have an explicit case for it.
Relatedly, some people have asked for the ability to specify the .context in $.ajaxSettings, which currently can't be done.
Changed November 19, 2010 11:53PM UTC by comment:4
keywords: | → needstest |
---|---|
milestone: | → 1.5 |
priority: | undecided → high |
status: | pending → open |
version: | 1.4.3 → 1.4.4 |
Changed December 27, 2010 10:37PM UTC by comment:5
keywords: | needstest → needstest,ajaxrewrite |
---|
Changed January 09, 2011 05:17AM UTC by comment:6
owner: | mark@foxbomb.com → jaubourg |
---|---|
status: | open → assigned |
dmethvin: could be a good idea to open a feature request for setting context in ajaxSettings so that we can discuss this specific issue separately (unless the request already exists in the system, of course).
Changed January 09, 2011 05:24AM UTC by comment:7
resolution: | → fixed |
---|---|
status: | assigned → closed |
Added a test for retrying a request on error using jQuery.ajax(this). Works as intended. Fixes #7461.
Changeset: 63487505c678152e59847e3ab7878ea5f2514dfa
Changed January 18, 2011 10:20PM UTC by comment:8
Please pardon me for my ignorance, but does that mean the bug will be fixed in the next version (the unit test having been written for developing 1.5), or are you saying it works as intended now? Because I am still getting errors.
Changed January 18, 2011 10:22PM UTC by comment:9
Replying to [comment:8 aleonard1@…]:
Please pardon me for my ignorance, but does that mean the bug will be fixed in the next version (the unit test having been written for developing 1.5), or are you saying it works as intended now? Because I am still getting errors.
Never mind, I see it's mentioned as fixed in the 1.5 beta 1 patch notes. :)
Changed January 30, 2011 01:01AM UTC by comment:10
keywords: | needstest,ajaxrewrite |
---|
Thanks for taking the time to contribute to the jQuery project! Please provide a reduced jsFiddle test case to help us assess your ticket!
Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!