You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by jo...@apache.org on 2025/03/24 22:02:56 UTC
(royale-asjs) 01/02: Network: fix missing IO_ERROR on JS target when HTTPService loading fails, to match the behavior of the SWF target
This is an automated email from the ASF dual-hosted git repository.
joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 02eb283196cc952b7909d068c31e12cd061ac561
Author: Josh Tynjala <jo...@apache.org>
AuthorDate: Fri Mar 21 13:04:00 2025 -0700
Network: fix missing IO_ERROR on JS target when HTTPService loading fails, to match the behavior of the SWF target
SWF target bases it on IOErrorEvent.IO_ERROR, but with the JS target, XMLHttpRequest uses readyState == 4 to determine both successful completion and loading errors. So to determine if we should dispatch COMPLETE or IO_ERROR, we check the value of the HTTP status code when readyState == 4.
---
.../Network/src/main/royale/org/apache/royale/net/HTTPService.as | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as
index 9b63f35562..346b858d45 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/HTTPService.as
@@ -725,7 +725,14 @@ COMPILE::SWF
} else if (element.readyState == 4) {
//unset any json Object decoded (and cached) from previous response first:
_json = null;
- dispatchEvent(HTTPConstants.COMPLETE);
+ if (status >= 200 && status < 400)
+ {
+ dispatchEvent(HTTPConstants.COMPLETE);
+ }
+ else
+ {
+ dispatchEvent(HTTPConstants.IO_ERROR);
+ }
}
}