You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RockJs is a great framework, we use it in our projects.
However, we encountered an issue when tried to send synchronous xhr request.
I know sync xhr requests are deprecated, but we need it in one tricky point of internal project as temporary fix. It fails with exception "Timeouts cannot be set for synchronous requests made from a document.". The reason is simple: timeout is not allowed in sync requests.
So we fixed it in core/js/generic/includers.js by changing: xhr.timeout = q.timeout;
to: if (q.async) { xhr.timeout = q.timeout; }
Patch:
core/js/generic/includers.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/core/js/generic/includers.js b/core/js/generic/includers.js
index 292afd7..c5c4951 100644
--- a/core/js/generic/includers.js
+++ b/core/js/generic/includers.js
@@ -220,7 +220,7 @@
}
try{xhr.open(q.type, url, q.async);}
catch(e){onError(e, execCallbacks);};
- xhr.timeout = q.timeout;
+ if (q.async) { xhr.timeout = q.timeout; }
if (q.contentType != null) xhr.setRequestHeader('Content-type', q.contentType);
if (q.xRequestedWith != null) xhr.setRequestHeader('X-Requested-With', q.xRequestedWith);
for (var i in q.headers) xhr.setRequestHeader(String(i), String(q.headers[i]));
The text was updated successfully, but these errors were encountered:
Hi here,
RockJs is a great framework, we use it in our projects.
However, we encountered an issue when tried to send synchronous xhr request.
I know sync xhr requests are deprecated, but we need it in one tricky point of internal project as temporary fix. It fails with exception "Timeouts cannot be set for synchronous requests made from a document.". The reason is simple: timeout is not allowed in sync requests.
So we fixed it in core/js/generic/includers.js by changing:
xhr.timeout = q.timeout;
to:
if (q.async) { xhr.timeout = q.timeout; }
Patch:
The text was updated successfully, but these errors were encountered: