|
@@ -1,7 +1,7 @@
|
|
|
# HG changeset patch
|
|
|
# User Ian Neal <iann_cvs@blueyonder.co.uk>
|
|
|
# Date 1728338342 -3600
|
|
|
-# Parent 509230dd9d30cbb4fe89db44f2e9e596a6171ea9
|
|
|
+# Parent 1f2ce8dbf953c91a920a73355104629ba4d91ac2
|
|
|
Bug 1923219 - Remove unused code from connection-xpcom.js. r=frg a=frg
|
|
|
|
|
|
diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/irc/js/lib/connection-xpcom.js
|
|
@@ -22,8 +22,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
-const nsIBinaryOutputStream = Components.interfaces.nsIBinaryOutputStream;
|
|
|
-
|
|
|
-function toSInputStream(stream, binary)
|
|
|
-+function toSInputStream(stream)
|
|
|
- {
|
|
|
+-{
|
|
|
- var sstream;
|
|
|
-
|
|
|
- if (binary)
|
|
@@ -38,16 +37,17 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
- sstream = sstream.createInstance(nsIScriptableInputStream);
|
|
|
- sstream.init(stream);
|
|
|
- }
|
|
|
-+ var sstream = Components.classes["@mozilla.org/binaryinputstream;1"];
|
|
|
-+ sstream = sstream.createInstance(Components.interfaces.nsIBinaryInputStream);
|
|
|
++function toSInputStream(stream)
|
|
|
++{
|
|
|
++ let sstream = Cc["@mozilla.org/binaryinputstream;1"]
|
|
|
++ .createInstance(Ci.nsIBinaryInputStream);
|
|
|
+ sstream.setInputStream(stream);
|
|
|
|
|
|
return sstream;
|
|
|
}
|
|
|
|
|
|
-function toSOutputStream(stream, binary)
|
|
|
-+function toSOutputStream(stream)
|
|
|
- {
|
|
|
+-{
|
|
|
- var sstream;
|
|
|
-
|
|
|
- if (binary)
|
|
@@ -60,8 +60,10 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
- {
|
|
|
- sstream = stream;
|
|
|
- }
|
|
|
-+ var sstream = Components.classes["@mozilla.org/binaryoutputstream;1"];
|
|
|
-+ sstream = sstream.createInstance(Components.interfaces.nsIBinaryOutputStream);
|
|
|
++function toSOutputStream(stream)
|
|
|
++{
|
|
|
++ let sstream = Cc["@mozilla.org/binaryoutputstream;1"]
|
|
|
++ .createInstance(Ci.nsIBinaryOutputStream);
|
|
|
+ sstream.setOutputStream(stream);
|
|
|
|
|
|
return sstream;
|
|
@@ -71,7 +73,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
* The idea is to suppress the default UI's alert box
|
|
|
* and allow the exception to propagate normally
|
|
|
*/
|
|
|
-@@ -110,102 +85,28 @@ function badcert_queryinterface(aIID)
|
|
|
+@@ -110,101 +85,26 @@ function badcert_queryinterface(aIID)
|
|
|
BadCertHandler.prototype.notifyCertProblem =
|
|
|
function badcert_notifyCertProblem(socketInfo, sslStatus, targetHost)
|
|
|
{
|
|
@@ -88,8 +90,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
- * the choice unless you know you need binary.
|
|
|
*/
|
|
|
-function CBSConnection (binary)
|
|
|
-+function CBSConnection ()
|
|
|
- {
|
|
|
+-{
|
|
|
- /* Since 2003-01-17 18:14, Mozilla has had this contract ID for the STS.
|
|
|
- * Prior to that it didn't have one, so we also include the CID for the
|
|
|
- * STS back then - DO NOT UPDATE THE ID if it changes in Mozilla.
|
|
@@ -106,9 +107,10 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
-
|
|
|
- var sockService = sockServiceClass.getService();
|
|
|
- if (!sockService)
|
|
|
-+ this._sockService =
|
|
|
-+ Components.classes["@mozilla.org/network/socket-transport-service;1"]
|
|
|
-+ .getService(Components.interfaces.nsISocketTransportService);
|
|
|
++function CBSConnection ()
|
|
|
++{
|
|
|
++ this._sockService = Cc["@mozilla.org/network/socket-transport-service;1"]
|
|
|
++ .getService(Ci.nsISocketTransportService);
|
|
|
+ if (!this._sockService)
|
|
|
throw ("Couldn't get socket service.");
|
|
|
|
|
@@ -167,10 +169,11 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
- {
|
|
|
- throw ("Unable to use binary streams in this build.");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
--CBSConnection.prototype.workingBinaryStreams = -1;
|
|
|
+-}
|
|
|
-
|
|
|
+-CBSConnection.prototype.workingBinaryStreams = -1;
|
|
|
++}
|
|
|
+
|
|
|
CBSConnection.prototype.connect =
|
|
|
function bc_connect(host, port, config, observer)
|
|
|
{
|
|
@@ -178,8 +181,66 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
this.port = port;
|
|
|
|
|
|
/* The APIs below want host:port. Later on, we also reformat the host to
|
|
|
- * strip IPv6 literal brackets.
|
|
|
-@@ -297,43 +198,39 @@ function bc_connect(host, port, config,
|
|
|
+@@ -212,19 +112,19 @@ function bc_connect(host, port, config,
|
|
|
+ */
|
|
|
+ var hostPort = host + ":" + port;
|
|
|
+
|
|
|
+ if (!config)
|
|
|
+ config = {};
|
|
|
+
|
|
|
+ if (!("proxyInfo" in config))
|
|
|
+ {
|
|
|
+- // Lets get a transportInfo for this
|
|
|
+- var pps = getService("@mozilla.org/network/protocol-proxy-service;1",
|
|
|
+- "nsIProtocolProxyService");
|
|
|
++ // Lets get a transportInfo for this.
|
|
|
++ let pps = Cc["@mozilla.org/network/protocol-proxy-service;1"]
|
|
|
++ .getService(Ci.nsIProtocolProxyService);
|
|
|
+
|
|
|
+ /* Force Necko to supply the HTTP proxy info if desired. For none,
|
|
|
+ * force no proxy. Other values will get default treatment.
|
|
|
+ */
|
|
|
+ var uri = "irc://" + hostPort;
|
|
|
+ if ("proxy" in config)
|
|
|
+ {
|
|
|
+ if (config.proxy == "http")
|
|
|
+@@ -249,33 +149,25 @@ function bc_connect(host, port, config,
|
|
|
+ }
|
|
|
+ if ("onSocketConnection" in observer)
|
|
|
+ observer.onSocketConnection(host, port, config);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (uri)
|
|
|
+ {
|
|
|
+ uri = Services.io.newURI(uri);
|
|
|
+- if ("asyncResolve" in pps)
|
|
|
++ try
|
|
|
+ {
|
|
|
+ pps.asyncResolve(uri, 0, {
|
|
|
+ onProxyAvailable: function(request, uri, proxyInfo, status) {
|
|
|
+ continueWithProxy(proxyInfo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+- else if ("resolve" in pps)
|
|
|
+- {
|
|
|
+- continueWithProxy(pps.resolve(uri, 0));
|
|
|
+- }
|
|
|
+- else if ("examineForProxy" in pps)
|
|
|
+- {
|
|
|
+- continueWithProxy(pps.examineForProxy(uri));
|
|
|
+- }
|
|
|
+- else
|
|
|
++ catch (ex)
|
|
|
+ {
|
|
|
+ throw "Unable to find method to resolve proxies";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ continueWithProxy(null);
|
|
|
+ }
|
|
|
+@@ -297,43 +189,39 @@ function bc_connect(host, port, config,
|
|
|
throw JSIRC_ERR_PAC_LOADING;
|
|
|
|
|
|
/* use new necko interfaces */
|
|
@@ -226,7 +287,38 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
if (usingHTTPCONNECT)
|
|
|
this.sendData("CONNECT " + hostPort + " HTTP/1.1\r\n\r\n");
|
|
|
|
|
|
-@@ -388,24 +285,22 @@ function bc_accept(transport, observer)
|
|
|
+@@ -350,28 +238,18 @@ function bc_starttls()
|
|
|
+ var secInfo = this._transport.securityInfo;
|
|
|
+ var sockControl = secInfo.QueryInterface(Ci.nsISSLSocketControl);
|
|
|
+ sockControl.StartTLS();
|
|
|
+ }
|
|
|
+
|
|
|
+ CBSConnection.prototype.listen =
|
|
|
+ function bc_listen(port, observer)
|
|
|
+ {
|
|
|
+- var serverSockClass =
|
|
|
+- Components.classes["@mozilla.org/network/server-socket;1"];
|
|
|
+-
|
|
|
+- if (!serverSockClass)
|
|
|
+- throw ("Couldn't get server socket class.");
|
|
|
+-
|
|
|
+- var serverSock = serverSockClass.createInstance();
|
|
|
+- if (!serverSock)
|
|
|
+- throw ("Couldn't get server socket.");
|
|
|
+-
|
|
|
+- this._serverSock = serverSock.QueryInterface
|
|
|
+- (Components.interfaces.nsIServerSocket);
|
|
|
++ this._serverSock = Cc["@mozilla.org/network/server-socket;1"]
|
|
|
++ .createInstance(Ci.nsIServerSocket);
|
|
|
+
|
|
|
+ this._serverSock.init(port, false, -1);
|
|
|
+
|
|
|
+ this._serverSockListener = new SocketListener(this, observer);
|
|
|
+
|
|
|
+ this._serverSock.asyncListen(this._serverSockListener);
|
|
|
+
|
|
|
+ this.port = this._serverSock.port;
|
|
|
+@@ -388,24 +266,22 @@ function bc_accept(transport, observer)
|
|
|
|
|
|
var openFlags = 0;
|
|
|
|
|
@@ -253,7 +345,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
this.close();
|
|
|
|
|
|
return this.isConnected;
|
|
|
-@@ -455,45 +350,34 @@ function bc_readdata(timeout, count)
|
|
|
+@@ -455,45 +331,34 @@ function bc_readdata(timeout, count)
|
|
|
dump("OMG, setting up _sInputStream!\n");
|
|
|
}
|
|
|
|
|
@@ -281,8 +373,8 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
CBSConnection.prototype.startAsyncRead =
|
|
|
function bc_saread (observer)
|
|
|
{
|
|
|
- var cls = Components.classes["@mozilla.org/network/input-stream-pump;1"];
|
|
|
- var pump = cls.createInstance(Components.interfaces.nsIInputStreamPump);
|
|
|
+- var cls = Components.classes["@mozilla.org/network/input-stream-pump;1"];
|
|
|
+- var pump = cls.createInstance(Components.interfaces.nsIInputStreamPump);
|
|
|
- // Account for Bug 1402888 which removed the startOffset and readLimit
|
|
|
- // parameters from init.
|
|
|
- if (pump.init.length > 5)
|
|
@@ -292,6 +384,8 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
- {
|
|
|
- pump.init(this._inputStream, 0, 0, false);
|
|
|
- }
|
|
|
++ let pump = Cc["@mozilla.org/network/input-stream-pump;1"]
|
|
|
++ .createInstance(Ci.nsIInputStreamPump);
|
|
|
+ pump.init(this._inputStream, 0, 0, false);
|
|
|
pump.asyncRead(new StreamListener(observer), this);
|
|
|
}
|
|
@@ -301,7 +395,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
{
|
|
|
this._streamProvider.pendingData += str;
|
|
|
if (this._streamProvider.isBlocked)
|
|
|
-@@ -511,20 +395,17 @@ function bc_haspwrite ()
|
|
|
+@@ -511,20 +376,17 @@ function bc_haspwrite ()
|
|
|
|
|
|
CBSConnection.prototype.sendDataNow =
|
|
|
function bc_senddatanow(str)
|
|
@@ -323,7 +417,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
this.disconnect();
|
|
|
throw (ex);
|
|
|
}
|
|
|
-@@ -611,22 +492,16 @@ function sp_datawrite (request, ctxt, os
|
|
|
+@@ -611,22 +473,16 @@ function sp_datawrite (request, ctxt, os
|
|
|
//dd ("StreamProvider.prototype.onDataWritable");
|
|
|
|
|
|
if ("isClosed" in this && this.isClosed)
|
|
@@ -346,7 +440,7 @@ diff --git a/suite/extensions/irc/js/lib/connection-xpcom.js b/suite/extensions/
|
|
|
}
|
|
|
|
|
|
StreamProvider.prototype.onStartRequest =
|
|
|
-@@ -672,17 +547,17 @@ function sl_dataavail (request, ctxt, in
|
|
|
+@@ -672,17 +528,17 @@ function sl_dataavail (request, ctxt, in
|
|
|
if (!ctxt)
|
|
|
{
|
|
|
dd ("*** Can't get wrappedJSObject from ctxt in " +
|