Side navigation
#15160 closed bug (migrated)
Opened June 21, 2014 04:47PM UTC
Closed October 21, 2014 12:40AM UTC
ajaxError and ajaxComplete firing twice upon abort
Reported by: | Dwelle | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | ajax | Version: | 1.11.1 |
Keywords: | ajax, abort, event | Cc: | |
Blocked by: | Blocking: |
Description
Aborting
jqXHRobjects inside
ajaxSendresults in
ajaxErrorand
ajaxCompletecallbacks being called twice. On first execution,
jqXHR's status is
"abort", on second execution, it throws
TypeError: Cannot read property 'send' of undefined.
JSFiddle: http://jsfiddle.net/LK2g3/
tested on Chrome 35, FF 30, jQuery 1.9.1, 1.11.1, 2.1.1
Attachments (0)
Change History (3)
Changed June 22, 2014 11:19PM UTC by comment:1
priority: | undecided → low |
---|---|
status: | new → open |
version: | 1.9.1 → 1.11.1 |
Changed July 14, 2014 08:58AM UTC by comment:2
I've opened a PR with a suggested solution to this here: https://github.com/jquery/jquery/pull/1619
Changed October 21, 2014 12:40AM UTC by comment:3
resolution: | → migrated |
---|---|
status: | open → closed |
Migrated to https://github.com/jquery/jquery/issues/1775
Looks like this has been around for a while. Aborting happens synchronously and cleans up the request to avoid memory bloat. Then when it gets back from the
ajaxSend
it actually tries to send the request and the XHR object was blown out from under it.Aborting the request doesn't make a lot of sense at that point, you can see from the XHR spec that it's pretty much a no-op if called before a
.send()
. So it seems more appropriate to haveajaxSend
indicate that it doesn't want the request to proceed in some other way. The concern I'd have with making a change there would be compat. At least we know aborting doesn't currently work.I'll mark this open for discussion.