Bug 353392 - If we're given the "unknown" proxy object (which indicates PAC isn't loaded yet), fail the connection attempt and retry it in a few seconds.

r=gijs
ChatZilla only.


git-svn-id: svn://10.0.0.236/trunk@256284 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
silver%warwickcompsoc.co.uk
2009-02-22 13:03:51 +00:00
parent a20f6cd872
commit 27d2f2465d
4 changed files with 34 additions and 6 deletions

View File

@@ -221,6 +221,9 @@ function bc_connect(host, port, config, observer)
proxyInfo = getProxyFor("irc://" + host + ":" + port);
}
if (proxyInfo && ("type" in proxyInfo) && (proxyInfo.type == "unknown"))
throw JSIRC_ERR_PAC_LOADING;
if (jsenv.HAS_STREAM_PROVIDER)
{
if (("isSecure" in config) && config.isSecure)
@@ -309,7 +312,7 @@ function bc_connect(host, port, config, observer)
this.sendData("CONNECT " + host + ":" + port + " HTTP/1.1\r\n\r\n");
}
return this.isConnected;
return true;
}

View File

@@ -42,6 +42,7 @@ const JSIRC_ERR_EXHAUSTED = "JSIRCE:E";
const JSIRC_ERR_CANCELLED = "JSIRCE:C";
const JSIRC_ERR_NO_SECURE = "JSIRCE:NO_SECURE";
const JSIRC_ERR_OFFLINE = "JSIRCE:OFFLINE";
const JSIRC_ERR_PAC_LOADING = "JSIRCE:PAC_LOADING";
function userIsMe (user)
{
@@ -127,6 +128,7 @@ CIRCNetwork.prototype.INITIAL_CHANNEL = "#jsbot";
CIRCNetwork.prototype.INITIAL_UMODE = "+iw";
CIRCNetwork.prototype.MAX_CONNECT_ATTEMPTS = 5;
CIRCNetwork.prototype.PAC_RECONNECT_DELAY = 5 * 1000;
CIRCNetwork.prototype.getReconnectDelayMs = function() { return 15000; }
CIRCNetwork.prototype.stayingPower = false;
@@ -403,12 +405,24 @@ function net_doconnect(e)
{
this.state = NET_OFFLINE;
ev = new CEvent ("network", "error", this, "onError");
ev = new CEvent("network", "error", this, "onError");
ev.server = this;
ev.debug = "Exception opening socket: " + ex;
ev.errorCode = JSIRC_ERR_NO_SOCKET;
if ((typeof ex == "object") && (ex.result == NS_ERROR_OFFLINE))
ev.errorCode = JSIRC_ERR_OFFLINE;
if ((typeof ex == "string") && (ex == JSIRC_ERR_PAC_LOADING))
{
ev.errorCode = JSIRC_ERR_PAC_LOADING;
ev.retryDelay = CIRCNetwork.prototype.PAC_RECONNECT_DELAY;
/* PAC loading is not a problem with any specific server. We'll
* retry the connection in 5 seconds.
*/
this.nextHost--;
this.state = NET_WAITING;
setTimeout(function(n) { n.immediateConnect() },
ev.retryDelay, this);
}
this.eventPump.addEvent(ev);
}
}

View File

@@ -780,6 +780,8 @@ msg.err.invalid.url = ``%S'' is not a valid url nor an alias for a url, and th
msg.err.no.channel = When running the ``%S'' command, you should either provide a channel name, or run the command in the context of a channel.
msg.err.no.idleservice = ChatZilla can't determine when you're away in your version of &brandShortName;. The auto-away feature will now be disabled.
msg.warn.pac.loading = The automatic proxy configuration file has not loaded yet; ChatZilla will retry shortly.
# Specific bug messages.
msg.bug318419.warning = ChatZilla has detected a potential abnormality in its internal data. You will not be able to send any form of communication at this time, although it might appear you can. The most likely cause is Mozilla Bug 318419 <https://bugzilla.mozilla.org/show_bug.cgi?id=318419>. You are strongly advised to restart the host application (&brandShortName;) to prevent further problems.
msg.bug318419.error = ChatZilla has detected a serious abnormality in its internal data. You will not be able to send any form of communication at this time, although it might appear you can. The most likely cause is Mozilla Bug 318419 <https://bugzilla.mozilla.org/show_bug.cgi?id=318419>. You MUST restart the host application (&brandShortName;) to fix this.

View File

@@ -1935,7 +1935,7 @@ CIRCNetwork.prototype.onError =
function my_neterror (e)
{
var msg;
var type = "ERROR";
var type = MT_ERROR;
if (typeof e.errorCode != "undefined")
{
@@ -1959,12 +1959,19 @@ function my_neterror (e)
case JSIRC_ERR_CANCELLED:
msg = MSG_ERR_CANCELLED;
type = "INFO";
type = MT_INFO;
break;
case JSIRC_ERR_PAC_LOADING:
msg = MSG_WARN_PAC_LOADING;
type = MT_WARN;
break;
}
}
else
{
msg = e.params[e.params.length - 1];
}
dispatch("sync-header");
updateTitle();
@@ -1980,11 +1987,13 @@ function my_neterror (e)
if (msg)
this.display(msg, type);
if (e.errorCode == JSIRC_ERR_PAC_LOADING)
return;
if (this.deleteWhenDone)
this.dispatch("delete-view");
delete this.deleteWhenDone;
}
@@ -1992,7 +2001,7 @@ CIRCNetwork.prototype.onDisconnect =
function my_netdisconnect (e)
{
var msg, msgNetwork;
var msgType = "ERROR";
var msgType = MT_ERROR;
if (typeof e.disconnectStatus != "undefined")
{