Bug 1519184: Fix cache purging on windows. r=Gijs
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 10 Jan 2019 20:10:04 +0000
changeset 513320 f747aad08cbc
parent 513319 3994da3447c3
child 513321 8d953c25fdef
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1519184
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1519184: Fix cache purging on windows. r=Gijs When Firefox runs we cache a number of things, JS, XUL, XBL, CSS etc. Whenever a new build of Firefox runs against a profile we clear the cache to rebuild with the new information. On the first run of a profile where compatibility.ini doesn't exist (presumably to cover the case of upgrading from a very old versions of Firefox, but also affects new profiles) we attempt to clear the cache as well. If any attempt to clear the cache fails we set a flag in compatibility.ini telling us to clear the cache on next startup. Unfortunately nsIFile.remove returns different error codes on different platforms when the file in question already doesn't exist. So an attempt to remove a cache that does't exist is counted as a failure on Windows and so the cache will be cleared again on second run. This change counts the file not found return code as counting as a success when clearing the cache. Differential Revision: https://phabricator.services.mozilla.com/D16224
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -2652,17 +2652,18 @@ static bool RemoveComponentRegistries(ns
   file->AppendNative(NS_LITERAL_CSTRING("XUL" PLATFORM_FASL_SUFFIX));
   file->Remove(false);
 
   file->SetNativeLeafName(NS_LITERAL_CSTRING("XPC" PLATFORM_FASL_SUFFIX));
   file->Remove(false);
 
   file->SetNativeLeafName(NS_LITERAL_CSTRING("startupCache"));
   nsresult rv = file->Remove(true);
-  return NS_SUCCEEDED(rv) || rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
+  return NS_SUCCEEDED(rv) || rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ||
+         rv == NS_ERROR_FILE_NOT_FOUND;
 }
 
 // To support application initiated restart via nsIAppStartup.quit, we
 // need to save various environment variables, and then restore them
 // before re-launching the application.
 
 static struct SavedVar {
   const char* name;