File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2308,9 +2308,12 @@ Phaser.Loader.prototype = {
23082308 xhr . onload = function ( ) {
23092309
23102310 try {
2311-
2312- return onload . call ( _this , file , xhr ) ;
2313-
2311+ if ( xhr . readyState == 4 && xhr . status >= 400 && xhr . status <= 599 ) { // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
2312+ return onerror . call ( _this , file , xhr ) ;
2313+ }
2314+ else {
2315+ return onload . call ( _this , file , xhr ) ;
2316+ }
23142317 } catch ( e ) {
23152318
23162319 // If this was the last file in the queue and an error is thrown in the create method
@@ -2419,6 +2422,12 @@ Phaser.Loader.prototype = {
24192422
24202423 xhr . onload = function ( ) {
24212424 try {
2425+ if ( xhr . readyState == 4 && xhr . status >= 400 && xhr . status <= 599 ) { // Handle HTTP status codes of 4xx and 5xx as errors, even if xhr.onerror was not called.
2426+ return onerror . call ( _this , file , xhr ) ;
2427+ }
2428+ else {
2429+ return onload . call ( _this , file , xhr ) ;
2430+ }
24222431 return onload . call ( _this , file , xhr ) ;
24232432 } catch ( e ) {
24242433 _this . asyncComplete ( file , e . message || 'Exception' ) ;
You can’t perform that action at this time.
0 commit comments