Bug 1594323 - Fix IRC capability state handling between reconnects. r=freaktechnik
authorPatrick Cloke <clokep@gmail.com>
Mon, 02 Dec 2019 12:36:38 +0200
changeset 36761 f83cf1dd1132b33fe33787534097fd088fcccb6f
parent 36760 a0470cab33c08920a9b7644048e36144ce05d396
child 36762 fc1c18cda24b0a157d4b6d71c401bf4b5146b17e
push id2534
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:52:51 +0000
treeherdercomm-beta@055c50840778 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfreaktechnik
bugs1594323
Bug 1594323 - Fix IRC capability state handling between reconnects. r=freaktechnik
chat/protocols/irc/irc.js
--- a/chat/protocols/irc/irc.js
+++ b/chat/protocols/irc/irc.js
@@ -1837,17 +1837,16 @@ ircAccount.prototype = {
 
   // Functions for keeping track of whether the Client Capabilities is done.
   // If a cap is to be handled, it should be registered with addCAP, where aCAP
   // is a "unique" string defining what is being handled. When the cap is done
   // being handled removeCAP should be called with the same string.
   _availableCAPs: new Set(),
   _activeCAPs: new Set(),
   _requestedCAPs: new Set(),
-  _capTimeout: null,
   _negotiatedCAPs: false,
   _queuedCAPs: [],
   addCAP(aCAP) {
     if (this.connected) {
       this.ERROR("Trying to add CAP " + aCAP + " after connection.");
       return;
     }
 
@@ -2197,19 +2196,21 @@ ircAccount.prototype = {
     // is when the server acknowledges our disconnection.
     // Otherwise it's because we lost the connection.
     if (!this.disconnecting) {
       this._reportDisconnecting(aError, aErrorMessage);
     }
     this._socket.disconnect();
     delete this._socket;
 
-    this._requestedCAPs.clear();
+    // Reset cap negotiation.
     this._availableCAPs.clear();
     this._activeCAPs.clear();
+    this._requestedCAPs.clear();
+    this._negotiatedCAPs = false;
     this._queuedCAPs.length = 0;
 
     clearTimeout(this._isOnTimer);
     delete this._isOnTimer;
 
     // No need to call gotDisconnected a second time.
     clearTimeout(this._quitTimer);
     delete this._quitTimer;