Bug 830462 - Remove update.mar from sdcard when finished (or when starting a new download). r=rstrong

This commit is contained in:
Dave Hylands 2013-01-14 20:29:46 -08:00
Родитель 625d279602
Коммит dcdae37834
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -1001,6 +1001,15 @@ function cleanUpUpdatesDir(aBackgroundUpdate) {
// back to applying the update on application restart.
continue;
}
#ifdef MOZ_WIDGET_GONK
if (f.leafName == FILE_UPDATE_LINK) {
let linkedFile = getFileFromUpdateLink(updateDir);
if (linkedFile && linkedFile.exists()) {
linkedFile.remove(false);
}
}
#endif
// Now, recursively remove this file. The recursive removal is really
// only needed on Mac OSX because this directory will contain a copy of
// updater.app, which is itself a directory.
@ -3517,7 +3526,6 @@ Downloader.prototype = {
#ifdef MOZ_WIDGET_GONK
let status = readStatusFile(updateDir);
LOG("status read " + status);
if (isInterruptedUpdate(status)) {
LOG("Downloader:downloadUpdate - interruptted update");
// The update was interrupted. Try to locate the existing patch file.
@ -3572,11 +3580,18 @@ LOG("status read " + status);
return STATE_NONE;
}
#ifdef MOZ_WIDGET_GONK
if (patchFile.path.indexOf(updateDir.path) != 0) {
// The patchFile is in a directory which is different from the
// updateDir, create a link file.
writeLinkFile(updateDir, patchFile);
if (!isInterruptedUpdate(status) && patchFile.exists()) {
// Remove stale patchFile
patchFile.remove(false);
}
}
#endif
var uri = Services.io.newURI(this._patch.URL, null, null);