You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2010/03/15 23:10:43 UTC

svn commit: r923464 - in /myfaces/trinidad/trunk: ./ trinidad-examples/trinidad-components-showcase/ trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/

Author: arobinson74
Date: Mon Mar 15 22:10:43 2010
New Revision: 923464

URL: http://svn.apache.org/viewvc?rev=923464&view=rev
Log:
TRINIDAD-1756 merging changes into trunk from 1.2.x branch

Modified:
    myfaces/trinidad/trunk/   (props changed)
    myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/   (props changed)
    myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
    myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
    myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js

Propchange: myfaces/trinidad/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 15 22:10:43 2010
@@ -5,5 +5,6 @@
 /myfaces/trinidad/branches/ar-1715:908782
 /myfaces/trinidad/branches/ar_clientBehaviors:881469-891464
 /myfaces/trinidad/branches/jwaldman_StyleMap:754977-770778
+/myfaces/trinidad/branches/trinidad-1.2.x:923447,923460
 /myfaces/trinidad/branches/trinidad-2.0.x:823098-895949
 /myfaces/trinidad/trunk:819601,819622,834147,886881,888973,893043,896231-908455,908699-921461

Propchange: myfaces/trinidad/trunk/trinidad-examples/trinidad-components-showcase/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Mar 15 22:10:43 2010
@@ -0,0 +1 @@
+target

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js?rev=923464&r1=923463&r2=923464&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Page.js Mon Mar 15 22:10:43 2010
@@ -455,15 +455,16 @@ TrPage.prototype._getFirstElementFromFra
 {
   // Fragment nodes contain a single CDATA section
   var fragmentChildNodes = fragmentNode.childNodes;
-  // assert((fragmentChildNodes.length == 1), "invalid fragment child count");
-
-  var cdataNode = fragmentNode.childNodes[0];
-  // assert((cdataNode.nodeType == 4), "invalid fragment content");
-  // assert(cdataNode.data, "null fragment content");
-
+  // assert((fragmentChildNodes.length == 0), "invalid fragment child count");
+  var outerHTML = "";
+  for (var i = 0, size = fragmentChildNodes.length; i < size; ++i)
+  {
   // The new HTML content is in the CDATA section.
-  // TODO: Is CDATA content ever split across multiple nodes?
-  var outerHTML = cdataNode.data;
+    if (fragmentChildNodes[i].nodeType == 4)
+    {
+      outerHTML += fragmentChildNodes[i].data;
+    }
+  }
 
   // We get our html node by slamming the fragment contents into a div.
   var doc = window.document;  
@@ -473,7 +474,6 @@ TrPage.prototype._getFirstElementFromFra
   div.innerHTML = outerHTML;
   
   return TrPage._getFirstElementWithId(div);
-  
 }
 
 // Returns the first element underneath the specified dom node

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js?rev=923464&r1=923463&r2=923464&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js Mon Mar 15 22:10:43 2010
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,7 +19,7 @@
 
 /**
  * Iframe base Data Transfer Request Event class. This object is passed back to the listeners
- * of a Data Transfer Service Request. This object and TrXMLRequestEvent 
+ * of a Data Transfer Service Request. This object and TrXMLRequestEvent
  * support ITrXMLRequestEvent pseudo-interface
  * @ see TrXMLRequestEvent
  */
@@ -57,17 +57,30 @@ TrIFrameXMLRequestEvent.prototype.getRes
 * NOTE: this method is valid only for TrXMLRequestEvent.STATUS_COMPLETE
 **/
 TrIFrameXMLRequestEvent.prototype.getResponseText = function()
-{  
+{
   var agentIsIE = _agent.isIE;
   var iframeDoc = this._iframeDoc, xmlDocument = null;
 
-  if(agentIsIE && iframeDoc.XMLDocument)
+  if (agentIsIE && iframeDoc.XMLDocument)
     xmlDocument = iframeDoc.XMLDocument;
-  else if(window.XMLDocument && (iframeDoc instanceof XMLDocument))
+  else if (window.XMLDocument && this._isResponseValidXML())
     xmlDocument = iframeDoc;
-    
+
   if(xmlDocument)
-    return AdfAgent.AGENT.getNodeXml(xmlDocument);
+  {
+    if (typeof XMLSerializer != "undefined")
+    {
+      return (new XMLSerializer()).serializeToString(xmlDocument);
+    }
+    else if (agentIsIE)
+    {
+      return xmlDocument.xml;
+    }
+    else
+    {
+      return null;
+    }
+  }
   else
     return iframeDoc.documentElement.innerHTML;
 }
@@ -81,6 +94,8 @@ TrIFrameXMLRequestEvent.prototype._isRes
     return true;
   else if(window.XMLDocument && (iframeDoc instanceof XMLDocument))
     return true;
+  else if (_agent.isSafari && iframeDoc.xmlVersion != null)
+    return true;
   else
     return false;
 }
