vitebonus / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

XhrManager doesn't fire COMPLETE event after exhausting retries #545

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
In goog.net.XhrManager.prototype.handleComplete_:

var request can be undefined if the request has been retried too many times.   
The request is removed from this.requests_ in the retry_ method when the retry 
limit is reached; a subsequent completion state change will land in 
handleComplete_ with the request having already been disposed.  This can occur, 
for example, when network connectivity is lost or a remote server goes down.

If the request variable is undefined, then the handleComplete_ method will 
throw an exception when it tries to check request.hasReachedMaxRetries().

The fix is trivial:  Just check that request is defined before asking for 
request.hasReachedMaxRetries().  I believe you still want to send the COMPLETE 
event in this case; the rest of this method is already proof against request 
being undefined.

Original issue reported on code.google.com by kient...@catch.com on 12 Mar 2013 at 1:29

GoogleCodeExporter commented 8 years ago
For what it's worth:  handleError_ has exactly the same problem.

Original comment by kient...@catch.com on 12 Mar 2013 at 1:46