Bug 1324952 - Don't asyncWait on the input stream if we've been stopped in test_be_conservative.js. r=mcmanus, a=test-only
authorDavid Keeler <dkeeler@mozilla.com>
Mon, 06 Feb 2017 15:02:01 -0800
changeset 375990 74e5d0b3f78791523e468ee070e96f56fc4a3310
parent 375989 a4493daadab62c9d4c30115aa27884891a0ee9b0
child 375991 08bda06716273fb254d90a63a51d91f6992f2dea
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, test-only
bugs1324952
milestone53.0a2
Bug 1324952 - Don't asyncWait on the input stream if we've been stopped in test_be_conservative.js. r=mcmanus, a=test-only MozReview-Commit-ID: 3wkbicHLuUG
netwerk/test/unit/test_be_conservative.js
--- a/netwerk/test/unit/test_be_conservative.js
+++ b/netwerk/test/unit/test_be_conservative.js
@@ -76,28 +76,37 @@ class InputStreamCallback {
   }
 }
 
 class TLSServerSecurityObserver {
   constructor(input, output) {
     this.input = input;
     this.output = output;
     this.callbacks = [];
+    this.stopped = false;
   }
 
   onHandshakeDone(socket, status) {
     do_print("TLS handshake done");
     do_print(`TLS version used: ${status.tlsVersionUsed}`);
 
+    if (this.stopped) {
+      do_print("handshake done callback stopped - closing streams and bailing");
+      this.input.close();
+      this.output.close();
+      return;
+    }
+
     let callback = new InputStreamCallback(this.output);
     this.callbacks.push(callback);
     this.input.asyncWait(callback, 0, 0, Services.tm.currentThread);
   }
 
   stop() {
+    this.stopped = true;
     this.callbacks.forEach((callback) => {
       callback.stop();
     });
   }
 }
 
 class ServerSocketListener {
   constructor() {