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 2011/03/11 23:09:10 UTC

svn commit: r1080782 - in /myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl: core/_Runtime.js core/jsf-uncompressed.js xhrCore/_BaseRequest.js xhrCore/_Transports.js

Author: werpu
Date: Fri Mar 11 22:09:10 2011
New Revision: 1080782

URL: http://svn.apache.org/viewvc?rev=1080782&view=rev
Log:
cummulative commit for following issues:

https://issues.apache.org/jira/browse/MYFACES-3069
https://issues.apache.org/jira/browse/MYFACES-3073




Modified:
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js
    myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js?rev=1080782&r1=1080781&r2=1080782&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/_Runtime.js Fri Mar 11 22:09:10 2011
@@ -447,40 +447,37 @@ if (!myfaces._impl.core._Runtime) {
          */
         _T.loadScriptEval = function(src, type, defer, charSet, async) {
             var xhr = _T.getXHRObject();
-            xhr.open("GET", src, async);
+            xhr.open("GET", src, false);
 
             if (charSet) {
                 xhr.setRequestHeader("Content-Type", "application/x-javascript; charset:" + charSet);
             }
 
+            xhr.send(null);
 
-            xhr.onreadystatechange = function() {
-                //since we are synchronous we do it after not with onReadyStateChange
+            //since we are synchronous we do it after not with onReadyStateChange
 
-                if (xhr.readyState == 4) {
-                    if (xhr.status == 200) {
-                        //defer also means we have to process after the ajax response
-                        //has been processed
-                        //we can achieve that with a small timeout, the timeout
-                        //triggers after the processing is done!
-                        if (!defer) {
-                            _T.globalEval(xhr.responseText.replace("\n", "\r\n") + "\r\n//@ sourceURL=" + src);
-                        } else {
-                            //TODO not ideal we maybe ought to move to something else here
-                            //but since it is not in use yet, it is ok
-                            setTimeout(function() {
-                                _T.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
-                            }, 1);
-                        }
+            if (xhr.readyState == 4) {
+                if (xhr.status == 200) {
+                    //defer also means we have to process after the ajax response
+                    //has been processed
+                    //we can achieve that with a small timeout, the timeout
+                    //triggers after the processing is done!
+                    if (!defer) {
+                        _T.globalEval(xhr.responseText.replace("\n", "\r\n") + "\r\n//@ sourceURL=" + src);
                     } else {
-                        throw Error(xhr.responseText);
+                        //TODO not ideal we maybe ought to move to something else here
+                        //but since it is not in use yet, it is ok
+                        setTimeout(function() {
+                            _T.globalEval(xhr.responseText + "\r\n//@ sourceURL=" + src);
+                        }, 1);
                     }
+                } else {
+                    throw Error(xhr.responseText);
                 }
-                /* else {
-                 throw Error("Loading of script " + src + " failed ");
-                 }*/
+            } else {
+                throw Error("Loading of script " + src + " failed ");
             }
-            xhr.send(null);
 
         };
 

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js?rev=1080782&r1=1080781&r2=1080782&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/jsf-uncompressed.js Fri Mar 11 22:09:10 2011
@@ -17,18 +17,18 @@ if (!window.jsf) {
     var _ls = myfaces._impl.core._Runtime.loadScript;
 
     _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages.js']}", null, null, "UTF-8", false);
-    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_de.js']}", null, null, "UTF-8", true);
-    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_nl.js']}", null, null, "UTF-8", true);
-    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_es.js']}", null, null, "UTF-8", true);
-    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_it.js']}", null, null, "UTF-8", true);
-    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_fr.js']}", null, null, "UTF-8", true);
-    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_ru.js']}", null, null, "UTF-8", true);
+    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_de.js']}", null, null, "UTF-8", false);
+    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_nl.js']}", null, null, "UTF-8", false);
+    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_es.js']}", null, null, "UTF-8", false);
+    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_it.js']}", null, null, "UTF-8", false);
+    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_fr.js']}", null, null, "UTF-8", false);
+    _ls("#{resource['org.apache.myfaces.core.impl.i18n:Messages_ru.js']}", null, null, "UTF-8", false);
 
 
     _ls("#{resource['org.apache.myfaces.core.impl.util:_Lang.js']}", null, null, "UTF-8", false);
 
-    _ls("#{resource['org.apache.myfaces.core.impl.util:_ExtLang.js']}", null, null, "UTF-8", true);
-    _ls("#{resource['org.apache.myfaces.core.impl.util:_UnitTest.js']}", null, null, "UTF-8", true);
+    _ls("#{resource['org.apache.myfaces.core.impl.util:_ExtLang.js']}", null, null, "UTF-8", false);
+    _ls("#{resource['org.apache.myfaces.core.impl.util:_UnitTest.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.util:_Queue.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.util:_ListenerQueue.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.util:_Dom.js']}", null, null, "UTF-8", false);
@@ -40,7 +40,7 @@ if (!window.jsf) {
     _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequestQueue.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_BaseRequest.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxRequest.js']}", null, null, "UTF-8", false);
-    _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_IFrameRequest.js']}", null, null, "UTF-8", true);
+    _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_IFrameRequest.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_AjaxResponse.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.xhrCore:_Transports.js']}", null, null, "UTF-8", false);
     _ls("#{resource['org.apache.myfaces.core.impl.core:Impl.js']}", null, null, "UTF-8", false);

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js?rev=1080782&r1=1080781&r2=1080782&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_BaseRequest.js Fri Mar 11 22:09:10 2011
@@ -170,7 +170,12 @@ myfaces._impl.core._Runtime.extendClass(
         var _Impl = this._getImpl();
 
         try {
-            this._response.processResponse(this._xhr, this._context);
+            //now we have to reroute into our official api
+            //because users might want to decorate it, we will split it apart afterwards
+            this._context._mfInternal = this._context._mfInternal || {};
+            this._context._mfInternal._mfRequest = this;
+
+            jsf.ajax.response(this._xhr, this._context);
 
             _Impl.sendEvent(this._xhr, this._context, _Impl.SUCCESS);
         } finally {

Modified: myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js?rev=1080782&r1=1080781&r2=1080782&view=diff
==============================================================================
--- myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js (original)
+++ myfaces/core/trunk/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js Fri Mar 11 22:09:10 2011
@@ -225,7 +225,11 @@ myfaces._impl.core._Runtime.extendClass(
      * @param {XmlHttpRequest} context - the ajax context
      */
     response : function(request, context) {
-        var ajaxObj =  new (this._getAjaxReqClass(context))({xhr: request, context: context});
+        var ajaxObj = (context._mfInternal && context._mfInternal._mfRequest) ||  new (this._getAjaxReqClass(context))({xhr: request, context: context});
+        if(context._mfInternal._mfRequest){
+            context._mfInternal._mfRequest = null;
+            delete context._mfInternal._mfRequest;
+        }
 
         ajaxObj._response.processResponse(request, context);
     },