Bug 1868249 - Allow pending gecko results to be resolves when canceling an add-on installation. r=willdurand

Differential Revision: https://phabricator.services.mozilla.com/D196353
This commit is contained in:
Arturo Mejia 2024-02-04 18:23:43 +00:00
parent 7e4bfc3692
commit 26dd94a024

View File

@ -424,8 +424,15 @@ class ExtensionInstallListener {
try {
this.install.cancel();
cancelled = true;
} catch (_) {
} catch (ex) {
// install may have already failed or been cancelled
debug`Unable to cancel the install installId ${installId}, Error: ${ex}`;
// When we attempt to cancel an install but the cancellation fails for
// some reasons (e.g., because it is too late), we need to revert this
// boolean property to allow another cancellation to be possible.
// Otherwise, events like `onDownloadCancelled` won't resolve and that
// will cause problems in the embedder.
this.cancelling = false;
}
aCallback.onSuccess({ cancelled });
break;