svn commit r19172 - trunk/wsf/javascript/native/src

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

svn commit r19172 - trunk/wsf/javascript/native/src

Jonathan Marsh-2
Author: jonathan
Date: Sat Jul 12 08:08:39 2008
New Revision: 19172
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=19172

Log:
Fixed some IE incompatibilities wrt script injection.

Modified:
   trunk/wsf/javascript/native/src/WSRequest.js

Modified: trunk/wsf/javascript/native/src/WSRequest.js
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/javascript/native/src/WSRequest.js?rev=19172&r1=19171&r2=19172&view=diff
==============================================================================
--- trunk/wsf/javascript/native/src/WSRequest.js (original)
+++ trunk/wsf/javascript/native/src/WSRequest.js Sat Jul 12 08:08:39 2008
@@ -175,7 +175,7 @@
             }
         } catch (e) {
             // If we received an error, see if it's an XSS error, if so don't fail - there still might be hope!
-            if (e.description == "Access is denied.\r\n" || e.toString() == "Permission denied to call method XMLHttpRequest.open") {
+            if (e.description == "Access is denied.\r\n" || e.toString() == "Permission denied to call method XMLHttpRequest.open" || e.name == "NS_ERROR_DOM_BAD_URI") {
                 try {
                     var thisDomain = this._uri.substring(0, this._uri.substring(9).indexOf("/") + 10);
                     WSRequestInaccessibleDomains.push(thisDomain);
@@ -251,7 +251,6 @@
 }
 
 WSRequest._tunnelcallback = function (scriptId, responseText) {
-
     var thisRequest = null;
     for (var i=0; i<WSRequestActiveRequests.length; i++) {
         if (WSRequestActiveRequests[i][0] == scriptId) {
@@ -298,8 +297,13 @@
 
         if (thisRequest._soapVer == 0) {
             if (response != null) {
-                var httpStatus = response.documentElement.getAttributeNS("http://wso2.org/ns/WSRequestXSS", "status");
-                if (httpStatus != '200' && httpStatus != '202') {
+                var httpStatus;
+                if (browser == "ie" || browser == "ie7") {
+                    httpStatus = response.documentElement.getAttribute("h:status");
+                } else {
+                    httpStatus = response.documentElement.getAttributeNS("http://wso2.org/ns/WSRequestXSS", "status");
+                }
+                if (httpStatus != null && httpStatus != '') {
                     thisRequest.error = new WebServiceError("HTTP " + httpStatus, responseText);
                 }
             }
@@ -334,7 +338,6 @@
 }
 
 WSRequest.prototype._base64 = function (input) {
-
     // Not strictly base64 returns - nulls represented as "~"
     if (input == null) return "~";
 
@@ -346,7 +349,6 @@
     var charCode;
     var i = 0;
     var padding = 0;
-
     while (charCode = input.charCodeAt(i++)) {
         // convert to utf-8 as we fill the buffer
         if (charCode < 0x80) {
@@ -374,12 +376,14 @@
         }
 
         if (p.length > 2) {
-            output += base64Map[p[0] >> 2];
-            output += base64Map[((p.shift() & 3) << 4) | (p[0] >> 4)];
-            output += (padding > 1) ? "=" : base64Map[((p.shift() & 0xf) << 2) | (p[0] >> 6)];
-            output += (padding > 0) ? "=" : base64Map[p.shift() & 0x3f];
+            output += base64Map.charAt(p[0] >> 2);
+            output += base64Map.charAt(((p.shift() & 3) << 4) | (p[0] >> 4));
+            output += (padding > 1) ? "=" : base64Map.charAt(((p.shift() & 0xf) << 2) | (p[0] >> 6));
+            output += (padding > 0) ? "=" : base64Map.charAt(p.shift() & 0x3f);
         }
+
     }
+
     return output;
 }
 

_______________________________________________
Wsf-javascript-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsf-javascript-dev
Loading...