helpers/io-base.js
function(xhr, promise) {
            // for XDomainRequest, we need "onload" instead of "onreadystatechange"
            xhr.onreadystatechange = function() {
                // CANNOT console xhr.responseText here! IE9 will throw an error:
                // you can only acces it after (xhr.readyState===4)
                // also check xhr._aborted --> IE9 comes here after aborted and will throw an error when reading xhr"s native properties
                if (!xhr._aborted && (xhr.readyState===4)) {
                    clearTimeout(xhr._timer);
                    if ((xhr.status>=200) && (xhr.status<300)) {
                        // In case streamback function is set, but when no intermediate stream-data was send
                        // (or in case of XDR: below 2kb it doesn"t call onprogress)
                        // --> we might need to call onprogress ourselve.
                        if (xhr._isStream && !xhr._gotstreamed) {
                            xhr.onprogress(xhr.responseText);
                        }
                        if (xhr._fileProgress && !xhr._gotstreamed) {
                            xhr.onprogress({
                                lengthComputable: true,
                                loaded: 1,
                                total: 1
                            });
                        }
                        promise.fulfill(xhr);
                    }
                    else {
                        promise.reject(xhr.statusText || (UNKNOW_ERROR));
                    }
                }
            };
            xhr.onerror = function() {
                clearTimeout(xhr._timer);
                promise.reject(XHR_ERROR);
            };
        }
function(xhr, promise) {
            // for XDomainRequest, we need "onload" instead of "onreadystatechange"
            xhr.onreadystatechange = function() {
                // CANNOT console xhr.responseText here! IE9 will throw an error:
                // you can only acces it after (xhr.readyState===4)
                // also check xhr._aborted --> IE9 comes here after aborted and will throw an error when reading xhr"s native properties
                if (!xhr._aborted && (xhr.readyState===4)) {
                    clearTimeout(xhr._timer);
                    if ((xhr.status>=200) && (xhr.status<300)) {
                        // In case streamback function is set, but when no intermediate stream-data was send
                        // (or in case of XDR: below 2kb it doesn"t call onprogress)
                        // --> we might need to call onprogress ourselve.
                        if (xhr._isStream && !xhr._gotstreamed) {
                            xhr.onprogress(xhr.responseText);
                        }
                        if (xhr._fileProgress && !xhr._gotstreamed) {
                            xhr.onprogress({
                                lengthComputable: true,
                                loaded: 1,
                                total: 1
                            });
                        }
                        promise.fulfill(xhr);
                    }
                    else {
                        promise.reject(xhr.statusText || (UNKNOW_ERROR));
                    }
                }
            };
            xhr.onerror = function() {
                clearTimeout(xhr._timer);
                promise.reject(XHR_ERROR);
            };
        }
Adds 2 methods on the xhr-instance which are used by xhr when events occur:

xhr.onreadystatechange()
xhr.ontimeout()  // only XMLHttpRequest2

These events are responsible for making the Promise resolve.
@method _setReadyHandle
@param xhr {Object} containing the xhr-instance
@param fulfill {Function} reference to the Promise fulfill-function
@param reject {Function} reference to the Promise reject-function
@private