Bug 1344589 - Wait for the httpServer to shutdown in head_search.js to avoid reported leaks. r=adw
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 09 Mar 2017 00:18:35 -0500
changeset 346873 4aa128f4b262917b813d35088ef9fd9621f5cfdf
parent 346872 1b2d90a65aecd38969c6b820374fdb785ce8bec3
child 346874 281614c5ea9f61d6a02dabc9e7357b2d83f60db1
push id31480
push usercbook@mozilla.com
push dateFri, 10 Mar 2017 10:37:06 +0000
treeherdermozilla-central@e18d3dd20e8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1344589
milestone55.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 1344589 - Wait for the httpServer to shutdown in head_search.js to avoid reported leaks. r=adw The test slow_timeout in test_searchSuggest.js was keeping a request open for 10s so the server wouldn't stop immediately. MozReview-Commit-ID: EGFPRKMNa51
toolkit/components/search/tests/xpcshell/head_search.js
--- a/toolkit/components/search/tests/xpcshell/head_search.js
+++ b/toolkit/components/search/tests/xpcshell/head_search.js
@@ -343,17 +343,21 @@ var gDataUrl;
  *
  * @return The HttpServer object in case further customization is needed.
  */
 function useHttpServer() {
   let httpServer = new HttpServer();
   httpServer.start(-1);
   httpServer.registerDirectory("/", do_get_cwd());
   gDataUrl = "http://localhost:" + httpServer.identity.primaryPort + "/data/";
-  do_register_cleanup(() => httpServer.stop(() => {}));
+  do_register_cleanup(function* cleanup_httpServer() {
+    yield new Promise(resolve => {
+      httpServer.stop(resolve);
+    });
+  });
   return httpServer;
 }
 
 /**
  * Adds test engines and returns a promise resolved when they are installed.
  *
  * The engines are added in the given order.
  *