XHR: Set readyState to DONE in case of error, when upload is handled by a runtime.
XHR: Unify event triggering.