From 14e077ce86fa384a5f175cf76ed24bec594dddf5 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 14 Jun 2012 09:21:13 -0400 Subject: [PATCH] Bug 760577 - Part 1: Keep the update files around when an update has been staged; r=rstrong --- toolkit/mozapps/update/nsUpdateService.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js index e630aefc969..e2d7c874cda 100644 --- a/toolkit/mozapps/update/nsUpdateService.js +++ b/toolkit/mozapps/update/nsUpdateService.js @@ -769,18 +769,22 @@ function cleanUpUpdatesDir(aBackgroundUpdate) { } } f.moveTo(dir, FILE_LAST_LOG); - continue; + if (aBackgroundUpdate) { + // We're not going to delete any files, so we can just + // bail out of the loop right now. + break; + } else { + continue; + } } catch (e) { LOG("cleanUpUpdatesDir - failed to move file " + f.path + " to " + dir.path + " and rename it to " + FILE_LAST_LOG); } - } else if (f.leafName == FILE_UPDATE_STATUS && aBackgroundUpdate) { - // Leave the update.status file alone when a background update - // has been performed. We don't remove this file here because - // after the application directory gets replaced by the staged - // update, this will end up being the update.status file which - // represents the status of the update performed. + } else if (aBackgroundUpdate) { + // Don't delete any files when an update has been staged, as + // we need to keep them around in case we would have to fall + // back to applying the update on application restart. continue; } // Now, recursively remove this file. The recursive removal is really