[freeside-commits] freeside/httemplate/elements/fckeditor/editor/filemanager/browser/default/js common.js, 1.1, 1.1.6.1 fckxml.js, 1.1, 1.1.6.1

Mark Wells mark at wavetail.420.am
Tue Mar 16 01:34:55 PDT 2010


Update of /home/cvs/cvsroot/freeside/httemplate/elements/fckeditor/editor/filemanager/browser/default/js
In directory wavetail.420.am:/tmp/cvs-serv23603/editor/filemanager/browser/default/js

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	common.js fckxml.js 
Log Message:
FCKeditor 2.6.6

Index: common.js
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/fckeditor/editor/filemanager/browser/default/js/common.js,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -w -d -r1.1 -r1.1.6.1
--- common.js	1 Aug 2007 22:25:47 -0000	1.1
+++ common.js	16 Mar 2010 08:34:53 -0000	1.1.6.1
@@ -1,6 +1,6 @@
 /*
  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2007 Frederico Caldeira Knabben
+ * Copyright (C) 2003-2010 Frederico Caldeira Knabben
  *
  * == BEGIN LICENSE ==
  *
@@ -22,6 +22,39 @@
  * File Browser dialog window.
  */
 
+// Automatically detect the correct document.domain (#1919).
+(function()
+{
+	var d = document.domain ;
+
+	while ( true )
+	{
+		// Test if we can access a parent property.
+		try
+		{
+			var test = window.top.opener.document.domain ;
+			break ;
+		}
+		catch( e )
+		{}
+
+		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
+		d = d.replace( /.*?(?:\.|$)/, '' ) ;
+
+		if ( d.length == 0 )
+			break ;		// It was not able to detect the domain.
+
+		try
+		{
+			document.domain = d ;
+		}
+		catch (e)
+		{
+			break ;
+		}
+	}
+})() ;
+
 function AddSelectOption( selectElement, optionText, optionValue )
 {
 	var oOption = document.createElement("OPTION") ;

Index: fckxml.js
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/fckeditor/editor/filemanager/browser/default/js/fckxml.js,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -u -w -d -r1.1 -r1.1.6.1
--- fckxml.js	1 Aug 2007 22:25:47 -0000	1.1
+++ fckxml.js	16 Mar 2010 08:34:53 -0000	1.1.6.1
@@ -1,6 +1,6 @@
 /*
  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2007 Frederico Caldeira Knabben
+ * Copyright (C) 2003-2010 Frederico Caldeira Knabben
  *
  * == BEGIN LICENSE ==
  *
@@ -31,8 +31,8 @@
 FCKXml.prototype.GetHttpRequest = function()
 {
 	// Gecko / IE7
-	if ( typeof(XMLHttpRequest) != 'undefined' )
-		return new XMLHttpRequest() ;
+	try { return new XMLHttpRequest(); }
+	catch(e) {}
 
 	// IE6
 	try { return new ActiveXObject( 'Msxml2.XMLHTTP' ) ; }
@@ -61,7 +61,25 @@
 		{
 			if ( oXmlHttp.readyState == 4 )
 			{
-				if ( ( oXmlHttp.status != 200 && oXmlHttp.status != 304 ) || oXmlHttp.responseXML == null || oXmlHttp.responseXML.firstChild == null )
+				var oXml ;
+				try
+				{
+					// this is the same test for an FF2 bug as in fckxml_gecko.js
+					// but we've moved the responseXML assignment into the try{}
+					// so we don't even have to check the return status codes.
+					var test = oXmlHttp.responseXML.firstChild ;
+					oXml = oXmlHttp.responseXML ;
+				}
+				catch ( e )
+				{
+					try
+					{
+						oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ;
+					}
+					catch ( e ) {}
+				}
+
+				if ( !oXml || !oXml.firstChild || oXml.firstChild.nodeName == 'parsererror' )
 				{
 					alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' +
 							'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' +
@@ -70,7 +88,7 @@
 					return ;
 				}
 
-				oFCKXml.DOMDocument = oXmlHttp.responseXML ;
+				oFCKXml.DOMDocument = oXml ;
 				asyncFunctionPointer( oFCKXml ) ;
 			}
 		}



More information about the freeside-commits mailing list