r1506 - trunk/mozile/td

[email protected] Sun, 10 Sep 2006 11:49:38 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Sun Sep 10 11:49:37 2006
New Revision: 1506

Modified:
   trunk/mozile/td/webdav.js
Log:
remove script tags, if there's a parse error. helps with shitty ZoneAlarm

Modified: trunk/mozile/td/webdav.js
==============================================================================
--- trunk/mozile/td/webdav.js	(original)
+++ trunk/mozile/td/webdav.js	Sun Sep 10 11:49:37 2006
@@ -38,7 +38,22 @@
 		reqObj.status = 200;
 		reqObj.statusText = "OK";
 	} else if (p.responseXML) {
-		reqObj =  td.container.parseResponseXML(p.responseXML);
+		
+		//looks like a parse error, try removing script tags inserted by eg. ZoneAlarm
+		var parser = new DOMParser();
+		
+		var xmlstr = p.responseText;
+		xmlstr = xmlstr.replace(/<script[^>]+>[^<]*<\/script>/g,"");
+		var xmldoc = parser.parseFromString(xmlstr,"text/xml");
+		if (xmldoc.documentElement.nodeName != 'parsererror') {
+			reqObj.document = xmldoc;
+			reqObj.isError = false;
+			reqObj.status = 200;
+			reqObj.statusText = "OK";
+		} else {
+		
+			reqObj =  td.container.parseResponseXML(p.responseXML);
+		}
 	}
 	else {
 		reqObj = td.container.parseResponseText(p.responseText);
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs