Skip to content

Commit

Permalink
XHR, HTML5: clarify onload logic for envs with no support for XHR2
Browse files Browse the repository at this point in the history
  • Loading branch information
Davit Barbakadze committed Aug 9, 2017
1 parent daed75c commit 9cd5c00
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/javascript/runtime/html5/xhr/XMLHttpRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,14 @@ define("moxie/runtime/html5/xhr/XMLHttpRequest", [
_xhr.onreadystatechange = function() {};

// usually status 0 is returned when server is unreachable, but FF also fails to status 0 for 408 timeout
if (_xhr.status === 0) {
target.trigger('error');
} else {
target.trigger('load');
}
try {
if (_xhr.status >= 200 && _xhr.status < 400) {
target.trigger('load');
break;
}
} catch(ex) {}

target.trigger('error');
break;
}
};
Expand Down

0 comments on commit 9cd5c00

Please sign in to comment.