Bug 1380267: Fix shutdown blocker corner cases. r=aswan

MozReview-Commit-ID: 8Dgvnm96hgT

--HG--
extra : rebase_source : c5cd4f096bf85af2ff098182037fff36a479bada
This commit is contained in:
Kris Maglione 2017-07-12 16:58:15 -07:00
Родитель aea79443fa
Коммит 8d6640a18f
2 изменённых файлов: 16 добавлений и 6 удалений

Просмотреть файл

@ -982,7 +982,7 @@ this.Extension = class extends ExtensionData {
resolve();
}
};
ppmm.addMessageListener(msg + "Complete", listener);
ppmm.addMessageListener(msg + "Complete", listener, true);
Services.obs.addObserver(observer, "message-manager-close");
Services.obs.addObserver(observer, "message-manager-disconnect");
@ -1198,6 +1198,14 @@ this.Extension = class extends ExtensionData {
`Extension Shutdown: ${this.id} (${this.manifest && this.name})`,
promise.catch(() => {}));
// If we already have a shutdown promise for this extension, wait
// for it to complete before replacing it with a new one. This can
// sometimes happen during tests with rapid startup/shutdown cycles
// of multiple versions.
if (shutdownPromises.has(this.id)) {
await shutdownPromises.get(this.id);
}
let cleanup = () => {
shutdownPromises.delete(this.id);
};

Просмотреть файл

@ -343,12 +343,14 @@ ExtensionManager = {
case "Extension:Shutdown": {
let policy = WebExtensionPolicy.getByID(data.id);
if (extensions.has(policy)) {
extensions.get(policy).shutdown();
}
if (policy) {
if (extensions.has(policy)) {
extensions.get(policy).shutdown();
}
if (isContentProcess) {
policy.active = false;
if (isContentProcess) {
policy.active = false;
}
}
Services.cpmm.sendAsyncMessage("Extension:ShutdownComplete");
break;