Bug 1392872 - Fix missing startup/shutdown reason in LegacyExtensionsUtils. r=aswan
☠☠ backed out by 3a2eca3f9339 ☠ ☠
authorLuca Greco <lgreco@mozilla.com>
Wed, 23 Aug 2017 15:43:09 +0200
changeset 376637 aa772cbe4a8ea772c24205140920fa030d3a5a9f
parent 376636 8fa30f1a3f4dab69c3b5defe7dc137823f636b22
child 376638 65785385763b8adf4bb9e17f2c5f259a3388a040
push id94144
push userryanvm@gmail.com
push dateFri, 25 Aug 2017 00:21:50 +0000
treeherdermozilla-inbound@942d868646cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1392872
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1392872 - Fix missing startup/shutdown reason in LegacyExtensionsUtils. r=aswan MozReview-Commit-ID: K8pyxR7Vhpl
toolkit/components/extensions/LegacyExtensionsUtils.jsm
--- a/toolkit/components/extensions/LegacyExtensionsUtils.jsm
+++ b/toolkit/components/extensions/LegacyExtensionsUtils.jsm
@@ -126,17 +126,17 @@ class EmbeddedExtension {
   }
 
   /**
    * Start the embedded webextension.
    *
    * @returns {Promise<LegacyContextAPI>} A promise which resolve to the API exposed to the
    *   legacy context.
    */
-  startup() {
+  startup(reason) {
     if (this.started) {
       return Promise.reject(new Error("This embedded extension has already been started"));
     }
 
     // Setup the startup promise.
     this.startupPromise = new Promise((resolve, reject) => {
       let embeddedExtensionURI = Services.io.newURI("webextension/", null, this.resourceURI);
 
@@ -180,52 +180,52 @@ class EmbeddedExtension {
         // chained to it.
         resolve(this.context.api);
       };
 
       this.extension.on("startup", onBeforeStarted);
 
       // Run ambedded extension startup and catch any error during embedded extension
       // startup.
-      this.extension.startup().catch((err) => {
+      this.extension.startup(reason).catch((err) => {
         this.started = false;
         this.startupPromise = null;
         this.extension.off("startup", onBeforeStarted);
 
         reject(err);
       });
     });
 
     return this.startupPromise;
   }
 
   /**
    * Shuts down the embedded webextension.
    *
    * @returns {Promise<void>} a promise that is resolved when the shutdown has been done
    */
-  shutdown() {
+  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();
+        return this.extension.shutdown(reason);
       });
 
       AsyncShutdown.profileChangeTeardown.addBlocker(
         `Legacy Extension Shutdown: ${this.addonId}`,
         promise.catch(() => {}));
 
       return promise;
     }
 
     // Run shutdown now if the embedded webextension has been correctly started
     if (this.extension && this.started && !this.extension.hasShutdown) {
-      this.extension.shutdown();
+      this.extension.shutdown(reason);
     }
 
     return Promise.resolve();
   }
 }
 
 // Keep track on the created EmbeddedExtension instances and destroy
 // them when their container addon is going to be disabled or uninstalled.