firebase/firebase-simple-login — pull request #53 by theSmaw (2014-08-12 12:28:05+00:00)
Title: handle drop in network connectivity

A drop in network connection during the create user or login process leads to the following crash (Chrome 36.0.1985.125):

![](http://d.pr/i/AvLE)

This occurs when an error is thrown and not caught when we try to parse the empty response text that is returned by XMLHttpRequest when the status is not 200 (0 in the case where network connection is removed).

To replicate, break at 1756 of firebase-simple-login-debug.js, and remove the network cable before resuming beyond the break point. xhr.readyState becomes 4 but xhr.responseText = "", causing the JSON parser to throw an error and undefined error and data to be passed to the onCompleteHandler.

![](http://d.pr/i/lC82)

The PR hopes to resolve this by setting an error value if the xhr.status != 200 or if a general JSON parse error occurs.