@@ -80,6 +80,17 @@ if (forcetk.Client === undefined) {
8080 this . asyncAjax = true ;
8181 } ;
8282
83+ /**
84+ * Creates an AJAX request object. Can be overridden for particular implementations.
85+ */
86+ forcetk . Client . prototype . getXHR = function ( ) {
87+ if ( window && window . Sarissa && window . Sarissa . originalXMLHttpRequest ) {
88+ return new window . Sarissa . originalXMLHttpRequest ( ) ;
89+ } else {
90+ return new XMLHttpRequest ( ) ;
91+ }
92+ } ;
93+
8394 /**
8495 * Set a refresh token in the client.
8596 * @param refreshToken an OAuth refresh token
@@ -211,7 +222,7 @@ if (forcetk.Client === undefined) {
211222 'use strict' ;
212223 var that = this ,
213224 url = ( this . visualforce ? '' : this . instanceUrl ) + path ,
214- request = new XMLHttpRequest ( ) ;
225+ request = this . getXHR ( ) ;
215226
216227 request . open ( "GET" , ( this . proxyUrl !== null && ! this . visualforce ) ? this . proxyUrl : url , true ) ;
217228 request . responseType = "arraybuffer" ;
@@ -293,7 +304,7 @@ if (forcetk.Client === undefined) {
293304 "\n\n"
294305 + "--boundary_" + boundary + "--"
295306 ] , { type : 'multipart/form-data; boundary=\"boundary_' + boundary + '\"' } ) ,
296- request = new XMLHttpRequest ( ) ;
307+ request = this . getXHR ( ) ;
297308
298309 request . open ( "POST" , ( this . proxyUrl !== null && ! this . visualforce ) ? this . proxyUrl : url , this . asyncAjax ) ;
299310
0 commit comments