Bug 1119593 - Re-enable per-data-channel close, r=drno
authorMartin Thomson <martin.thomson@gmail.com>
Wed, 28 Jan 2015 14:05:57 -0800
changeset 226571 1c44eb512e3f628774f04553ec22c4370a695739
parent 226570 d7d594b9476811939e6e69a8e7757fb31838fd92
child 226572 75f409f3a7b1bf16faf3e8c4b25ca0419c4f10a1
push id28200
push userkwierso@gmail.com
push dateThu, 29 Jan 2015 23:01:46 +0000
treeherdermozilla-central@4380ed39de3a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno
bugs1119593
milestone38.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 1119593 - Re-enable per-data-channel close, r=drno
dom/media/tests/mochitest/pc.js
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -350,35 +350,21 @@ PeerConnectionTest.prototype.closePC = f
     closeIt(this.pcRemote)
   ]), 60000, "failed to close peer connection");
 };
 
 /**
  * Close the open data channels, followed by the underlying peer connection
  */
 PeerConnectionTest.prototype.close = function() {
-
-  // TODO: Bug 1118398 - We should try to close data channels first here.
-  // return timerGuard(
-  //var allChannels = this.pcLocal ? this.pcLocal.dataChannels :
-  //    this.pcRemote.dataChannels;
-  //Promise.all(allChannels.map((channel, i) => this.closeDataChannels(i))),
-  //  60000, "failed to close data channels")
-  // .then(() => this.closePC());
-
-  var expectOnClose = channel =>
-      (channel.onclose = () => info(channel + " closed"));
-  if (this.pcLocal) {
-    this.pcLocal.dataChannels.forEach(expectOnClose);
-  }
-  if (this.pcRemote) {
-    this.pcRemote.dataChannels.forEach(expectOnClose);
-  }
-
-  return this.closePC();
+  var allChannels = (this.pcLocal ? this.pcLocal : this.pcRemote).dataChannels;
+  return timerGuard(
+    Promise.all(allChannels.map((channel, i) => this.closeDataChannels(i))),
+    60000, "failed to close data channels")
+    .then(() => this.closePC());
 };
 
 /**
  * Close the specified data channels
  *
  * @param {Number} index
  *        Index of the data channels to close on both sides
  */