From 55181cec8ce36201bd7373bdb6e80b5007701cdc Mon Sep 17 00:00:00 2001 From: Roland Schwingel Date: Thu, 17 Sep 2015 14:45:35 +0200 Subject: [PATCH] Set timeout in XHR requests AFTER they are opened to get them to work with IE --- Objective-J/CFHTTPRequest.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Objective-J/CFHTTPRequest.js b/Objective-J/CFHTTPRequest.js index 4a77cc796..dbf3ac704 100755 --- a/Objective-J/CFHTTPRequest.js +++ b/Objective-J/CFHTTPRequest.js @@ -105,6 +105,7 @@ GLOBAL(CFHTTPRequest) = function() // by default, all requests will assume that credentials should not be sent. this._withCredentials = false; + this._timeout = 60000; var self = this; this._stateChangeHandler = function() @@ -217,12 +218,14 @@ CFHTTPRequest.prototype.getResponseHeader = function(/*String*/ aHeader) CFHTTPRequest.prototype.setTimeout = function(/*int*/ aTimeout) { - this._nativeRequest.timeout = aTimeout; + this._timeout = aTimeout; + if (this._isOpen) + this._nativeRequest.timeout = aTimeout; }; CFHTTPRequest.prototype.getTimeout = function(/*int*/ aTimeout) { - return this._nativeRequest.timeout; + return this._timeout; }; CFHTTPRequest.prototype.getAllResponseHeaders = function() @@ -248,6 +251,7 @@ CFHTTPRequest.prototype.open = function(/*String*/ aMethod, /*String*/ aURL, /*B retval = this._nativeRequest.open(aMethod, aURL, isAsynchronous, aUser, aPassword); if (this._async) this._nativeRequest.withCredentials = this._withCredentials; + this._nativeRequest.timeout = this._timeout; return retval; };