diff --git a/toolkit/components/jsdownloads/test/unit/head.js b/toolkit/components/jsdownloads/test/unit/head.js index 64a330db6e3..6fb88964c43 100644 --- a/toolkit/components/jsdownloads/test/unit/head.js +++ b/toolkit/components/jsdownloads/test/unit/head.js @@ -683,6 +683,14 @@ add_task(function test_common_initialize() gHttpServer = new HttpServer(); gHttpServer.registerDirectory("/", do_get_file("../data")); gHttpServer.start(-1); + do_register_cleanup(() => { + return new Promise(resolve => { + // Ensure all the pending HTTP requests have a chance to finish. + continueResponses(); + // Stop the HTTP server, calling resolve when it's done. + gHttpServer.stop(resolve); + }); + }); // Cache locks might prevent concurrent requests to the same resource, and // this may block tests that use the interruptible handlers. diff --git a/toolkit/components/jsdownloads/test/unit/tail.js b/toolkit/components/jsdownloads/test/unit/tail.js deleted file mode 100644 index b34fc79bc32..00000000000 --- a/toolkit/components/jsdownloads/test/unit/tail.js +++ /dev/null @@ -1,25 +0,0 @@ -/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/** - * Provides infrastructure for automated download components tests. - */ - -"use strict"; - -//////////////////////////////////////////////////////////////////////////////// -//// Termination functions common to all tests - -add_task(function* test_common_terminate() -{ - // Ensure all the pending HTTP requests have a chance to finish. - continueResponses(); - - // Stop the HTTP server. We must do this inside a task in "tail.js" until the - // xpcshell testing framework supports asynchronous termination functions. - let deferred = Promise.defer(); - gHttpServer.stop(deferred.resolve); - yield deferred.promise; -}); diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js b/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js index f5290b3fede..e86a83dd982 100644 --- a/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js +++ b/toolkit/components/jsdownloads/test/unit/test_DownloadCore.js @@ -87,9 +87,3 @@ add_task(function test_DownloadError() do_check_true(error.becauseBlocked); do_check_true(error.becauseBlockedByParentalControls); }); - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadIntegration.js b/toolkit/components/jsdownloads/test/unit/test_DownloadIntegration.js index 6e8a51d5e96..316407a81ee 100644 --- a/toolkit/components/jsdownloads/test/unit/test_DownloadIntegration.js +++ b/toolkit/components/jsdownloads/test/unit/test_DownloadIntegration.js @@ -415,9 +415,3 @@ add_task(function* test_exit_private_browsing() continueResponses(); }); - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadLegacy.js b/toolkit/components/jsdownloads/test/unit/test_DownloadLegacy.js index 101fa8cb06c..3a68eb8c45c 100644 --- a/toolkit/components/jsdownloads/test/unit/test_DownloadLegacy.js +++ b/toolkit/components/jsdownloads/test/unit/test_DownloadLegacy.js @@ -16,9 +16,3 @@ var gUseLegacySaver = true; var scriptFile = do_get_file("common_test_Download.js"); Services.scriptloader.loadSubScript(NetUtil.newURI(scriptFile).spec); - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadList.js b/toolkit/components/jsdownloads/test/unit/test_DownloadList.js index 550ce7eda90..dfb97b6f45b 100644 --- a/toolkit/components/jsdownloads/test/unit/test_DownloadList.js +++ b/toolkit/components/jsdownloads/test/unit/test_DownloadList.js @@ -564,9 +564,3 @@ add_task(function* test_DownloadSummary_notifications() yield download.start(); do_check_true(receivedOnSummaryChanged); }); - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); diff --git a/toolkit/components/jsdownloads/test/unit/test_DownloadStore.js b/toolkit/components/jsdownloads/test/unit/test_DownloadStore.js index fc2df08e452..f2a44c19ca6 100644 --- a/toolkit/components/jsdownloads/test/unit/test_DownloadStore.js +++ b/toolkit/components/jsdownloads/test/unit/test_DownloadStore.js @@ -305,9 +305,3 @@ add_task(function* test_save_reload_unknownProperties() do_check_eq(itemsForLoad[2].saver._unknownProperties.saver2, "download3saver2"); }); - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); diff --git a/toolkit/components/jsdownloads/test/unit/test_Downloads.js b/toolkit/components/jsdownloads/test/unit/test_Downloads.js index ce153479889..507950355c3 100644 --- a/toolkit/components/jsdownloads/test/unit/test_Downloads.js +++ b/toolkit/components/jsdownloads/test/unit/test_Downloads.js @@ -193,9 +193,3 @@ add_task(function* test_getTemporaryDownloadsDirectory() let downloadDir = yield Downloads.getTemporaryDownloadsDirectory(); do_check_neq(downloadDir, ""); }); - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); diff --git a/toolkit/components/jsdownloads/test/unit/test_PrivateTemp.js b/toolkit/components/jsdownloads/test/unit/test_PrivateTemp.js index ca8fd4df1fb..138be8d2991 100644 --- a/toolkit/components/jsdownloads/test/unit/test_PrivateTemp.js +++ b/toolkit/components/jsdownloads/test/unit/test_PrivateTemp.js @@ -22,11 +22,3 @@ add_task(function* test_private_temp() { // 488 is the decimal value of 0700. equal(targetFile.parent.permissions, 448); }); - - -//////////////////////////////////////////////////////////////////////////////// -//// Termination - -var tailFile = do_get_file("tail.js"); -Services.scriptloader.loadSubScript(NetUtil.newURI(tailFile).spec); - diff --git a/toolkit/components/jsdownloads/test/unit/xpcshell.ini b/toolkit/components/jsdownloads/test/unit/xpcshell.ini index b7ee9d44fc6..60d4fa7407d 100644 --- a/toolkit/components/jsdownloads/test/unit/xpcshell.ini +++ b/toolkit/components/jsdownloads/test/unit/xpcshell.ini @@ -7,7 +7,6 @@ skip-if = toolkit == 'android' || toolkit == 'gonk' # the "add_test_task" function, that does not work properly in tail files. support-files = common_test_Download.js - tail.js [test_DownloadCore.js] [test_DownloadImport.js]