B2G/gecko/toolkit/mozapps/extensions/XPIProvider.jsm
/**
   * Notify listeners that the download completed.
   */
Notify listeners that the download completed.
Notify listeners that the download completed .
function AI_downloadCompleted() {
    let self = this;
    XPIDatabase.getVisibleAddonForID(this.addon.id, function downloadCompleted_getVisibleAddonForID(aAddon) {
      if (aAddon)
        self.existingAddon = aAddon;
      self.state = AddonManager.STATE_DOWNLOADED;
      self.addon.updateDate = Date.now();
      if (self.existingAddon) {
        self.addon.existingAddonID = self.existingAddon.id;
        self.addon.installDate = self.existingAddon.installDate;
        applyBlocklistChanges(self.existingAddon, self.addon);
      }
      else {
        self.addon.installDate = self.addon.updateDate;
      }
      if (AddonManagerPrivate.callInstallListeners("onDownloadEnded",
                                                   self.listeners,
                                                   self.wrapper)) {
        if (self.state != AddonManager.STATE_DOWNLOADED)
          return;
        self.install();
        if (self.linkedInstalls) {
          self.linkedInstalls.forEach(function(aInstall) {
            aInstall.install();
          });
        }
      }
    });
  }
function AI_downloadCompleted ( ) { let self = this ; XPIDatabase . getVisibleAddonForID ( this . addon . id , function downloadCompleted_getVisibleAddonForID ( aAddon ) { if ( aAddon ) self . existingAddon = aAddon ; self . state = AddonManager . STATE_DOWNLOADED ; self . addon . updateDate = Date . now ( ) ; if ( self . existingAddon ) { self . addon . existingAddonID = self . existingAddon . id ; self . addon . installDate = self . existingAddon . installDate ; applyBlocklistChanges ( self . existingAddon , self . addon ) ; } else { self . addon . installDate = self . addon . updateDate ; } if ( AddonManagerPrivate . callInstallListeners ( "onDownloadEnded" , self . listeners , self . wrapper ) ) { if ( self . state != AddonManager . STATE_DOWNLOADED ) return ; self . install ( ) ; if ( self . linkedInstalls ) { self . linkedInstalls . forEach ( function ( aInstall ) { aInstall . install ( ) ; } ) ; } } } ) ; }
Notify listeners that the download completed.
Notify listeners that the download completed .
// If a listener changed our state then do not proceed with the install