Bug Tracker

Ticket #6640 (closed bug: invalid)

Opened 5 years ago

Last modified 4 years ago

complete() called twice in error condition

Reported by: noel_bush Owned by:
Priority: undecided Milestone: 1.4.3
Component: ajax Version: 1.4.2
Keywords: xhr complete Cc:
Blocking: Blocked by:

Description

In $.ajax(), line 5251 starts a try/catch that calls send() on the xhr. As part of the send operation, the onreadystatechange() function is called (line 5163), and in some circumstances, complete() is called (line 5214). One of these circumstances is when the server is not available. An XMLHttpRequestException with code 101 / name NETWORK_ERR is thrown, and caught by the catch clause (line 5253), which then calls complete() again.

The documentation doesn't mention that complete() might be called twice.

(All line numbers are from the (non-compressed) v1.4.2.)

Change History

comment:1 Changed 4 years ago by addyosmani

  • Keywords xhr complete added
  • need changed from Review to Test Case
  • Status changed from new to closed
  • Resolution set to invalid
  • Priority set to undecided

Although I've taken a look into lines 5251, 5214 and 5253, would you be able to supply us with a complete test case showing where complete() is being called twice? That would allow us to investigate further without guessing the change in behaviour that would solve the issue.

Please re-submit your ticket once this is available and we'll look at it again.

Thanks!

Note: See TracTickets for help on using tickets.