Bug 1120428 - No error/failure message if the websocket fails to connect for some reason. Add a null check when closing the socket. r=nperriault
authorMark Banner <standard8@mozilla.com>
Tue, 13 Jan 2015 15:16:49 +0000
changeset 223553 6074db81bd9e63ae77958837d585ca923c612100
parent 223552 07be7d740021b3853f8364f926da5348b0217b98
child 223554 2d99ceafd75976a871b25a46a5ee838594a8a069
push id10794
push usermbanner@mozilla.com
push dateTue, 13 Jan 2015 15:18:48 +0000
treeherderfx-team@c1f04c06ad54 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnperriault
bugs1120428
milestone38.0a1
Bug 1120428 - No error/failure message if the websocket fails to connect for some reason. Add a null check when closing the socket. r=nperriault
browser/components/loop/content/shared/js/websocket.js
--- a/browser/components/loop/content/shared/js/websocket.js
+++ b/browser/components/loop/content/shared/js/websocket.js
@@ -82,17 +82,19 @@ loop.CallConnectionWebSocket = (function
 
     /**
      * Closes the websocket. This shouldn't be the normal action as the server
      * will normally close the socket. Only in bad error cases, or where we need
      * to close the socket just before closing the window (to avoid an error)
      * should we call this.
      */
     close: function() {
-      this.socket.close();
+      if (this.socket) {
+        this.socket.close();
+      }
     },
 
     _clearConnectionFlags: function() {
       clearTimeout(this.connectDetails.timeout);
       delete this.connectDetails;
     },
 
     /**