bug 1523104: remote: add missing Connection.close method called from TargetListener.close; r=ato
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 14 Feb 2019 01:20:20 -0800
changeset 521081 51927b210a12
parent 521080 8231251f03a4
child 521082 c54bbccb690b
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1523104
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1523104: remote: add missing Connection.close method called from TargetListener.close; r=ato
remote/Connection.jsm
remote/server/WebSocketTransport.jsm
--- a/remote/Connection.jsm
+++ b/remote/Connection.jsm
@@ -56,14 +56,18 @@ class Connection {
       message = this.deserialize(packet);
       this.onmessage.call(null, message);
     } catch (e) {
       log.warn(e);
       this.error(message.id, e);
     }
   }
 
+  close() {
+    this.transport.close();
+  }
+
   onClosed(status) {}
 
   toString() {
     return `[object Connection ${this.id}]`;
   }
 }
--- a/remote/server/WebSocketTransport.jsm
+++ b/remote/server/WebSocketTransport.jsm
@@ -37,16 +37,19 @@ WebSocketDebuggerTransport.prototype = {
     }
   },
 
   startBulkSend() {
     throw new Error("Bulk send is not supported by WebSocket transport");
   },
 
   close() {
+    if (!this.socket) {
+      return;
+    }
     this.emit("close");
     this.active = false;
 
     this.socket.removeEventListener("message", this);
     this.socket.removeEventListener("close", this);
     this.socket.close();
     this.socket = null;