Bug 1485660 - Avoid exceptions when the connection is closed in middle of the actor's id retrieval. r=jdescottes
☠☠ backed out by 7a97fe41a34f ☠ ☠
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 11 Oct 2018 15:46:24 +0000
changeset 489082 9026679753b2a8085089447b9a60584071ad5836
parent 489081 dccca441b9803ac8672d0135ea208826333fcdfc
child 489083 3642f2d6677725156a16768d7109e86a0583af09
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersjdescottes
bugs1485660
milestone64.0a1
Bug 1485660 - Avoid exceptions when the connection is closed in middle of the actor's id retrieval. r=jdescottes MozReview-Commit-ID: KvwkISz7OVe Depends on D7456 Differential Revision: https://phabricator.services.mozilla.com/D7457
devtools/shared/protocol.js
--- a/devtools/shared/protocol.js
+++ b/devtools/shared/protocol.js
@@ -1347,17 +1347,20 @@ Front.prototype = extend(Pool.prototype,
    * Send a packet on the connection.
    */
   send: function(packet) {
     if (packet.to) {
       this.conn._transport.send(packet);
     } else {
       this.actor().then(actorID => {
         packet.to = actorID;
-        this.conn._transport.send(packet);
+        // The connection might be closed during the promise resolution
+        if (this.conn._transport) {
+          this.conn._transport.send(packet);
+        }
       }).catch(console.error);
     }
   },
 
   /**
    * Send a two-way request on the connection.
    */
   request: function(packet) {