Bug 1434076 Correct calls to getAPI() on wrong api manager
MozReview-Commit-ID: ADrV9x8gXhc
--- a/toolkit/components/extensions/ExtensionCommon.jsm
+++ b/toolkit/components/extensions/ExtensionCommon.jsm
@@ -997,17 +997,17 @@ class SchemaAPIManager extends EventEmit
this.apis = new DefaultWeakMap(() => new Map());
this._scriptScopes = [];
}
onStartup(extension) {
let promises = [];
for (let apiName of this.eventModules.get("startup")) {
- promises.push(this.asyncGetAPI(apiName, extension).then(api => {
+ promises.push(extension.apiManager.asyncGetAPI(apiName, extension).then(api => {
if (api) {
api.onStartup();
}
}));
}
return Promise.all(promises);
}
@@ -1105,17 +1105,17 @@ class SchemaAPIManager extends EventEmit
* @param {string} entry
* The name of the top-level manifest entry.
*
* @returns {*}
*/
emitManifestEntry(extension, entry) {
let apiName = this.manifestKeys.get(entry);
if (apiName) {
- let api = this.getAPI(apiName, extension);
+ let api = extension.apiManager.getAPI(apiName, extension);
return api.onManifestEntry(entry);
}
}
/**
* Emits an `onManifestEntry` event for the top-level manifest entry
* on all relevant {@link ExtensionAPI} instances for the given
* extension.
*
@@ -1127,17 +1127,17 @@ class SchemaAPIManager extends EventEmit
* @param {string} entry
* The name of the top-level manifest entry.
*
* @returns {Promise<*>}
*/
async asyncEmitManifestEntry(extension, entry) {
let apiName = this.manifestKeys.get(entry);
if (apiName) {
- let api = await this.asyncGetAPI(apiName, extension);
+ let api = await extension.apiManager.asyncGetAPI(apiName, extension);
return api.onManifestEntry(entry);
}
}
/**
* Returns the {@link ExtensionAPI} instance for the given API module,
* for the given extension, in the given scope, synchronously loading
* and instantiating it if necessary.