Bug 404375: Recover from 'needs restart' message. r=robstrong, a=schrep
authordtownsend@oxymoronical.com
Mon, 03 Dec 2007 04:20:57 -0800
changeset 8583 be710ed5a5e3047ec565cab66a1db4e0c8ea2e98
parent 8582 ab01297b9531512f704f0947e59d13ee52ff12a2
child 8584 112a5e7f7607ab9eb9fbc6bf175df32abd11febb
push idunknown
push userunknown
push dateunknown
reviewersrobstrong, schrep
bugs404375
milestone1.9b2pre
Bug 404375: Recover from 'needs restart' message. r=robstrong, a=schrep
toolkit/mozapps/extensions/src/nsExtensionManager.js.in
--- a/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
+++ b/toolkit/mozapps/extensions/src/nsExtensionManager.js.in
@@ -3302,25 +3302,22 @@ ExtensionManager.prototype = {
         PendingOperations.clearItems(OP_NEEDS_DISABLE);
 
         // Look for extensions that need to be upgraded. The process here is to
         // uninstall the old version of the extension first, then install the
         // new version in its place.
         items = PendingOperations.getOperations(OP_NEEDS_UPGRADE);
         for (i = items.length - 1; i >= 0; --i) {
           id = items[i].id;
-          var oldLocation = this.getInstallLocation(id);
           var newLocation = InstallLocations.get(items[i].locationKey);
-          if (newLocation.priority <= oldLocation.priority) {
-            // check if there is updated app compatibility info
-            var newTargetAppInfo = ds.getUpdatedTargetAppInfo(id);
-            if (newTargetAppInfo)
-              updatedTargetAppInfos.push(newTargetAppInfo);
-            this._finalizeUpgrade(id);
-          }
+          // check if there is updated app compatibility info
+          var newTargetAppInfo = ds.getUpdatedTargetAppInfo(id);
+          if (newTargetAppInfo)
+            updatedTargetAppInfos.push(newTargetAppInfo);
+          this._finalizeUpgrade(id, newLocation);
         }
         PendingOperations.clearItems(OP_NEEDS_UPGRADE);
 
         // Install items
         items = PendingOperations.getOperations(OP_NEEDS_INSTALL);
         for (i = items.length - 1; i >= 0; --i) {
           needsRestart = true;
           id = items[i].id;
@@ -4620,21 +4617,22 @@ ExtensionManager.prototype = {
     StartupCache.put(installLocation, id, OP_NONE, true);
     PendingOperations.clearItem(OP_NEEDS_INSTALL, id);
   },
 
   /**
    * Removes an item's metadata in preparation for an upgrade-install.
    * @param   id
    *          The GUID of the item to uninstall.
-   */
-  _finalizeUpgrade: function(id) {
+   * @param   installLocation
+   *          The nsIInstallLocation of the item
+   */
+  _finalizeUpgrade: function(id, installLocation) {
     // Retrieve the item properties *BEFORE* we clean the resource!
     var ds = this.datasource;
-    var installLocation = this.getInstallLocation(id);
 
     var stagedFile = null;
     if ("getStageFile" in installLocation)
       stagedFile = installLocation.getStageFile(id);
 
     if (stagedFile)
       var installRDF = extractRDFFileToTempDir(stagedFile, FILE_INSTALL_MANIFEST, true);
     else