bug 441446: set mozBackgroundRequest on XMPP request object when created rather than when used, since it only needs to be set once
authorMyk Melez <myk@mozilla.org>
Wed, 25 Jun 2008 01:56:17 -0700
changeset 44735 83a955a47d0404e8f5a43e0f11f91a39361efc15
parent 44733 3d03b79e0ba7609f2da3ed9824959c82ed5bd588 (current diff)
parent 44734 fb21be8385f75574c34f6c699b8de2abf06473d7 (diff)
child 44736 50370911ef24d4c2f00751d6375e28a51d7e7103
push idunknown
push userunknown
push dateunknown
bugs441446
bug 441446: set mozBackgroundRequest on XMPP request object when created rather than when used, since it only needs to be set once
--- a/services/sync/modules/xmpp/transportLayer.js
+++ b/services/sync/modules/xmpp/transportLayer.js
@@ -172,21 +172,21 @@ HTTPPollingTransport.prototype = {
     this._callbackObject = null;
     this._useKeys = useKeys;
     this._interval = interval;
     this._outgoingRetryBuffer = "";
     this._retryCount = 0;
     this._retryCap = 0;
   },
 
-  __request: null,
   get _request() {
-    if (!this.__request)
-      this.__request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance( Ci.nsIXMLHttpRequest );
-    return this.__request;
+    let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance( Ci.nsIXMLHttpRequest );
+    request.mozBackgroundRequest = true;
+    this.__defineGetter__("_request", function() request);
+    return this._request;
   },
 
   __hasher: null,
   get _hasher() {
     if (!this.__hasher)
       this.__hasher = Cc["@mozilla.org/security/hash;1"].createInstance( Ci.nsICryptoHash );
     return this.__hasher;
   },
@@ -251,17 +251,16 @@ HTTPPollingTransport.prototype = {
     if ( this._callbackObject != null ) {
       this._callbackObject.onTransportError( errorText );
     }
     this.disconnect();
   },
 
   _doPost: function( requestXml ) {
     var request = this._request;
-    request.mozBackgroundRequest = true;
     var callbackObj = this._callbackObject;
     var self = this;
     var contents = "";
 
     if ( this._useKey ) {
       this._advanceKey();
       contents = this._connectionId + ";" + this._key + "," + requestXml;
     } else {