зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1392653: Remove redundant LegacyExtensionUtils shutdown blocker. r=aswan
The base Extension class now handles adding shutdown blockers and waiting for extension startup before beginning shutdown, so the redundant logic only causes problems. MozReview-Commit-ID: 2gBWlmIs1KQ --HG-- extra : rebase_source : 404174754735b8477abf6f13d312bc6b3aebdb83
This commit is contained in:
Родитель
54d232094f
Коммит
620fec28ff
|
@ -17,8 +17,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
|||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
|
||||
"resource://gre/modules/AsyncShutdown.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Extension",
|
||||
"resource://gre/modules/Extension.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionChild",
|
||||
|
@ -208,28 +206,16 @@ class EmbeddedExtension {
|
|||
*
|
||||
* @returns {Promise<void>} a promise that is resolved when the shutdown has been done
|
||||
*/
|
||||
shutdown(reason) {
|
||||
async shutdown(reason) {
|
||||
EmbeddedExtensionManager.untrackEmbeddedExtension(this);
|
||||
|
||||
// If there is a pending startup, wait to be completed and then shutdown.
|
||||
if (this.startupPromise) {
|
||||
let promise = this.startupPromise.then(() => {
|
||||
return this.extension.shutdown(reason);
|
||||
});
|
||||
if (this.extension && !this.extension.hasShutdown) {
|
||||
let {extension} = this;
|
||||
this.extension = null;
|
||||
|
||||
AsyncShutdown.profileChangeTeardown.addBlocker(
|
||||
`Legacy Extension Shutdown: ${this.addonId}`,
|
||||
promise.catch(() => {}));
|
||||
|
||||
return promise;
|
||||
await extension.shutdown(reason);
|
||||
}
|
||||
|
||||
// Run shutdown now if the embedded webextension has been correctly started
|
||||
if (this.extension && this.started && !this.extension.hasShutdown) {
|
||||
this.extension.shutdown(reason);
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче