myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r923447 - in /myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr: IFrameXMLRequestEvent.js RequestQueue.js
Date Mon, 15 Mar 2010 21:29:05 GMT
Author: arobinson74
Date: Mon Mar 15 21:29:05 2010
New Revision: 923447

URL: http://svn.apache.org/viewvc?rev=923447&view=rev
Log:
TRINIDAD-1756 - fix for google chrome on linux so that the PPR works correctly in an iFrame,
still researching problems seen on a mac though

Modified:
    myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
    myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js

Modified: myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js?rev=923447&r1=923446&r2=923447&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
(original)
+++ myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/IFrameXMLRequestEvent.js
Mon Mar 15 21:29:05 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/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js?rev=923447&r1=923446&r2=923447&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
(original)
+++ myfaces/trinidad/branches/trinidad-1.2.x/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/xhr/RequestQueue.js
Mon Mar 15 21:29:05 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);
     }



Mime
View raw message