Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / src / data / core / Connection.js
index 316fe40..99159ec 100644 (file)
@@ -1,6 +1,6 @@
 /*!
- * Ext JS Library 3.1.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
@@ -13,7 +13,7 @@
         POST = 'POST',\r
         GET = 'GET',\r
         WINDOW = window;\r
-    \r
+\r
     /**\r
      * @class Ext.data.Connection\r
      * @extends Ext.util.Observable\r
@@ -46,7 +46,7 @@
      * @constructor\r
      * @param {Object} config a configuration object.\r
      */\r
-    Ext.data.Connection = function(config){    \r
+    Ext.data.Connection = function(config){\r
         Ext.apply(this, config);\r
         this.addEvents(\r
             /**\r
          * @type Boolean\r
          */\r
         autoAbort:false,\r
-    \r
+\r
         /**\r
          * @cfg {Boolean} disableCaching (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)\r
          * @type Boolean\r
          */\r
         disableCaching: true,\r
-        \r
+\r
         /**\r
          * @cfg {String} disableCachingParam (Optional) Change the parameter which is sent went disabling caching\r
          * through a cache buster. Defaults to '_dc'\r
          * @type String\r
          */\r
         disableCachingParam: '_dc',\r
-        \r
+\r
         /**\r
          * <p>Sends an HTTP request to a remote server.</p>\r
          * <p><b>Important:</b> Ajax server requests are asynchronous, and this call will\r
@@ -161,8 +161,8 @@ Ext.Ajax.request({
          * parameters:<ul>\r
          * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>\r
          * <li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>\r
-         * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data. \r
-         * See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about \r
+         * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.\r
+         * See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about\r
          * accessing elements of the response.</div></li>\r
          * </ul></div></li>\r
          * <li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function\r
@@ -184,7 +184,7 @@ Ext.Ajax.request({
          * <li><b>timeout</b> : Number (Optional)<div class="sub-desc">The timeout in milliseconds to be used for this request. Defaults to 30 seconds.</div></li>\r
          * <li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>\r
          * Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>\r
-         * <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used \r
+         * <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used\r
          * with the <tt>form</tt> option</b>.\r
          * <p>True if the form object is a file upload (will be set automatically if the form was\r
          * configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>\r
@@ -229,15 +229,15 @@ Ext.Ajax.request({
                         me.indicatorText = '<div class="loading-indicator">'+o.indicatorText+"</div>";\r
                     }\r
                     if(me.indicatorText) {\r
-                        Ext.getDom(o.el).innerHTML = me.indicatorText;                        \r
+                        Ext.getDom(o.el).innerHTML = me.indicatorText;\r
                     }\r
                     o.success = (Ext.isFunction(o.success) ? o.success : function(){}).createInterceptor(function(response) {\r
                         Ext.getDom(o.el).innerHTML = response.responseText;\r
                     });\r
                 }\r
-                \r
+\r
                 var p = o.params,\r
-                    url = o.url || me.url,                \r
+                    url = o.url || me.url,\r
                     method,\r
                     cb = {success: me.handleResponse,\r
                           failure: me.handleFailure,\r
@@ -245,61 +245,61 @@ Ext.Ajax.request({
                           argument: {options: o},\r
                           timeout : o.timeout || me.timeout\r
                     },\r
-                    form,                    \r
-                    serForm;                    \r
-                  \r
-                     \r
+                    form,\r
+                    serForm;\r
+\r
+\r
                 if (Ext.isFunction(p)) {\r
                     p = p.call(o.scope||WINDOW, o);\r
                 }\r
-                                                           \r
-                p = Ext.urlEncode(me.extraParams, Ext.isObject(p) ? Ext.urlEncode(p) : p);    \r
-                \r
+\r
+                p = Ext.urlEncode(me.extraParams, Ext.isObject(p) ? Ext.urlEncode(p) : p);\r
+\r
                 if (Ext.isFunction(url)) {\r
                     url = url.call(o.scope || WINDOW, o);\r
                 }\r
-    \r
+\r
                 if((form = Ext.getDom(o.form))){\r
                     url = url || form.action;\r
-                     if(o.isUpload || /multipart\/form-data/i.test(form.getAttribute("enctype"))) { \r
+                     if(o.isUpload || /multipart\/form-data/i.test(form.getAttribute("enctype"))) {\r
                          return me.doFormUpload.call(me, o, p, url);\r
                      }\r
-                    serForm = Ext.lib.Ajax.serializeForm(form);                    \r
+                    serForm = Ext.lib.Ajax.serializeForm(form);\r
                     p = p ? (p + '&' + serForm) : serForm;\r
                 }\r
-                \r
+\r
                 method = o.method || me.method || ((p || o.xmlData || o.jsonData) ? POST : GET);\r
-                \r
+\r
                 if(method === GET && (me.disableCaching && o.disableCaching !== false) || o.disableCaching === true){\r
                     var dcp = o.disableCachingParam || me.disableCachingParam;\r
                     url = Ext.urlAppend(url, dcp + '=' + (new Date().getTime()));\r
                 }\r
-                \r
+\r
                 o.headers = Ext.apply(o.headers || {}, me.defaultHeaders || {});\r
-                \r
+\r
                 if(o.autoAbort === true || me.autoAbort) {\r
                     me.abort();\r
                 }\r
-                 \r
+\r
                 if((method == GET || o.xmlData || o.jsonData) && p){\r
-                    url = Ext.urlAppend(url, p);  \r
+                    url = Ext.urlAppend(url, p);\r
                     p = '';\r
                 }\r
                 return (me.transId = Ext.lib.Ajax.request(method, url, cb, p, o));\r
-            }else{                \r
+            }else{\r
                 return o.callback ? o.callback.apply(o.scope, [o,UNDEFINED,UNDEFINED]) : null;\r
             }\r
         },\r
-    \r
+\r
         /**\r
          * Determine whether this object has a request outstanding.\r
          * @param {Number} transactionId (Optional) defaults to the last transaction\r
          * @return {Boolean} True if there is an outstanding request.\r
          */\r
         isLoading : function(transId){\r
-            return transId ? Ext.lib.Ajax.isCallInProgress(transId) : !! this.transId;            \r
+            return transId ? Ext.lib.Ajax.isCallInProgress(transId) : !! this.transId;\r
         },\r
-    \r
+\r
         /**\r
          * Aborts any outstanding request.\r
          * @param {Number} transactionId (Optional) defaults to the last transaction\r
@@ -358,16 +358,23 @@ Ext.Ajax.request({
             Ext.fly(frame).set({\r
                 id: id,\r
                 name: id,\r
-                cls: 'x-hidden',\r
-                src: Ext.SSL_SECURE_URL // for IE\r
+                cls: 'x-hidden'\r
+\r
             });\r
+\r
             doc.body.appendChild(frame);\r
 \r
+            //Reset the Frame to neutral domain\r
+            Ext.fly(frame).set({\r
+               src : Ext.SSL_SECURE_URL\r
+            });\r
+\r
             // This is required so that IE doesn't pop the response up in a new window.\r
             if(Ext.isIE){\r
                document.frames[id].name = id;\r
             }\r
 \r
+\r
             Ext.fly(form).set({\r
                 target: id,\r
                 method: POST,\r
@@ -459,7 +466,7 @@ Ext.Ajax.request({
 Ext.Ajax.defaultHeaders = {\r
     'Powered-By': 'Ext'\r
 };\r
- * </code></pre> \r
+ * </code></pre>\r
  * </p>\r
  * <p>Common <b>Events</b> you may want to set are:<div class="mdetail-params"><ul>\r
  * <li><b><tt>{@link Ext.data.Connection#beforerequest beforerequest}</tt></b><p class="sub-desc"></p></li>\r
@@ -471,7 +478,7 @@ Ext.Ajax.defaultHeaders = {
 Ext.Ajax.on('beforerequest', this.showSpinner, this);\r
 Ext.Ajax.on('requestcomplete', this.hideSpinner, this);\r
 Ext.Ajax.on('requestexception', this.hideSpinner, this);\r
- * </code></pre> \r
+ * </code></pre>\r
  * </p>\r
  * <p>An example request:</p>\r
  * <pre><code>\r
@@ -491,7 +498,7 @@ Ext.Ajax.{@link Ext.data.Connection#request request}({
     form: 'some-form',\r
     params: 'foo=bar'\r
 });\r
- * </code></pre> \r
+ * </code></pre>\r
  * </p>\r
  * @singleton\r
  */\r