@@ -96,30 +111,30 @@ TrIFrameXMLRequestEvent.prototype.getRes
 }
 
 /**
-* Returns if whether if is a rich response
+* Returns if whether if is a PPR response
 * NOTE: this method is valid only for TrXMLRequestEvent.STATUS_COMPLETE
 **/
 TrIFrameXMLRequestEvent.prototype.isPprResponse = function()
 {
   var agentIsIE = _agent.isIE;
   var iframeDoc = this._iframeDoc;
-  var isRichReponse = false;
-  
-  // Look for "Adf-Rich-Response-Type" PI
-  if(agentIsIE && iframeDoc.XMLDocument)
+  var pprResponse = false;
+
+  // Look for "Tr-XHR-Response-Type" PI
+  if (agentIsIE && iframeDoc.XMLDocument)
   {
     var xmlDocument = iframeDoc.XMLDocument, childNodes = xmlDocument.childNodes;
     // In IE the xml PI is the first node
     if(childNodes.length >= 2 && childNodes[1].nodeName ==  "Tr-XHR-Response-Type")
-      isRichReponse = true;
+      pprResponse = true;
   }
   else
   {
     if(iframeDoc.firstChild && iframeDoc.firstChild.nodeName ==  "Tr-XHR-Response-Type")
-      isRichReponse = true;
+      pprResponse = true;
   }
-  
-  return isRichReponse;
+
+  return pprResponse;
 }
 
 /**
@@ -130,6 +145,6 @@ TrIFrameXMLRequestEvent.prototype.getRes
 {
   if(this._isResponseValidXML())
     return "text/xml";
-    
+
   return "text/html";
 }
\ No newline at end of file

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js?rev=923464&r1=923463&r2=923464&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js Mon Mar 15 22:10:43 2010
@@ -139,7 +139,7 @@ TrRequestQueue.prototype.sendFormPost = 
   //expando property encoded as a ResourceUrl.  As such, if the expando is available, use it
   //for PPR
   var pprURL;
-  // In mobile browsers like windows mobile ie, getAttribute funtion throws an exception if 
+  // In mobile browsers like windows mobile ie, getAttribute funtion throws an exception if
   // actionForm doesn't contain the attribute "_trinPPRAction".
   try
   {
@@ -149,7 +149,7 @@ TrRequestQueue.prototype.sendFormPost = 
   {
   }
   var action = pprURL?pprURL:actionForm.action;
-  
+
   if (this._isMultipartForm(actionForm))
   {
     // TODO: log a warning if we're dropping any headers?  Or
@@ -587,6 +587,14 @@ TrRequestQueue.prototype._clearParamNode
   }
 }
 
+TrRequestQueue.prototype._isIFrameBlankHTML = function(iframeDoc)
+{
+  // In webkit browsers, the iframe load first with blank.html and will cause the
+  // code to incorrectly think the document is loaded when it is just the blank.html and
+  // the IFrame is still loading
+  return (_agent.isSafari && iframeDoc.documentURI == "about:blank");
+}
+
 TrRequestQueue.prototype._handleIFrameLoad = function()
 {
   var domDocument = this._getDomDocument();
@@ -607,7 +615,8 @@ TrRequestQueue.prototype._handleIFrameLo
   try
   {
     if(!iframeDoc.documentElement || !iframeDoc.documentElement.firstChild
-      || (agentIsIE && iframeDoc.readyState != "complete"))
+      || (agentIsIE && iframeDoc.readyState != "complete") ||
+      this._isIFrameBlankHTML(iframeDoc))
     {
       this._window.setTimeout(this._iframeLoadCallback, 50);
     }