Bug 1434076 Correct calls to getAPI() on wrong api manager draft
authorAndrew Swan <aswan@mozilla.com>
Thu, 22 Feb 2018 12:20:34 -0800
changeset 761057 988c7d6a811d72a5a6ab88cf284a45e725c51fb0
parent 758497 5e9bd04333f20e00911b8c1dfbf2b2e070c61e2d
push id100838
push useraswan@mozilla.com
push dateWed, 28 Feb 2018 16:24:01 +0000
bugs1434076
milestone60.0a1
Bug 1434076 Correct calls to getAPI() on wrong api manager MozReview-Commit-ID: ADrV9x8gXhc
toolkit/components/extensions/ExtensionCommon.jsm
--- 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.