Bug 1045886 - Remove Cache directory from Android profiles. r=michal, a=lmandel
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 13 Aug 2014 16:43:45 +0300
changeset 208320 07eb5ce30325
parent 208319 7bb962c117df
child 208321 c444cb84a78b
push id3824
push userryanvm@gmail.com
push date2014-08-18 16:06 +0000
treeherdermozilla-beta@f595bdcdbd1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal, lmandel
bugs1045886
milestone32.0
Bug 1045886 - Remove Cache directory from Android profiles. r=michal, a=lmandel
browser/app/profile/firefox.js
modules/libpref/src/init/all.js
netwerk/cache2/CacheObserver.cpp
netwerk/cache2/CacheStorageService.cpp
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1595,18 +1595,16 @@ pref("identity.fxaccounts.settings.uri",
 // On GTK, we now default to showing the menubar only when alt is pressed:
 #ifdef MOZ_WIDGET_GTK
 pref("ui.key.menuAccessKeyFocuses", true);
 #endif
 
 // Encrypted media extensions.
 pref("media.eme.enabled", false);
 
-// Delete HTTP cache v2 data of users that didn't opt-in manually
-pref("browser.cache.auto_delete_cache_version", 1);
 // Play with different values of the decay time and get telemetry,
 // 0 means to randomize (and persist) the experiment value in users' profiles,
 // -1 means no experiment is run and we use the preferred value for frecency (6h)
 pref("browser.cache.frecency_experiment", 0);
 
 pref("browser.translation.detectLanguage", false);
 pref("browser.translation.neverForLanguages", "");
 // Show the translation UI bits, like the info bar, notification icon and preferences.
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -29,16 +29,18 @@ pref("general.useragent.site_specific_ov
 
 pref("general.config.obscure_value", 13); // for MCD .cfg files
 
 pref("general.warnOnAboutConfig", true);
 
 // maximum number of dated backups to keep at any time
 pref("browser.bookmarks.max_backups",       5);
 
+// Delete HTTP cache v1 data
+pref("browser.cache.auto_delete_cache_version", 0);
 // Preference for switching the cache backend, can be changed freely at runtime
 // 0 - use the old (Darin's) cache
 // 1 - use the new cache back-end (cache v2)
 pref("browser.cache.use_new_backend",       0);
 pref("browser.cache.use_new_backend_temp",  true);
 
 pref("browser.cache.disk.enable",           true);
 // Is this the first-time smartsizing has been introduced?
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -91,17 +91,17 @@ CacheObserver::Init()
     return NS_ERROR_UNEXPECTED;
   }
 
   sSelf = new CacheObserver();
   NS_ADDREF(sSelf);
 
   obs->AddObserver(sSelf, "prefservice:after-app-defaults", true);
   obs->AddObserver(sSelf, "profile-do-change", true);
-  obs->AddObserver(sSelf, "sessionstore-windows-restored", true);
+  obs->AddObserver(sSelf, "browser-delayed-startup-finished", true);
   obs->AddObserver(sSelf, "profile-before-change", true);
   obs->AddObserver(sSelf, "xpcom-shutdown", true);
   obs->AddObserver(sSelf, "last-pb-context-exited", true);
   obs->AddObserver(sSelf, "webapps-clear-data", true);
   obs->AddObserver(sSelf, "memory-pressure", true);
 
   return NS_OK;
 }
@@ -423,17 +423,17 @@ CacheObserver::Observe(nsISupports* aSub
 
   if (!strcmp(aTopic, "profile-do-change")) {
     AttachToPreferences();
     CacheFileIOManager::Init();
     CacheFileIOManager::OnProfile();
     return NS_OK;
   }
 
-  if (!strcmp(aTopic, "sessionstore-windows-restored")) {
+  if (!strcmp(aTopic, "browser-delayed-startup-finished")) {
     uint32_t activeVersion = UseNewCache() ? 1 : 0;
     CacheStorageService::CleaupCacheDirectories(sAutoDeleteCacheVersion, activeVersion);
     return NS_OK;
   }
 
   if (!strcmp(aTopic, "profile-before-change")) {
     nsRefPtr<CacheStorageService> service = CacheStorageService::Self();
     if (service)
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -589,16 +589,17 @@ NS_IMETHODIMP CleaupCacheDirectoriesRunn
   if (mCache1Dir) {
     nsDeleteDir::RemoveOldTrashes(mCache1Dir);
   }
   if (mCache2Dir) {
     nsDeleteDir::RemoveOldTrashes(mCache2Dir);
   }
 #if defined(MOZ_WIDGET_ANDROID)
   if (mCache2Profileless) {
+    nsDeleteDir::RemoveOldTrashes(mCache2Profileless);
     // Always delete the profileless cache on Android
     nsDeleteDir::DeleteDir(mCache2Profileless, true, 30000);
   }
 #endif
 
   // Delete the non-active version cache data right now
   if (mVersion == mActive) {
     return NS_OK;