зеркало из 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");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
|
|
||||||
"resource://gre/modules/AsyncShutdown.jsm");
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Extension",
|
XPCOMUtils.defineLazyModuleGetter(this, "Extension",
|
||||||
"resource://gre/modules/Extension.jsm");
|
"resource://gre/modules/Extension.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionChild",
|
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionChild",
|
||||||
|
@ -208,28 +206,16 @@ class EmbeddedExtension {
|
||||||
*
|
*
|
||||||
* @returns {Promise<void>} a promise that is resolved when the shutdown has been done
|
* @returns {Promise<void>} a promise that is resolved when the shutdown has been done
|
||||||
*/
|
*/
|
||||||
shutdown(reason) {
|
async shutdown(reason) {
|
||||||
EmbeddedExtensionManager.untrackEmbeddedExtension(this);
|
EmbeddedExtensionManager.untrackEmbeddedExtension(this);
|
||||||
|
|
||||||
// If there is a pending startup, wait to be completed and then shutdown.
|
if (this.extension && !this.extension.hasShutdown) {
|
||||||
if (this.startupPromise) {
|
let {extension} = this;
|
||||||
let promise = this.startupPromise.then(() => {
|
this.extension = null;
|
||||||
return this.extension.shutdown(reason);
|
|
||||||
});
|
|
||||||
|
|
||||||
AsyncShutdown.profileChangeTeardown.addBlocker(
|
await extension.shutdown(reason);
|
||||||
`Legacy Extension Shutdown: ${this.addonId}`,
|
|
||||||
promise.catch(() => {}));
|
|
||||||
|
|
||||||
return promise;
|
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче