Bug 1268077: Fix up MockInstall AddonListener events r?rhelmer draft
authorAndrew Swan <aswan@mozilla.com>
Thu, 02 Jun 2016 11:16:07 -0700
changeset 374516 0ce9bb45bb3d30cc8781260e5265c03cc9c945f2
parent 373935 111970c738234569c8c180319155327316335deb
child 374517 2e3eeee421d2eb57565f4b2a8a7288b74faf6d6b
child 374695 68c8c26caf6d8a10961990128134fc9b770f9fe3
push id20050
push useraswan@mozilla.com
push dateThu, 02 Jun 2016 18:19:38 +0000
reviewersrhelmer
bugs1268077
milestone49.0a1
Bug 1268077: Fix up MockInstall AddonListener events r?rhelmer MozReview-Commit-ID: JDStiM2GZIu
toolkit/mozapps/extensions/test/browser/head.js
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1336,17 +1336,21 @@ MockInstall.prototype = {
       case AddonManager.STATE_DOWNLOADED:
         this.state = AddonManager.STATE_INSTALLING;
         if (!this.callListeners("onInstallStarted")) {
           this.state = AddonManager.STATE_CANCELLED;
           this.callListeners("onInstallCancelled");
           return;
         }
 
-        AddonManagerPrivate.callAddonListeners("onInstalling", this.addon);
+        let needsRestart = (this.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_INSTALL);
+        AddonManagerPrivate.callAddonListeners("onInstalling", this.addon, needsRestart);
+        if (!needsRestart) {
+          AddonManagerPrivate.callAddonListeners("onInstalled", this.addon);
+        }
 
         this.state = AddonManager.STATE_INSTALLED;
         this.callListeners("onInstallEnded");
         break;
       case AddonManager.STATE_DOWNLOADING:
       case AddonManager.STATE_CHECKING:
       case AddonManager.STATE_INSTALLING:
         // Installation is already running