Bug 732553 - NS_BASE_STREAM_CLOSED in dbg-transport.js. r=past
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 19 Jun 2013 20:57:35 -0400
changeset 135742 903a455c5430edb53b5b39be6850c221aca626f5
parent 135741 f69a75b67d1ffc1b2af3aa465be462853bad1678
child 135743 82161c9015ab152766a1995ad7f66214fa8ed08a
push id29800
push userryanvm@gmail.com
push dateThu, 20 Jun 2013 00:57:52 +0000
treeherdermozilla-inbound@6a4bbbbe19bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs732553
milestone24.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 732553 - NS_BASE_STREAM_CLOSED in dbg-transport.js. r=past
toolkit/devtools/server/transport.js
--- a/toolkit/devtools/server/transport.js
+++ b/toolkit/devtools/server/transport.js
@@ -87,17 +87,24 @@ DebuggerTransport.prototype = {
     if (this._outgoing.length > 0) {
       var threadManager = Cc["@mozilla.org/thread-manager;1"].getService();
       this._output.asyncWait(this, 0, 0, threadManager.currentThread);
     }
   },
 
   onOutputStreamReady:
   makeInfallible(function DT_onOutputStreamReady(aStream) {
-    let written = aStream.write(this._outgoing, this._outgoing.length);
+    let written = 0;
+    try {
+      written = aStream.write(this._outgoing, this._outgoing.length);
+    } catch(e if e.result == Components.results.NS_BASE_STREAM_CLOSED) {
+      dumpn("Connection closed.");
+      this.close();
+      return;
+    }
     this._outgoing = this._outgoing.slice(written);
     this._flushOutgoing();
   }, "DebuggerTransport.prototype.onOutputStreamReady"),
 
   /**
    * Initialize the input stream for reading. Once this method has been
    * called, we watch for packets on the input stream, and pass them to
    * this.hook.onPacket.