Bug 1446821: Add shutdown blocker for async extension uninstall tasks. r=mixedpuppy

MozReview-Commit-ID: AMHkqviDMoV

--HG--
extra : rebase_source : 2986a4e1e1c9deb3bc4ae38ef6fd703f273db61b
extra : amend_source : 5bb6ada7ff2e46ae5005ea8556dfd5f102c74e66
This commit is contained in:
Kris Maglione 2018-03-18 13:59:56 -07:00
parent 7780b45b3a
commit 883c7e5fce
3 changed files with 9 additions and 5 deletions

View File

@ -82,14 +82,16 @@ this.chrome_settings_overrides = class extends ExtensionAPI {
}
static removeSearchSettings(id) {
this.processDefaultSearchSetting("removeSetting", id);
this.removeEngine(id);
return Promise.all([
this.processDefaultSearchSetting("removeSetting", id),
this.removeEngine(id),
]);
}
static onUninstall(id) {
// Note: We do not have to deal with homepage here as it is managed by
// the ExtensionPreferencesManager.
this.removeSearchSettings(id);
return this.removeSearchSettings(id);
}
static onUpdate(id, manifest) {

View File

@ -1089,7 +1089,9 @@ const shutdownPromises = new Map();
class BootstrapScope {
install(data, reason) {}
uninstall(data, reason) {
Management.emit("uninstall", {id: data.id});
AsyncShutdown.profileChangeTeardown.addBlocker(
`Uninstalling add-on: ${data.id}`,
Management.emit("uninstall", {id: data.id}));
}
update(data, reason) {

View File

@ -102,7 +102,7 @@ let apiManager = new class extends SchemaAPIManager {
let modules = this.eventModules.get("uninstall");
return Promise.all(Array.from(modules).map(async apiName => {
let module = await this.asyncLoadModule(apiName);
module.onUninstall(id);
return module.onUninstall(id);
}));
});
/* eslint-enable mozilla/balanced-listeners */