diff --git a/mozilla/extensions/irc/js/lib/connection-xpcom.js b/mozilla/extensions/irc/js/lib/connection-xpcom.js index 339f2e9d720..8211a65f137 100644 --- a/mozilla/extensions/irc/js/lib/connection-xpcom.js +++ b/mozilla/extensions/irc/js/lib/connection-xpcom.js @@ -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; } diff --git a/mozilla/extensions/irc/js/lib/irc.js b/mozilla/extensions/irc/js/lib/irc.js index 458a823e9d9..26b9125b529 100644 --- a/mozilla/extensions/irc/js/lib/irc.js +++ b/mozilla/extensions/irc/js/lib/irc.js @@ -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); } } diff --git a/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties b/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties index 085559092e7..3cb9da6cf02 100644 --- a/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties +++ b/mozilla/extensions/irc/locales/en-US/chrome/chatzilla.properties @@ -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 . 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 . You MUST restart the host application (&brandShortName;) to fix this. diff --git a/mozilla/extensions/irc/xul/content/handlers.js b/mozilla/extensions/irc/xul/content/handlers.js index 03d52c330e1..dc73dd968bb 100644 --- a/mozilla/extensions/irc/xul/content/handlers.js +++ b/mozilla/extensions/irc/xul/content/handlers.js @@ -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") {