bug 1324952 - don't asyncWait on the input stream if we've been stopped in test_be_conservative.js r=mcmanus
authorDavid Keeler <dkeeler@mozilla.com>
Mon, 06 Feb 2017 15:02:01 -0800
changeset 341285 f75e82667af1d6fc69e1118fce5540fd9c7498ef
parent 341284 051a2419f86ed42ae5966b78b9a6559cef8f43ea
child 341286 d231c4f1e2658737daad5d8b858131f78cb4493f
push id86684
push usercbook@mozilla.com
push dateWed, 08 Feb 2017 10:31:03 +0000
treeherdermozilla-inbound@c5b88e4e70f4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus
bugs1324952
milestone54.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 1324952 - don't asyncWait on the input stream if we've been stopped in test_be_conservative.js r=mcmanus 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() {