зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1010277 - Fixed uncaught async error in test_DownloadImport.js. r=paolo
This commit is contained in:
Родитель
d265e4d588
Коммит
3f3ee01fa0
|
@ -466,31 +466,6 @@ function promiseStartExternalHelperAppServiceDownload(aSourceUrl) {
|
|||
return deferred.promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for a download to finish, in case it has not finished already.
|
||||
*
|
||||
* @param aDownload
|
||||
* The Download object to wait upon.
|
||||
*
|
||||
* @return {Promise}
|
||||
* @resolves When the download has finished successfully.
|
||||
* @rejects JavaScript exception if the download failed.
|
||||
*/
|
||||
function promiseDownloadStopped(aDownload) {
|
||||
if (!aDownload.stopped) {
|
||||
// The download is in progress, wait for the current attempt to finish and
|
||||
// report any errors that may occur.
|
||||
return aDownload.start();
|
||||
}
|
||||
|
||||
if (aDownload.succeeded) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
// The download failed or was canceled.
|
||||
return Promise.reject(aDownload.error || new Error("Download canceled."));
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for a download to reach half of its progress, in case it has not
|
||||
* reached the expected progress already.
|
||||
|
@ -827,6 +802,10 @@ add_task(function test_common_initialize()
|
|||
DownloadIntegration._deferTestOpenFile = Promise.defer();
|
||||
DownloadIntegration._deferTestShowDir = Promise.defer();
|
||||
|
||||
// Avoid leaking uncaught promise errors
|
||||
DownloadIntegration._deferTestOpenFile.promise.then(null, () => undefined);
|
||||
DownloadIntegration._deferTestShowDir.promise.then(null, () => undefined);
|
||||
|
||||
// Get a reference to nsIComponentRegistrar, and ensure that is is freed
|
||||
// before the XPCOM shutdown.
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
|
|
Загрузка…
Ссылка в новой задаче