Bug 1313063 - Only stop observing `dom.push.userAgentID` if we've finished the handshake. r?dragana
MozReview-Commit-ID: 8yjJfbXHLD5
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -336,21 +336,24 @@ this.PushServiceWebSocket = {
_reconnect: function () {
console.debug("reconnect()");
this._shutdownWS(false);
this._startBackoffTimer();
},
_shutdownWS: function(shouldCancelPending = true) {
console.debug("shutdownWS()");
+
+ if (this._currentState == STATE_READY) {
+ prefs.ignore("userAgentID", this);
+ }
+
this._currentState = STATE_SHUT_DOWN;
this._skipReconnect = false;
- prefs.ignore("userAgentID", this);
-
if (this._wsListener) {
this._wsListener._pushService = null;
}
try {
this._ws.close(0, null);
} catch (e) {}
this._ws = null;