Bug 1497352 - Port Bug 1402888 to ChatZilla. r=gijs
authorBill Gianopoulos <wgianopoulos@gmail.com>
Tue, 25 Sep 2018 15:36:07 -0400
changeset 2126 75c8c75015bc
parent 2125 a8e14a8352ec
child 2127 ded1d42cc8ed
push id522
push userfrgrahl@gmx.net
push dateSun, 14 Oct 2018 13:39:19 +0000
reviewersgijs
bugs1497352, 1402888
Bug 1497352 - Port Bug 1402888 to ChatZilla. r=gijs Remove nsIStreamTransportService::createInputTransport startOffset and readLimit.
js/lib/connection-xpcom.js
--- a/js/lib/connection-xpcom.js
+++ b/js/lib/connection-xpcom.js
@@ -575,17 +575,25 @@ function bc_saread (observer)
     {
         this._transport.asyncRead (new StreamListener (observer),
                                    this, 0, -1, 0);
     }
     else
     {
         var cls = Components.classes["@mozilla.org/network/input-stream-pump;1"];
         var pump = cls.createInstance(Components.interfaces.nsIInputStreamPump);
-        pump.init(this._inputStream, -1, -1, 0, 0, false);
+        // Account for Bug 1402888 which removed the startOffset and readLimit
+        // parameters from init.
+        if (pump.init.length > 5)
+        {
+            pump.init(this._inputStream, -1, -1, 0, 0, false);
+        } else
+        {
+            pump.init(this._inputStream, 0, 0, false);
+        }
         pump.asyncRead(new StreamListener(observer), this);
     }
 }
 
 CBSConnection.prototype.asyncWrite =
 function bc_awrite (str)
 {
     this._streamProvider.pendingData += str;