You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2012/05/07 13:50:19 UTC
svn commit: r1334966 - in
/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore:
_AjaxRequest.js engine/Xhr1.js
Author: werpu
Date: Mon May 7 11:50:18 2012
New Revision: 1334966
URL: http://svn.apache.org/viewvc?rev=1334966&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-3539
Modified:
myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js
Modified: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js?rev=1334966&r1=1334965&r2=1334966&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js (original)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxRequest.js Mon May 7 11:50:18 2012
@@ -123,6 +123,7 @@ _MF_CLS(_PFX_XHR + "_AjaxRequest", _MF_O
this._xhr = _Lang.mixMaps(this._getTransport(), {
onprogress: scopeThis("onprogress"),
ontimeout: scopeThis("ontimeout"),
+ //remove for xhr level2 support (chrome has problems with it)
onloadend: scopeThis("ondone"),
onload: scopeThis("onsuccess"),
onerror: scopeThis("onerror")
@@ -189,6 +190,11 @@ _MF_CLS(_PFX_XHR + "_AjaxRequest", _MF_O
} catch (e) {
this._stdErrorHandler(this._xhr, this._context, e);
}
+ //add for xhr level2 support
+ //} finally {
+ //W3C spec onloadend must be called no matter if success or not
+ // this.ondone();
+ //}
},
onerror: function(/*evt*/) {
@@ -213,6 +219,11 @@ _MF_CLS(_PFX_XHR + "_AjaxRequest", _MF_O
var _Impl = this.attr("impl");
_Impl.sendError(xhr, context, _Impl.HTTPERROR,
_Impl.HTTPERROR, errorText,"","myfaces._impl.xhrCore._AjaxRequest","onerror");
+ //add for xhr level2 support
+ //since chrome does not call properly the onloadend we have to do it manually
+ //to eliminate xhr level1 for the compile profile modern
+ //W3C spec onloadend must be called no matter if success or not
+ //this.ondone();
}
//_onError
},
@@ -244,9 +255,10 @@ _MF_CLS(_PFX_XHR + "_AjaxRequest", _MF_O
//the current xhr level2 timeout w3c spec is not implemented by the browsers yet
//we have to do a fallback to our custom routines
- //Chrome fails in the current builds, on our loadend, we disable the xhr
+ //add for xhr level2 support
+ //Chrome fails in the current builds, on our loadend, we disable the xhr
//level2 optimisations for now
- //if (('undefined' == typeof this._timeout || null == this._timeout) && _Rt.getXHRLvl() >= 2) {
+ //if (/*('undefined' == typeof this._timeout || null == this._timeout) &&*/ this._RT.getXHRLvl() >= 2) {
//no timeout we can skip the emulation layer
// return xhr;
//}
Modified: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js?rev=1334966&r1=1334965&r2=1334966&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js (original)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/engine/Xhr1.js Mon May 7 11:50:18 2012
@@ -135,6 +135,7 @@ _MF_CLS(_PFX_XHR + "engine.Xhr1", myface
this.onerror(myevt);
}
} finally {
+ //remove for xhr level2 support
this.onloadend(myevt);
}
}
@@ -154,17 +155,22 @@ _MF_CLS(_PFX_XHR + "engine.Xhr1", myface
},
_startTimeout: function() {
+ if (this.timeout == 0) return;
var xhr = this._xhrObject;
//some browsers have timeouts in their xhr level 1.x objects implemented
//we leverage them whenever they exist
- if ('undefined' != typeof xhr.timeout) {
- xhr.timeout = this.timeout;
- xhr.ontimeout = this.ontimeout;
- return;
+ try {
+ if ('undefined' != typeof xhr.timeout) {
+ xhr.timeout = this.timeout;
+ xhr.ontimeout = this.ontimeout;
+ return;
+ }
+ } catch (e) {
+ //firefox 12 has a bug here
}
- if (this.timeout == 0) return;
+
this._timeoutTimer = setTimeout(this._Lang.hitch(this, function() {
if (xhr.readyState != this._XHRConst.READY_STATE_DONE) {