aboutsummaryrefslogtreecommitdiff
path: root/platform/javascript/http_client_javascript.cpp
diff options
context:
space:
mode:
authorLeon Krause2018-02-17 17:42:58 +0100
committerHein-Pieter van Braam2018-02-19 22:42:31 +0100
commitc5b5fd61d4594561d18e74993bb015a17925a83d (patch)
tree62dc3f34c8ac805cd0f6eb9a584e2578f173c79e /platform/javascript/http_client_javascript.cpp
parent5bb269d01dd11c9336ece79d6177249b5bedadf0 (diff)
downloadgodot-c5b5fd61d4594561d18e74993bb015a17925a83d.tar.gz
godot-c5b5fd61d4594561d18e74993bb015a17925a83d.tar.zst
godot-c5b5fd61d4594561d18e74993bb015a17925a83d.zip
Diffstat (limited to 'platform/javascript/http_client_javascript.cpp')
-rw-r--r--platform/javascript/http_client_javascript.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index 5ab3d1b77..939a8d11f 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -240,6 +240,21 @@ Error HTTPClient::poll() {
return ERR_CONNECTION_ERROR;
case STATUS_REQUESTING:
+
+#ifdef DEBUG_ENABLED
+ if (!has_polled) {
+ has_polled = true;
+ } else {
+ // forcing synchronous requests is not possible on the web
+ if (last_polling_frame == Engine::get_singleton()->get_idle_frames()) {
+ WARN_PRINT("HTTPClient polled multiple times in one frame, "
+ "but request cannot progress more than once per "
+ "frame on the HTML5 platform.");
+ }
+ }
+ last_polling_frame = Engine::get_singleton()->get_idle_frames();
+#endif
+
polled_response_code = godot_xhr_get_status(xhr_id);
if (godot_xhr_get_ready_state(xhr_id) != XHR_READY_STATE_DONE) {
return OK;
@@ -280,6 +295,10 @@ HTTPClient::HTTPClient() {
port = -1;
use_tls = false;
polled_response_code = 0;
+#ifdef DEBUG_ENABLED
+ has_polled = false;
+ last_polling_frame = 0;
+#endif
}
HTTPClient::~HTTPClient() {