author | Ehsan Akhgari <ehsan@mozilla.com> |
Wed, 31 Oct 2012 11:28:21 -0400 | |
changeset 111934 | 3f4fef3ca7e9d7dec3db20a1007a651de6d478e1 |
parent 111933 | de38abf9266ebddeb5ff5cf99e0f9bdc62aca3ae |
child 111935 | fcaa13a3a48e26eeedc7232fa558eed941174fad |
push id | 23783 |
push user | emorley@mozilla.com |
push date | Thu, 01 Nov 2012 13:43:27 +0000 |
treeherder | mozilla-central@71b2ea41dff7 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
bugs | 724513 |
milestone | 19.0a1 |
backs out | 006eb98e9d6f309947516d4edc840281263c64e9 f418d97d12ac237f45e0bbae239f82b086d8fdff 1baac3f2334c5516cfa56ce944eafa4cec3e6356 |
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
|
--- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -117,17 +117,16 @@ StartupCache::InitSingleton() delete StartupCache::gStartupCache; StartupCache::gStartupCache = nullptr; } return rv; } StartupCache* StartupCache::gStartupCache; bool StartupCache::gShutdownInitiated; -bool StartupCache::gIgnoreDiskCache; enum StartupCache::TelemetrifyAge StartupCache::gPostFlushAgeAction = StartupCache::IGNORE_AGE; StartupCache::StartupCache() : mArchive(NULL), mStartupWriteInitiated(false), mWriteThread(NULL), mMappingMemoryReporter(nullptr), mDataMemoryReporter(nullptr) { } StartupCache::~StartupCache() { @@ -199,22 +198,22 @@ StartupCache::Init() mListener = new StartupCacheListener(); rv = mObserverService->AddObserver(mListener, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false); NS_ENSURE_SUCCESS(rv, rv); rv = mObserverService->AddObserver(mListener, "startupcache-invalidate", false); NS_ENSURE_SUCCESS(rv, rv); - + rv = LoadArchive(RECORD_AGE); // Sometimes we don't have a cache yet, that's ok. // If it's corrupted, just remove it and start over. - if (gIgnoreDiskCache || (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND)) { + if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) { NS_WARNING("Failed to load startupcache file correctly, removing!"); InvalidateCache(); } mMappingMemoryReporter = new NS_MEMORY_REPORTER_NAME(StartupCacheMapping); mDataMemoryReporter = new NS_MEMORY_REPORTER_NAME(StartupCacheData); (void)::NS_RegisterMemoryReporter(mMappingMemoryReporter); (void)::NS_RegisterMemoryReporter(mDataMemoryReporter); @@ -223,19 +222,16 @@ StartupCache::Init() } /** * LoadArchive can be called from the main thread or while reloading cache on write thread. */ nsresult StartupCache::LoadArchive(enum TelemetrifyAge flag) { - if (gIgnoreDiskCache) - return NS_ERROR_FAILURE; - bool exists; mArchive = NULL; nsresult rv = mFile->Exists(&exists); if (NS_FAILED(rv) || !exists) return NS_ERROR_FILE_NOT_FOUND; mArchive = new nsZipArchive(); rv = mArchive->OpenArchive(mFile); @@ -457,50 +453,32 @@ StartupCache::WriteToDisk() holder.time = now; mTable.Enumerate(CacheCloseHelper, &holder); // Close the archive so Windows doesn't choke. mArchive = NULL; zipW->Close(); - // We succesfully wrote the archive to disk; mark the disk file as trusted - gIgnoreDiskCache = false; - // Our reader's view of the archive is outdated now, reload it. LoadArchive(gPostFlushAgeAction); return; } void StartupCache::InvalidateCache() { WaitOnWriteThread(); mTable.Clear(); mArchive = NULL; - nsresult rv = mFile->Remove(false); - if (NS_FAILED(rv) && rv != NS_ERROR_FILE_TARGET_DOES_NOT_EXIST && - rv != NS_ERROR_FILE_NOT_FOUND) { - gIgnoreDiskCache = true; - mozilla::Telemetry::Accumulate(Telemetry::STARTUP_CACHE_INVALID, true); - return; - } - gIgnoreDiskCache = false; + mFile->Remove(false); LoadArchive(gPostFlushAgeAction); } -void -StartupCache::IgnoreDiskCache() -{ - gIgnoreDiskCache = true; - if (gStartupCache) - gStartupCache->InvalidateCache(); -} - /* * WaitOnWriteThread() is called from a main thread to wait for the worker * thread to finish. However since the same code is used in the worker thread and * main thread, the worker thread can also call WaitOnWriteThread() which is a no-op. */ void StartupCache::WaitOnWriteThread() { @@ -730,23 +708,16 @@ StartupCacheWrapper::InvalidateCache() StartupCache* sc = StartupCache::GetSingleton(); if (!sc) { return NS_ERROR_NOT_INITIALIZED; } sc->InvalidateCache(); return NS_OK; } -nsresult -StartupCacheWrapper::IgnoreDiskCache() -{ - StartupCache::IgnoreDiskCache(); - return NS_OK; -} - nsresult StartupCacheWrapper::GetDebugObjectOutputStream(nsIObjectOutputStream* stream, nsIObjectOutputStream** outStream) { StartupCache* sc = StartupCache::GetSingleton(); if (!sc) { return NS_ERROR_NOT_INITIALIZED; }
--- a/startupcache/StartupCache.h +++ b/startupcache/StartupCache.h @@ -39,22 +39,16 @@ * stored in the cache (if any), and PutBuffer() inserts a buffer into the cache. * GetBuffer returns a new buffer, and the caller must take ownership of it. * PutBuffer will assert if the client attempts to insert a buffer with the same name as * an existing entry. The cache makes a copy of the passed-in buffer, so client * retains ownership. * * InvalidateCache() may be called if a client suspects data corruption * or wishes to invalidate for any other reason. This will remove all existing cache data. - * Additionally, the static method IgnoreDiskCache() can be called if it is - * believed that the on-disk cache file is itself corrupt. This call implicitly - * calls InvalidateCache (if the singleton has been initialized) to ensure any - * data already read from disk is discarded. The cache will not load data from - * the disk file until a successful write occurs. - * * Finally, getDebugObjectOutputStream() allows debug code to wrap an objectstream * with a debug objectstream, to check for multiply-referenced objects. These will * generally fail to deserialize correctly, unless they are stateless singletons or the * client maintains their own object data map for deserialization. * * Writes before the final-ui-startup notification are placed in an intermediate * cache in memory, then written out to disk at a later time, to get writes off the * startup path. In any case, clients should not rely on being able to GetBuffer() @@ -115,19 +109,16 @@ public: nsresult GetBuffer(const char* id, char** outbuf, uint32_t* length); // Stores a buffer. Caller keeps ownership, we make a copy. nsresult PutBuffer(const char* id, const char* inbuf, uint32_t length); // Removes the cache file. void InvalidateCache(); - // Signal that data should not be loaded from the cache file - static void IgnoreDiskCache(); - // In DEBUG builds, returns a stream that will attempt to check for // and disallow multiple writes of the same object. nsresult GetDebugObjectOutputStream(nsIObjectOutputStream* aStream, nsIObjectOutputStream** outStream); nsresult RecordAgesAlways(); static StartupCache* GetSingleton(); @@ -171,17 +162,16 @@ private: nsCOMPtr<nsIObserverService> mObserverService; nsRefPtr<StartupCacheListener> mListener; nsCOMPtr<nsITimer> mTimer; bool mStartupWriteInitiated; static StartupCache *gStartupCache; static bool gShutdownInitiated; - static bool gIgnoreDiskCache; PRThread *mWriteThread; #ifdef DEBUG nsTHashtable<nsISupportsHashKey> mWriteObjectMap; #endif nsIMemoryReporter* mMappingMemoryReporter; nsIMemoryReporter* mDataMemoryReporter; };
--- a/startupcache/nsIStartupCache.idl +++ b/startupcache/nsIStartupCache.idl @@ -4,33 +4,31 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsIInputStream.idl" #include "nsISupports.idl" #include "nsIObserver.idl" #include "nsIObjectOutputStream.idl" -[uuid(25957820-90a1-428c-8739-b0845d3cc534)] +[uuid(c1b3796b-33af-4ff0-b83d-8eb0ca2c080f)] interface nsIStartupCache : nsISupports { /** This interface is provided for testing purposes only, basically * just to solve link vagaries. See docs in StartupCache.h * GetBuffer, PutBuffer, and InvalidateCache act as described * in that file. */ uint32_t getBuffer(in string aID, out charPtr aBuffer); void putBuffer(in string aID, in string aBuffer, in uint32_t aLength); void invalidateCache(); - void ignoreDiskCache(); - /** In debug builds, wraps this object output stream with a stream that will * detect and prevent the write of a multiply-referenced non-singleton object * during serialization. In non-debug, returns an add-ref'd pointer to * original stream, unwrapped. */ nsIObjectOutputStream getDebugObjectOutputStream(in nsIObjectOutputStream aStream); /* Allows clients to check whether the one-time writeout after startup * has finished yet, and also to set this variable as needed (so test
--- a/startupcache/test/TestStartupCache.cpp +++ b/startupcache/test/TestStartupCache.cpp @@ -17,17 +17,16 @@ #include "nsIObjectInputStream.h" #include "nsIObjectOutputStream.h" #include "nsIURI.h" #include "nsStringAPI.h" #include "nsIPrefBranch.h" #include "nsIPrefService.h" #include "nsITelemetry.h" #include "jsapi.h" -#include "prio.h" namespace mozilla { namespace scache { NS_IMPORT nsresult NewObjectInputStreamFromBuffer(char* buffer, uint32_t len, nsIObjectInputStream** stream); @@ -52,17 +51,17 @@ if (0 != strcmp(str1, str2)) { return NS_ERROR_FAILURE; \ } \ passed("passed " testname); \ PR_END_MACRO nsresult WaitForStartupTimer() { nsresult rv; - nsCOMPtr<nsIStartupCache> sc + nsCOMPtr<nsIStartupCache> sc = do_GetService("@mozilla.org/startupcache/cache;1"); PR_Sleep(10 * PR_TicksPerSecond()); bool complete; while (true) { NS_ProcessPendingEvents(nullptr); rv = sc->StartupWriteComplete(&complete); @@ -71,17 +70,17 @@ WaitForStartupTimer() { PR_Sleep(1 * PR_TicksPerSecond()); } return rv; } nsresult TestStartupWriteRead() { nsresult rv; - nsCOMPtr<nsIStartupCache> sc + nsCOMPtr<nsIStartupCache> sc = do_GetService("@mozilla.org/startupcache/cache;1", &rv); if (!sc) { fail("didn't get a pointer..."); return NS_ERROR_FAILURE; } else { passed("got a pointer?"); } sc->InvalidateCache(); @@ -114,17 +113,17 @@ TestStartupWriteRead() { nsresult TestWriteInvalidateRead() { nsresult rv; const char* buf = "BeardBook competitive analysis"; const char* id = "id"; char* outbuf = NULL; uint32_t len; - nsCOMPtr<nsIStartupCache> sc + nsCOMPtr<nsIStartupCache> sc = do_GetService("@mozilla.org/startupcache/cache;1", &rv); sc->InvalidateCache(); rv = sc->PutBuffer(id, buf, strlen(buf) + 1); NS_ENSURE_SUCCESS(rv, rv); sc->InvalidateCache(); @@ -244,119 +243,19 @@ TestWriteObject() { return rv; } passed("write object"); return NS_OK; } nsresult -LockCacheFile(bool protect, nsIFile* profileDir) { - NS_ENSURE_ARG(profileDir); - - nsCOMPtr<nsIFile> startupCache; - profileDir->Clone(getter_AddRefs(startupCache)); - NS_ENSURE_STATE(startupCache); - startupCache->AppendNative(NS_LITERAL_CSTRING("startupCache")); - - nsresult rv; -#ifndef XP_WIN - static uint32_t oldPermissions; -#else - static PRFileDesc* fd = nullptr; -#endif - - // To prevent deletion of the startupcache file, we change the containing - // directory's permissions on Linux/Mac, and hold the file open on Windows - if (protect) { -#ifndef XP_WIN - rv = startupCache->GetPermissions(&oldPermissions); - NS_ENSURE_SUCCESS(rv, rv); - rv = startupCache->SetPermissions(0555); - NS_ENSURE_SUCCESS(rv, rv); -#else - // Filename logic from StartupCache.cpp - #ifdef IS_BIG_ENDIAN - #define SC_ENDIAN "big" - #else - #define SC_ENDIAN "little" - #endif - - #if PR_BYTES_PER_WORD == 4 - #define SC_WORDSIZE "4" - #else - #define SC_WORDSIZE "8" - #endif - char sStartupCacheName[] = "startupCache." SC_WORDSIZE "." SC_ENDIAN; - startupCache->AppendNative(NS_LITERAL_CSTRING(sStartupCacheName)); - - rv = startupCache->OpenNSPRFileDesc(PR_RDONLY, 0, &fd); - NS_ENSURE_SUCCESS(rv, rv); -#endif - } else { -#ifndef XP_WIN - rv = startupCache->SetPermissions(oldPermissions); - NS_ENSURE_SUCCESS(rv, rv); -#else - PR_Close(fd); -#endif - } - - return NS_OK; -} - -nsresult -TestIgnoreDiskCache(nsIFile* profileDir) { - nsresult rv; - nsCOMPtr<nsIStartupCache> sc - = do_GetService("@mozilla.org/startupcache/cache;1", &rv); - sc->InvalidateCache(); - - const char* buf = "Get a Beardbook app for your smartphone"; - const char* id = "id"; - char* outbuf = NULL; - PRUint32 len; - - rv = sc->PutBuffer(id, buf, strlen(buf) + 1); - NS_ENSURE_SUCCESS(rv, rv); - rv = sc->ResetStartupWriteTimer(); - rv = WaitForStartupTimer(); - NS_ENSURE_SUCCESS(rv, rv); - - // Prevent StartupCache::InvalidateCache from deleting the disk file - rv = LockCacheFile(true, profileDir); - NS_ENSURE_SUCCESS(rv, rv); - - sc->IgnoreDiskCache(); - - rv = sc->GetBuffer(id, &outbuf, &len); - - nsresult r = LockCacheFile(false, profileDir); - NS_ENSURE_SUCCESS(r, r); - - delete[] outbuf; - - if (rv == NS_ERROR_NOT_AVAILABLE) { - passed("buffer not available after ignoring disk cache"); - } else if (NS_SUCCEEDED(rv)) { - fail("GetBuffer succeeded unexpectedly after ignoring disk cache"); - return NS_ERROR_UNEXPECTED; - } else { - fail("GetBuffer gave an unexpected failure, expected NOT_AVAILABLE"); - return rv; - } - - sc->InvalidateCache(); - return NS_OK; -} - -nsresult TestEarlyShutdown() { nsresult rv; - nsCOMPtr<nsIStartupCache> sc + nsCOMPtr<nsIStartupCache> sc = do_GetService("@mozilla.org/startupcache/cache;1", &rv); sc->InvalidateCache(); const char* buf = "Find your soul beardmate on BeardBook"; const char* id = "id"; uint32_t len; char* outbuf = NULL; @@ -395,24 +294,24 @@ SetupJS(JSContext **cxp) JSContext *cx = JS_NewContext(rt, 8192); if (!cx) return false; *cxp = cx; return true; } bool -GetHistogramCounts(const char *testmsg, const nsACString &histogram_id, - JSContext *cx, jsval *counts) +GetHistogramCounts(const char *testmsg, JSContext *cx, jsval *counts) { nsCOMPtr<nsITelemetry> telemetry = do_GetService("@mozilla.org/base/telemetry;1"); + NS_NAMED_LITERAL_CSTRING(histogram_id, "STARTUP_CACHE_AGE_HOURS"); JS::AutoValueRooter h(cx); nsresult trv = telemetry->GetHistogramById(histogram_id, cx, h.addr()); if (NS_FAILED(trv)) { - fail("%s: couldn't get histogram %s", testmsg, ToNewCString(histogram_id)); + fail("%s: couldn't get histogram", testmsg); return false; } passed(testmsg); JS::AutoValueRooter snapshot_val(cx); JSFunction *snapshot_fn = NULL; JS::AutoValueRooter ss(cx); return (JS_GetProperty(cx, JSVAL_TO_OBJECT(h.value()), "snapshot", @@ -454,42 +353,21 @@ CompareCountArrays(JSContext *cx, JSObje } else { // Some element of the histograms's count arrays differed. // That's a good thing! return NS_OK; } } } - // None of the elements of the histograms's count arrays differed. + // All of the elements of the histograms's count arrays differed. // Not good, we should have recorded something. return NS_ERROR_FAILURE; } -nsresult -TestHistogramValues(const char* type, bool use_js, JSContext *cx, - JSObject *before, JSObject *after) -{ - if (!use_js) { - fail("couldn't check histogram recording"); - return NS_ERROR_FAILURE; - } - nsresult compare = CompareCountArrays(cx, before, after); - if (compare == NS_ERROR_UNEXPECTED) { - fail("count comparison error"); - return compare; - } - if (compare == NS_ERROR_FAILURE) { - fail("histogram didn't record %s", type); - return compare; - } - passed("histogram records %s", type); - return NS_OK; -} - int main(int argc, char** argv) { ScopedXPCOM xpcom("Startup Cache"); if (xpcom.failed()) return 1; nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID); prefs->SetIntPref("hangmonitor.timeout", 0); @@ -515,63 +393,54 @@ int main(int argc, char** argv) if (!glob) use_js = false; mozilla::Maybe<JSAutoCompartment> ac; if (use_js) ac.construct(cx, glob); if (use_js && !JS_InitStandardClasses(cx, glob)) use_js = false; - NS_NAMED_LITERAL_CSTRING(age_histogram_id, "STARTUP_CACHE_AGE_HOURS"); - NS_NAMED_LITERAL_CSTRING(invalid_histogram_id, "STARTUP_CACHE_INVALID"); - - JS::AutoValueRooter age_before_counts(cx); + JS::AutoValueRooter before_counts(cx); if (use_js && !GetHistogramCounts("STARTUP_CACHE_AGE_HOURS histogram before test", - age_histogram_id, cx, age_before_counts.addr())) - use_js = false; - - JS::AutoValueRooter invalid_before_counts(cx); - if (use_js && !GetHistogramCounts("STARTUP_CACHE_INVALID histogram before test", - invalid_histogram_id, cx, invalid_before_counts.addr())) + cx, before_counts.addr())) use_js = false; nsresult scrv; nsCOMPtr<nsIStartupCache> sc = do_GetService("@mozilla.org/startupcache/cache;1", &scrv); if (NS_FAILED(scrv)) rv = 1; else sc->RecordAgesAlways(); if (NS_FAILED(TestStartupWriteRead())) rv = 1; if (NS_FAILED(TestWriteInvalidateRead())) rv = 1; if (NS_FAILED(TestWriteObject())) rv = 1; - nsCOMPtr<nsIFile> profileDir = xpcom.GetProfileDirectory(); - if (NS_FAILED(TestIgnoreDiskCache(profileDir))) - rv = 1; if (NS_FAILED(TestEarlyShutdown())) rv = 1; - JS::AutoValueRooter age_after_counts(cx); + JS::AutoValueRooter after_counts(cx); if (use_js && !GetHistogramCounts("STARTUP_CACHE_AGE_HOURS histogram after test", - age_histogram_id, cx, age_after_counts.addr())) + cx, after_counts.addr())) use_js = false; - if (NS_FAILED(TestHistogramValues("age samples", use_js, cx, - JSVAL_TO_OBJECT(age_before_counts.value()), - JSVAL_TO_OBJECT(age_after_counts.value())))) + if (!use_js) { + fail("couldn't check histogram recording"); rv = 1; - - JS::AutoValueRooter invalid_after_counts(cx); - if (use_js && !GetHistogramCounts("STARTUP_CACHE_INVALID histogram after test", - invalid_histogram_id, cx, invalid_after_counts.addr())) - use_js = false; - - // STARTUP_CACHE_INVALID should have been triggered by TestIgnoreDiskCache() - if (NS_FAILED(TestHistogramValues("invalid disk cache", use_js, cx, - JSVAL_TO_OBJECT(invalid_before_counts.value()), - JSVAL_TO_OBJECT(invalid_after_counts.value())))) - rv = 1; + } else { + nsresult compare = CompareCountArrays(cx, + JSVAL_TO_OBJECT(before_counts.value()), + JSVAL_TO_OBJECT(after_counts.value())); + if (compare == NS_ERROR_UNEXPECTED) { + fail("count comparison error"); + rv = 1; + } else if (compare == NS_ERROR_FAILURE) { + fail("histogram didn't record samples"); + rv = 1; + } else { + passed("histogram records samples"); + } + } return rv; }
--- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -424,20 +424,16 @@ "description": "Maximum retention time for the gradient cache. (ms)" }, "STARTUP_CACHE_AGE_HOURS": { "kind": "exponential", "high": "3000", "n_buckets": 20, "description": "Startup cache age (hours)" }, - "STARTUP_CACHE_INVALID": { - "kind": "flag", - "description": "Was the disk startup cache file detected as invalid" - }, "WORD_CACHE_HITS": { "kind": "exponential", "high": "256", "n_buckets": 30, "description": "Word cache hits (chars)" }, "WORD_CACHE_MISSES": { "kind": "exponential",
--- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -86,23 +86,21 @@ #include "nsIWindowWatcher.h" #include "nsIXULAppInfo.h" #include "nsIXULRuntime.h" #include "nsPIDOMWindow.h" #include "nsIBaseWindow.h" #include "nsIWidget.h" #include "nsIDocShell.h" #include "nsAppShellCID.h" -#include "mozilla/scache/StartupCache.h" #include "mozilla/unused.h" using namespace mozilla; using mozilla::unused; -using mozilla::scache::StartupCache; #ifdef XP_WIN #include "nsIWinAppHelper.h" #include <windows.h> #include "cairo/cairo-features.h" #ifndef PROCESS_DEP_ENABLE #define PROCESS_DEP_ENABLE 0x1 @@ -2402,17 +2400,17 @@ static void BuildVersion(nsCString &aBuf aBuf.Append(gAppData->buildID); aBuf.Append('/'); aBuf.Append(gToolkitBuildID); } static void WriteVersion(nsIFile* aProfileDir, const nsCString& aVersion, const nsCString& aOSABI, nsIFile* aXULRunnerDir, - nsIFile* aAppDir, bool invalidateCache) + nsIFile* aAppDir) { nsCOMPtr<nsIFile> file; aProfileDir->Clone(getter_AddRefs(file)); if (!file) return; file->AppendNative(FILE_COMPATIBILITY_INFO); nsAutoCString platformDir; @@ -2445,65 +2443,53 @@ WriteVersion(nsIFile* aProfileDir, const PR_Write(fd, platformDir.get(), platformDir.Length()); static const char kAppDirHeader[] = NS_LINEBREAK "LastAppDir="; if (aAppDir) { PR_Write(fd, kAppDirHeader, sizeof(kAppDirHeader) - 1); PR_Write(fd, appDir.get(), appDir.Length()); } - static const char kInvalidationHeader[] = "InvalidateCaches=1" NS_LINEBREAK; - if (invalidateCache) - PR_Write(fd, kInvalidationHeader, sizeof(kInvalidationHeader) - 1); - static const char kNL[] = NS_LINEBREAK; PR_Write(fd, kNL, sizeof(kNL) - 1); PR_Close(fd); } -/** - * Returns true if the startup cache file was successfully removed. - * Returns false if file->Clone fails at any point (OOM) or if unable - * to remove the startup cache file. Note in particular the return value - * is unaffected by a failure to remove extensions.ini - */ -static bool -RemoveComponentRegistries(nsIFile* aProfileDir, nsIFile* aLocalProfileDir, +static void RemoveComponentRegistries(nsIFile* aProfileDir, nsIFile* aLocalProfileDir, bool aRemoveEMFiles) { nsCOMPtr<nsIFile> file; aProfileDir->Clone(getter_AddRefs(file)); if (!file) - return false; + return; if (aRemoveEMFiles) { file->SetNativeLeafName(NS_LITERAL_CSTRING("extensions.ini")); file->Remove(false); } aLocalProfileDir->Clone(getter_AddRefs(file)); if (!file) - return false; + return; #if defined(XP_UNIX) || defined(XP_BEOS) #define PLATFORM_FASL_SUFFIX ".mfasl" #elif defined(XP_WIN) || defined(XP_OS2) #define PLATFORM_FASL_SUFFIX ".mfl" #endif 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; + file->Remove(true); } // 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; @@ -3541,49 +3527,45 @@ XREMain::XRE_mainStartup(bool* aExitFlag // Every time a profile is loaded by a build with a different version, // it updates the compatibility.ini file saying what version last wrote // the fastload caches. On subsequent launches if the version matches, // there is no need for re-registration. If the user loads the same // profile in different builds the component registry must be // re-generated to prevent mysterious component loading failures. // - bool invalidateStartupCache = false; if (gSafeMode) { - invalidateStartupCache = RemoveComponentRegistries(mProfD, mProfLD, false); + RemoveComponentRegistries(mProfD, mProfLD, false); WriteVersion(mProfD, NS_LITERAL_CSTRING("Safe Mode"), osABI, - mDirProvider.GetGREDir(), mAppData->directory, invalidateStartupCache); + mDirProvider.GetGREDir(), mAppData->directory); } else if (versionOK) { if (!cachesOK) { // Remove caches, forcing component re-registration. // The new list of additional components directories is derived from // information in "extensions.ini". - invalidateStartupCache = RemoveComponentRegistries(mProfD, mProfLD, false); + RemoveComponentRegistries(mProfD, mProfLD, false); // Rewrite compatibility.ini to remove the flag WriteVersion(mProfD, version, osABI, - mDirProvider.GetGREDir(), mAppData->directory, invalidateStartupCache); + mDirProvider.GetGREDir(), mAppData->directory); } // Nothing need be done for the normal startup case. } else { // Remove caches, forcing component re-registration // with the default set of components (this disables any potentially // troublesome incompatible XPCOM components). - invalidateStartupCache = RemoveComponentRegistries(mProfD, mProfLD, true); + RemoveComponentRegistries(mProfD, mProfLD, true); // Write out version WriteVersion(mProfD, version, osABI, - mDirProvider.GetGREDir(), mAppData->directory, invalidateStartupCache); + mDirProvider.GetGREDir(), mAppData->directory); } - if (invalidateStartupCache) - StartupCache::IgnoreDiskCache(); - if (flagFile) { flagFile->Remove(true); } return 0; } /*