assaf/zombie — pull request #811 by mdlavin (2014-11-26 19:51:02+00:00)
Title: Make failed XHR requests trigger the onreadystatechange callback

According to http://www.w3.org/TR/XMLHttpRequest/#dom-xmlhttprequest-readystate the readyState of an XHR object should be set to DONE when "The data transfer has been completed or *something went wrong during the transfer*". Currently, zombie only sets the DONE state when the request is completed successfully (from a network perspective).

This change makes onreadystatechange be called with DONE when an error occurs. If an error occurs, the HEADERS_RECEIVED state is skipped. Additionally, the status attribute is set to 0 on error, which makes the specification here: http://www.w3.org/TR/XMLHttpRequest/#the-status-attribute