Bug 754671 - Follow-up to rename old thumbnail folder instead of removing it; r=felipe
authorTim Taubert <ttaubert@mozilla.com>
Tue, 21 Aug 2012 17:02:33 -0700
changeset 105042 8e30c456cb6e268748013d1dc81f8e1dac3e2fd8
parent 105041 327883b4f2fe04f20f7ab0d1f0cd3603d85307d2
child 105043 df17d6a5a330a812091bfb6754cacdceebaf90a8
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersfelipe
bugs754671
milestone17.0a1
Bug 754671 - Follow-up to rename old thumbnail folder instead of removing it; r=felipe
browser/components/thumbnails/PageThumbs.jsm
--- a/browser/components/thumbnails/PageThumbs.jsm
+++ b/browser/components/thumbnails/PageThumbs.jsm
@@ -363,17 +363,17 @@ let PageThumbsStorageMigrator = {
 
   migrate: function Migrator_migrate() {
     let version = this.currentVersion;
 
     if (version < 1) {
       this.removeThumbnailsFromRoamingProfile();
     }
     if (version < 2) {
-      this.clearThumbnailsFolder();
+      this.renameThumbnailsFolder();
     }
 
     this.currentVersion = LATEST_STORAGE_VERSION;
   },
 
   removeThumbnailsFromRoamingProfile:
   function Migrator_removeThumbnailsFromRoamingProfile() {
     let local = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY]);
@@ -384,23 +384,22 @@ let PageThumbsStorageMigrator = {
       try {
         roaming.remove(true);
       } catch (e) {
         // The directory might not exist or we're not permitted to remove it.
       }
     }
   },
 
-  clearThumbnailsFolder: function Migrator_clearThumbnailsFolder() {
+  renameThumbnailsFolder: function Migrator_renameThumbnailsFolder() {
     let dir = FileUtils.getDir("ProfLD", [THUMBNAIL_DIRECTORY]);
-    dir.followLinks = false;
     try {
-      dir.remove(true);
+      dir.moveTo(null, dir.leafName + "-old");
     } catch (e) {
-      // The directory might not exist or we're not permitted to remove it.
+      // The directory might not exist or we're not permitted to rename it.
     }
   }
 };
 
 let PageThumbsExpiration = {
   _filters: [],
 
   init: function Expiration_init() {